aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 5fa83f751378..6b65fa4e0c55 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -199,18 +199,6 @@ struct bmc_device {
199 int guid_set; 199 int guid_set;
200 char name[16]; 200 char name[16];
201 struct kref usecount; 201 struct kref usecount;
202
203 /* bmc device attributes */
204 struct device_attribute device_id_attr;
205 struct device_attribute provides_dev_sdrs_attr;
206 struct device_attribute revision_attr;
207 struct device_attribute firmware_rev_attr;
208 struct device_attribute version_attr;
209 struct device_attribute add_dev_support_attr;
210 struct device_attribute manufacturer_id_attr;
211 struct device_attribute product_id_attr;
212 struct device_attribute guid_attr;
213 struct device_attribute aux_firmware_rev_attr;
214}; 202};
215#define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev) 203#define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev)
216 204
@@ -2252,7 +2240,7 @@ static ssize_t device_id_show(struct device *dev,
2252 2240
2253 return snprintf(buf, 10, "%u\n", bmc->id.device_id); 2241 return snprintf(buf, 10, "%u\n", bmc->id.device_id);
2254} 2242}
2255DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL); 2243static DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL);
2256 2244
2257static ssize_t provides_device_sdrs_show(struct device *dev, 2245static ssize_t provides_device_sdrs_show(struct device *dev,
2258 struct device_attribute *attr, 2246 struct device_attribute *attr,
@@ -2263,7 +2251,8 @@ static ssize_t provides_device_sdrs_show(struct device *dev,
2263 return snprintf(buf, 10, "%u\n", 2251 return snprintf(buf, 10, "%u\n",
2264 (bmc->id.device_revision & 0x80) >> 7); 2252 (bmc->id.device_revision & 0x80) >> 7);
2265} 2253}
2266DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show, NULL); 2254static DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show,
2255 NULL);
2267 2256
2268static ssize_t revision_show(struct device *dev, struct device_attribute *attr, 2257static ssize_t revision_show(struct device *dev, struct device_attribute *attr,
2269 char *buf) 2258 char *buf)
@@ -2273,7 +2262,7 @@ static ssize_t revision_show(struct device *dev, struct device_attribute *attr,
2273 return snprintf(buf, 20, "%u\n", 2262 return snprintf(buf, 20, "%u\n",
2274 bmc->id.device_revision & 0x0F); 2263 bmc->id.device_revision & 0x0F);
2275} 2264}
2276DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL); 2265static DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL);
2277 2266
2278static ssize_t firmware_revision_show(struct device *dev, 2267static ssize_t firmware_revision_show(struct device *dev,
2279 struct device_attribute *attr, 2268 struct device_attribute *attr,
@@ -2284,7 +2273,7 @@ static ssize_t firmware_revision_show(struct device *dev,
2284 return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1, 2273 return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1,
2285 bmc->id.firmware_revision_2); 2274 bmc->id.firmware_revision_2);
2286} 2275}
2287DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL); 2276static DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL);
2288 2277
2289static ssize_t ipmi_version_show(struct device *dev, 2278static ssize_t ipmi_version_show(struct device *dev,
2290 struct device_attribute *attr, 2279 struct device_attribute *attr,
@@ -2296,7 +2285,7 @@ static ssize_t ipmi_version_show(struct device *dev,
2296 ipmi_version_major(&bmc->id), 2285 ipmi_version_major(&bmc->id),
2297 ipmi_version_minor(&bmc->id)); 2286 ipmi_version_minor(&bmc->id));
2298} 2287}
2299DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL); 2288static DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL);
2300 2289
2301static ssize_t add_dev_support_show(struct device *dev, 2290static ssize_t add_dev_support_show(struct device *dev,
2302 struct device_attribute *attr, 2291 struct device_attribute *attr,
@@ -2307,7 +2296,8 @@ static ssize_t add_dev_support_show(struct device *dev,
2307 return snprintf(buf, 10, "0x%02x\n", 2296 return snprintf(buf, 10, "0x%02x\n",
2308 bmc->id.additional_device_support); 2297 bmc->id.additional_device_support);
2309} 2298}
2310DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show, NULL); 2299static DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show,
2300 NULL);
2311 2301
2312static ssize_t manufacturer_id_show(struct device *dev, 2302static ssize_t manufacturer_id_show(struct device *dev,
2313 struct device_attribute *attr, 2303 struct device_attribute *attr,
@@ -2317,7 +2307,7 @@ static ssize_t manufacturer_id_show(struct device *dev,
2317 2307
2318 return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id); 2308 return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id);
2319} 2309}
2320DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL); 2310static DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL);
2321 2311
2322static ssize_t product_id_show(struct device *dev, 2312static ssize_t product_id_show(struct device *dev,
2323 struct device_attribute *attr, 2313 struct device_attribute *attr,
@@ -2327,7 +2317,7 @@ static ssize_t product_id_show(struct device *dev,
2327 2317
2328 return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id); 2318 return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id);
2329} 2319}
2330DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL); 2320static DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL);
2331 2321
2332static ssize_t aux_firmware_rev_show(struct device *dev, 2322static ssize_t aux_firmware_rev_show(struct device *dev,
2333 struct device_attribute *attr, 2323 struct device_attribute *attr,
@@ -2341,7 +2331,7 @@ static ssize_t aux_firmware_rev_show(struct device *dev,
2341 bmc->id.aux_firmware_revision[1], 2331 bmc->id.aux_firmware_revision[1],
2342 bmc->id.aux_firmware_revision[0]); 2332 bmc->id.aux_firmware_revision[0]);
2343} 2333}
2344DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL); 2334static DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL);
2345 2335
2346static ssize_t guid_show(struct device *dev, struct device_attribute *attr, 2336static ssize_t guid_show(struct device *dev, struct device_attribute *attr,
2347 char *buf) 2337 char *buf)
@@ -2352,7 +2342,7 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr,
2352 (long long) bmc->guid[0], 2342 (long long) bmc->guid[0],
2353 (long long) bmc->guid[8]); 2343 (long long) bmc->guid[8]);
2354} 2344}
2355DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL); 2345static DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL);
2356 2346
2357static struct attribute *bmc_dev_attrs[] = { 2347static struct attribute *bmc_dev_attrs[] = {
2358 &dev_attr_device_id.attr, 2348 &dev_attr_device_id.attr,
@@ -2392,10 +2382,10 @@ cleanup_bmc_device(struct kref *ref)
2392 2382
2393 if (bmc->id.aux_firmware_revision_set) 2383 if (bmc->id.aux_firmware_revision_set)
2394 device_remove_file(&bmc->pdev.dev, 2384 device_remove_file(&bmc->pdev.dev,
2395 &bmc->aux_firmware_rev_attr); 2385 &dev_attr_aux_firmware_revision);
2396 if (bmc->guid_set) 2386 if (bmc->guid_set)
2397 device_remove_file(&bmc->pdev.dev, 2387 device_remove_file(&bmc->pdev.dev,
2398 &bmc->guid_attr); 2388 &dev_attr_guid);
2399 2389
2400 platform_device_unregister(&bmc->pdev); 2390 platform_device_unregister(&bmc->pdev);
2401} 2391}
@@ -2422,16 +2412,14 @@ static int create_bmc_files(struct bmc_device *bmc)
2422 int err; 2412 int err;
2423 2413
2424 if (bmc->id.aux_firmware_revision_set) { 2414 if (bmc->id.aux_firmware_revision_set) {
2425 bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision";
2426 err = device_create_file(&bmc->pdev.dev, 2415 err = device_create_file(&bmc->pdev.dev,
2427 &bmc->aux_firmware_rev_attr); 2416 &dev_attr_aux_firmware_revision);
2428 if (err) 2417 if (err)
2429 goto out; 2418 goto out;
2430 } 2419 }
2431 if (bmc->guid_set) { 2420 if (bmc->guid_set) {
2432 bmc->guid_attr.attr.name = "guid";
2433 err = device_create_file(&bmc->pdev.dev, 2421 err = device_create_file(&bmc->pdev.dev,
2434 &bmc->guid_attr); 2422 &dev_attr_guid);
2435 if (err) 2423 if (err)
2436 goto out_aux_firm; 2424 goto out_aux_firm;
2437 } 2425 }
@@ -2441,7 +2429,7 @@ static int create_bmc_files(struct bmc_device *bmc)
2441out_aux_firm: 2429out_aux_firm:
2442 if (bmc->id.aux_firmware_revision_set) 2430 if (bmc->id.aux_firmware_revision_set)
2443 device_remove_file(&bmc->pdev.dev, 2431 device_remove_file(&bmc->pdev.dev,
2444 &bmc->aux_firmware_rev_attr); 2432 &dev_attr_aux_firmware_revision);
2445out: 2433out:
2446 return err; 2434 return err;
2447} 2435}