driver core: remove dev_bin_attrs from struct class
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Oct 2013 01:19:30 +0000 (18:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Oct 2013 07:01:47 +0000 (00:01 -0700)
No in-kernel code is now using this, they have all be converted over to
using the bin_attrs support in attribute groups, so this field, and the
code in the driver core that was creating/remove the binary files can be
removed.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c
include/linux/device.h

index f67e86687ae215e8242d76923e611a758cd6135d..bf35c557707f58921523ae65c058b6de35a98b29 100644 (file)
@@ -455,35 +455,6 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RW(online);
 
-static int device_add_bin_attributes(struct device *dev,
-                                    struct bin_attribute *attrs)
-{
-       int error = 0;
-       int i;
-
-       if (attrs) {
-               for (i = 0; attrs[i].attr.name; i++) {
-                       error = device_create_bin_file(dev, &attrs[i]);
-                       if (error)
-                               break;
-               }
-               if (error)
-                       while (--i >= 0)
-                               device_remove_bin_file(dev, &attrs[i]);
-       }
-       return error;
-}
-
-static void device_remove_bin_attributes(struct device *dev,
-                                        struct bin_attribute *attrs)
-{
-       int i;
-
-       if (attrs)
-               for (i = 0; attrs[i].attr.name; i++)
-                       device_remove_bin_file(dev, &attrs[i]);
-}
-
 int device_add_groups(struct device *dev, const struct attribute_group **groups)
 {
        return sysfs_create_groups(&dev->kobj, groups);
@@ -505,15 +476,12 @@ static int device_add_attrs(struct device *dev)
                error = device_add_groups(dev, class->dev_groups);
                if (error)
                        return error;
-               error = device_add_bin_attributes(dev, class->dev_bin_attrs);
-               if (error)
-                       goto err_remove_class_groups;
        }
 
        if (type) {
                error = device_add_groups(dev, type->groups);
                if (error)
-                       goto err_remove_class_bin_attrs;
+                       goto err_remove_class_groups;
        }
 
        error = device_add_groups(dev, dev->groups);
@@ -531,9 +499,6 @@ static int device_add_attrs(struct device *dev)
  err_remove_type_groups:
        if (type)
                device_remove_groups(dev, type->groups);
- err_remove_class_bin_attrs:
-       if (class)
-               device_remove_bin_attributes(dev, class->dev_bin_attrs);
  err_remove_class_groups:
        if (class)
                device_remove_groups(dev, class->dev_groups);
@@ -552,10 +517,8 @@ static void device_remove_attrs(struct device *dev)
        if (type)
                device_remove_groups(dev, type->groups);
 
-       if (class) {
-               device_remove_bin_attributes(dev, class->dev_bin_attrs);
+       if (class)
                device_remove_groups(dev, class->dev_groups);
-       }
 }
 
 static ssize_t dev_show(struct device *dev, struct device_attribute *attr,
index 9ffe8561df7536bf779210f509a421607e8e7aef..94638efa0bf8a7d803684de955e8a855ee471ed8 100644 (file)
@@ -325,7 +325,6 @@ int subsys_virtual_register(struct bus_type *subsys,
  * @owner:     The module owner.
  * @class_attrs: Default attributes of this class.
  * @dev_groups:        Default attributes of the devices that belong to the class.
- * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
  * @dev_kobj:  The kobject that represents this class and links it into the hierarchy.
  * @dev_uevent:        Called when a device is added, removed from this class, or a
  *             few other things that generate uevents to add the environment
@@ -354,7 +353,6 @@ struct class {
 
        struct class_attribute          *class_attrs;
        const struct attribute_group    **dev_groups;
-       struct bin_attribute            *dev_bin_attrs;
        struct kobject                  *dev_kobj;
 
        int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);