aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-05 21:25:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-06 02:59:34 -0400
commitbcc8edb52f05c1a9e75118d6b3bc04996a750593 (patch)
tree440c098c1f2dcae1470d32076b3a488de8852ece /drivers/base
parent3124eb1679b28726eacbc8973a891235dca3ed99 (diff)
driver core: remove dev_attrs from struct class
Now that all in-kernel users of the dev_attrs field are converted to use dev_groups, we can safely remove dev_attrs from struct class. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 319c2c594ac6..f67e86687ae2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -455,35 +455,6 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
455} 455}
456static DEVICE_ATTR_RW(online); 456static DEVICE_ATTR_RW(online);
457 457
458static int device_add_attributes(struct device *dev,
459 struct device_attribute *attrs)
460{
461 int error = 0;
462 int i;
463
464 if (attrs) {
465 for (i = 0; attrs[i].attr.name; i++) {
466 error = device_create_file(dev, &attrs[i]);
467 if (error)
468 break;
469 }
470 if (error)
471 while (--i >= 0)
472 device_remove_file(dev, &attrs[i]);
473 }
474 return error;
475}
476
477static void device_remove_attributes(struct device *dev,
478 struct device_attribute *attrs)
479{
480 int i;
481
482 if (attrs)
483 for (i = 0; attrs[i].attr.name; i++)
484 device_remove_file(dev, &attrs[i]);
485}
486
487static int device_add_bin_attributes(struct device *dev, 458static int device_add_bin_attributes(struct device *dev,
488 struct bin_attribute *attrs) 459 struct bin_attribute *attrs)
489{ 460{
@@ -534,12 +505,9 @@ static int device_add_attrs(struct device *dev)
534 error = device_add_groups(dev, class->dev_groups); 505 error = device_add_groups(dev, class->dev_groups);
535 if (error) 506 if (error)
536 return error; 507 return error;
537 error = device_add_attributes(dev, class->dev_attrs);
538 if (error)
539 goto err_remove_class_groups;
540 error = device_add_bin_attributes(dev, class->dev_bin_attrs); 508 error = device_add_bin_attributes(dev, class->dev_bin_attrs);
541 if (error) 509 if (error)
542 goto err_remove_class_attrs; 510 goto err_remove_class_groups;
543 } 511 }
544 512
545 if (type) { 513 if (type) {
@@ -566,9 +534,6 @@ static int device_add_attrs(struct device *dev)
566 err_remove_class_bin_attrs: 534 err_remove_class_bin_attrs:
567 if (class) 535 if (class)
568 device_remove_bin_attributes(dev, class->dev_bin_attrs); 536 device_remove_bin_attributes(dev, class->dev_bin_attrs);
569 err_remove_class_attrs:
570 if (class)
571 device_remove_attributes(dev, class->dev_attrs);
572 err_remove_class_groups: 537 err_remove_class_groups:
573 if (class) 538 if (class)
574 device_remove_groups(dev, class->dev_groups); 539 device_remove_groups(dev, class->dev_groups);
@@ -588,7 +553,6 @@ static void device_remove_attrs(struct device *dev)
588 device_remove_groups(dev, type->groups); 553 device_remove_groups(dev, type->groups);
589 554
590 if (class) { 555 if (class) {
591 device_remove_attributes(dev, class->dev_attrs);
592 device_remove_bin_attributes(dev, class->dev_bin_attrs); 556 device_remove_bin_attributes(dev, class->dev_bin_attrs);
593 device_remove_groups(dev, class->dev_groups); 557 device_remove_groups(dev, class->dev_groups);
594 } 558 }