diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:05:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:39:04 -0400 |
commit | 899826f16a034f1ab6d23cd5b60cd113eaefad19 (patch) | |
tree | d4b7151dde4afb824ead028093f2021769fc2b52 /drivers/misc | |
parent | eb375597e2d456499bfa427fb398ab36bdc837e5 (diff) |
enclosure: convert class code to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups
should be used instead. This converts the enclosure class code to use
the correct field.
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/enclosure.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 00e5fcac8fdf..0e8df41aaf14 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c | |||
@@ -239,7 +239,7 @@ static void enclosure_component_release(struct device *dev) | |||
239 | put_device(dev->parent); | 239 | put_device(dev->parent); |
240 | } | 240 | } |
241 | 241 | ||
242 | static const struct attribute_group *enclosure_groups[]; | 242 | static const struct attribute_group *enclosure_component_groups[]; |
243 | 243 | ||
244 | /** | 244 | /** |
245 | * enclosure_component_register - add a particular component to an enclosure | 245 | * enclosure_component_register - add a particular component to an enclosure |
@@ -282,7 +282,7 @@ enclosure_component_register(struct enclosure_device *edev, | |||
282 | dev_set_name(cdev, "%u", number); | 282 | dev_set_name(cdev, "%u", number); |
283 | 283 | ||
284 | cdev->release = enclosure_component_release; | 284 | cdev->release = enclosure_component_release; |
285 | cdev->groups = enclosure_groups; | 285 | cdev->groups = enclosure_component_groups; |
286 | 286 | ||
287 | err = device_register(cdev); | 287 | err = device_register(cdev); |
288 | if (err) { | 288 | if (err) { |
@@ -365,25 +365,26 @@ EXPORT_SYMBOL_GPL(enclosure_remove_device); | |||
365 | * sysfs pieces below | 365 | * sysfs pieces below |
366 | */ | 366 | */ |
367 | 367 | ||
368 | static ssize_t enclosure_show_components(struct device *cdev, | 368 | static ssize_t components_show(struct device *cdev, |
369 | struct device_attribute *attr, | 369 | struct device_attribute *attr, char *buf) |
370 | char *buf) | ||
371 | { | 370 | { |
372 | struct enclosure_device *edev = to_enclosure_device(cdev); | 371 | struct enclosure_device *edev = to_enclosure_device(cdev); |
373 | 372 | ||
374 | return snprintf(buf, 40, "%d\n", edev->components); | 373 | return snprintf(buf, 40, "%d\n", edev->components); |
375 | } | 374 | } |
375 | static DEVICE_ATTR_RO(components); | ||
376 | 376 | ||
377 | static struct device_attribute enclosure_attrs[] = { | 377 | static struct attribute *enclosure_class_attrs[] = { |
378 | __ATTR(components, S_IRUGO, enclosure_show_components, NULL), | 378 | &dev_attr_components.attr, |
379 | __ATTR_NULL | 379 | NULL, |
380 | }; | 380 | }; |
381 | ATTRIBUTE_GROUPS(enclosure_class); | ||
381 | 382 | ||
382 | static struct class enclosure_class = { | 383 | static struct class enclosure_class = { |
383 | .name = "enclosure", | 384 | .name = "enclosure", |
384 | .owner = THIS_MODULE, | 385 | .owner = THIS_MODULE, |
385 | .dev_release = enclosure_release, | 386 | .dev_release = enclosure_release, |
386 | .dev_attrs = enclosure_attrs, | 387 | .dev_groups = enclosure_class_groups, |
387 | }; | 388 | }; |
388 | 389 | ||
389 | static const char *const enclosure_status [] = { | 390 | static const char *const enclosure_status [] = { |
@@ -536,15 +537,7 @@ static struct attribute *enclosure_component_attrs[] = { | |||
536 | &dev_attr_type.attr, | 537 | &dev_attr_type.attr, |
537 | NULL | 538 | NULL |
538 | }; | 539 | }; |
539 | 540 | ATTRIBUTE_GROUPS(enclosure_component); | |
540 | static struct attribute_group enclosure_group = { | ||
541 | .attrs = enclosure_component_attrs, | ||
542 | }; | ||
543 | |||
544 | static const struct attribute_group *enclosure_groups[] = { | ||
545 | &enclosure_group, | ||
546 | NULL | ||
547 | }; | ||
548 | 541 | ||
549 | static int __init enclosure_init(void) | 542 | static int __init enclosure_init(void) |
550 | { | 543 | { |