Commit 9c633317 authored by Corey Minyard's avatar Corey Minyard

ipmi: Finish cleanup of BMC attributes

The previous cleanup of BMC attributes left a few holes, and if
you run with lockdep debugging with a BMC with the proper attributes,
you could get a warning.

This patch removes all the unused attributes from the BMC structure,
since they are all declared in the .data section now.  It makes
the attributes all static.  It fixes the referencing of the
attributes in a couple of cases that dynamically added the files
depending on BMC information.
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
Cc: Huang Ying <ying.huang@intel.com>
Tested-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
parent 603ba7e4
...@@ -199,18 +199,6 @@ struct bmc_device { ...@@ -199,18 +199,6 @@ struct bmc_device {
int guid_set; int guid_set;
char name[16]; char name[16];
struct kref usecount; struct kref usecount;
/* bmc device attributes */
struct device_attribute device_id_attr;
struct device_attribute provides_dev_sdrs_attr;
struct device_attribute revision_attr;
struct device_attribute firmware_rev_attr;
struct device_attribute version_attr;
struct device_attribute add_dev_support_attr;
struct device_attribute manufacturer_id_attr;
struct device_attribute product_id_attr;
struct device_attribute guid_attr;
struct device_attribute aux_firmware_rev_attr;
}; };
#define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev) #define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev)
...@@ -2252,7 +2240,7 @@ static ssize_t device_id_show(struct device *dev, ...@@ -2252,7 +2240,7 @@ static ssize_t device_id_show(struct device *dev,
return snprintf(buf, 10, "%u\n", bmc->id.device_id); return snprintf(buf, 10, "%u\n", bmc->id.device_id);
} }
DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL); static DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL);
static ssize_t provides_device_sdrs_show(struct device *dev, static ssize_t provides_device_sdrs_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2263,7 +2251,8 @@ static ssize_t provides_device_sdrs_show(struct device *dev, ...@@ -2263,7 +2251,8 @@ static ssize_t provides_device_sdrs_show(struct device *dev,
return snprintf(buf, 10, "%u\n", return snprintf(buf, 10, "%u\n",
(bmc->id.device_revision & 0x80) >> 7); (bmc->id.device_revision & 0x80) >> 7);
} }
DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show, NULL); static DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show,
NULL);
static ssize_t revision_show(struct device *dev, struct device_attribute *attr, static ssize_t revision_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
...@@ -2273,7 +2262,7 @@ static ssize_t revision_show(struct device *dev, struct device_attribute *attr, ...@@ -2273,7 +2262,7 @@ static ssize_t revision_show(struct device *dev, struct device_attribute *attr,
return snprintf(buf, 20, "%u\n", return snprintf(buf, 20, "%u\n",
bmc->id.device_revision & 0x0F); bmc->id.device_revision & 0x0F);
} }
DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL); static DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL);
static ssize_t firmware_revision_show(struct device *dev, static ssize_t firmware_revision_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2284,7 +2273,7 @@ static ssize_t firmware_revision_show(struct device *dev, ...@@ -2284,7 +2273,7 @@ static ssize_t firmware_revision_show(struct device *dev,
return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1, return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1,
bmc->id.firmware_revision_2); bmc->id.firmware_revision_2);
} }
DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL); static DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL);
static ssize_t ipmi_version_show(struct device *dev, static ssize_t ipmi_version_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2296,7 +2285,7 @@ static ssize_t ipmi_version_show(struct device *dev, ...@@ -2296,7 +2285,7 @@ static ssize_t ipmi_version_show(struct device *dev,
ipmi_version_major(&bmc->id), ipmi_version_major(&bmc->id),
ipmi_version_minor(&bmc->id)); ipmi_version_minor(&bmc->id));
} }
DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL); static DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL);
static ssize_t add_dev_support_show(struct device *dev, static ssize_t add_dev_support_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2307,7 +2296,8 @@ static ssize_t add_dev_support_show(struct device *dev, ...@@ -2307,7 +2296,8 @@ static ssize_t add_dev_support_show(struct device *dev,
return snprintf(buf, 10, "0x%02x\n", return snprintf(buf, 10, "0x%02x\n",
bmc->id.additional_device_support); bmc->id.additional_device_support);
} }
DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show, NULL); static DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show,
NULL);
static ssize_t manufacturer_id_show(struct device *dev, static ssize_t manufacturer_id_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2317,7 +2307,7 @@ static ssize_t manufacturer_id_show(struct device *dev, ...@@ -2317,7 +2307,7 @@ static ssize_t manufacturer_id_show(struct device *dev,
return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id); return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id);
} }
DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL); static DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL);
static ssize_t product_id_show(struct device *dev, static ssize_t product_id_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2327,7 +2317,7 @@ static ssize_t product_id_show(struct device *dev, ...@@ -2327,7 +2317,7 @@ static ssize_t product_id_show(struct device *dev,
return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id); return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id);
} }
DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL); static DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL);
static ssize_t aux_firmware_rev_show(struct device *dev, static ssize_t aux_firmware_rev_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -2341,7 +2331,7 @@ static ssize_t aux_firmware_rev_show(struct device *dev, ...@@ -2341,7 +2331,7 @@ static ssize_t aux_firmware_rev_show(struct device *dev,
bmc->id.aux_firmware_revision[1], bmc->id.aux_firmware_revision[1],
bmc->id.aux_firmware_revision[0]); bmc->id.aux_firmware_revision[0]);
} }
DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL); static DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL);
static ssize_t guid_show(struct device *dev, struct device_attribute *attr, static ssize_t guid_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
...@@ -2352,7 +2342,7 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr, ...@@ -2352,7 +2342,7 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr,
(long long) bmc->guid[0], (long long) bmc->guid[0],
(long long) bmc->guid[8]); (long long) bmc->guid[8]);
} }
DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL); static DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL);
static struct attribute *bmc_dev_attrs[] = { static struct attribute *bmc_dev_attrs[] = {
&dev_attr_device_id.attr, &dev_attr_device_id.attr,
...@@ -2392,10 +2382,10 @@ cleanup_bmc_device(struct kref *ref) ...@@ -2392,10 +2382,10 @@ cleanup_bmc_device(struct kref *ref)
if (bmc->id.aux_firmware_revision_set) if (bmc->id.aux_firmware_revision_set)
device_remove_file(&bmc->pdev.dev, device_remove_file(&bmc->pdev.dev,
&bmc->aux_firmware_rev_attr); &dev_attr_aux_firmware_revision);
if (bmc->guid_set) if (bmc->guid_set)
device_remove_file(&bmc->pdev.dev, device_remove_file(&bmc->pdev.dev,
&bmc->guid_attr); &dev_attr_guid);
platform_device_unregister(&bmc->pdev); platform_device_unregister(&bmc->pdev);
} }
...@@ -2422,16 +2412,14 @@ static int create_bmc_files(struct bmc_device *bmc) ...@@ -2422,16 +2412,14 @@ static int create_bmc_files(struct bmc_device *bmc)
int err; int err;
if (bmc->id.aux_firmware_revision_set) { if (bmc->id.aux_firmware_revision_set) {
bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision";
err = device_create_file(&bmc->pdev.dev, err = device_create_file(&bmc->pdev.dev,
&bmc->aux_firmware_rev_attr); &dev_attr_aux_firmware_revision);
if (err) if (err)
goto out; goto out;
} }
if (bmc->guid_set) { if (bmc->guid_set) {
bmc->guid_attr.attr.name = "guid";
err = device_create_file(&bmc->pdev.dev, err = device_create_file(&bmc->pdev.dev,
&bmc->guid_attr); &dev_attr_guid);
if (err) if (err)
goto out_aux_firm; goto out_aux_firm;
} }
...@@ -2441,7 +2429,7 @@ static int create_bmc_files(struct bmc_device *bmc) ...@@ -2441,7 +2429,7 @@ static int create_bmc_files(struct bmc_device *bmc)
out_aux_firm: out_aux_firm:
if (bmc->id.aux_firmware_revision_set) if (bmc->id.aux_firmware_revision_set)
device_remove_file(&bmc->pdev.dev, device_remove_file(&bmc->pdev.dev,
&bmc->aux_firmware_rev_attr); &dev_attr_aux_firmware_revision);
out: out:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment