]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
driver-core: remove struct bus_type.drv_attrs
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 28 Sep 2013 04:47:21 +0000 (21:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 28 Sep 2013 17:18:20 +0000 (10:18 -0700)
Now that all in-kernel users of bus_type.drv_attrs have been converted
to use drv_groups instead, the drv_attrs field, and logic surrounding
it, can be removed.

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

index 2cdf29464063d0f77ad4cc6cbde9afb3d57e4f28..73f6c2925281f43ab752e0a374c059133e2f61ef 100644 (file)
@@ -591,37 +591,6 @@ void bus_remove_device(struct device *dev)
        bus_put(dev->bus);
 }
 
-static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv)
-{
-       int error = 0;
-       int i;
-
-       if (bus->drv_attrs) {
-               for (i = 0; bus->drv_attrs[i].attr.name; i++) {
-                       error = driver_create_file(drv, &bus->drv_attrs[i]);
-                       if (error)
-                               goto err;
-               }
-       }
-done:
-       return error;
-err:
-       while (--i >= 0)
-               driver_remove_file(drv, &bus->drv_attrs[i]);
-       goto done;
-}
-
-static void driver_remove_attrs(struct bus_type *bus,
-                               struct device_driver *drv)
-{
-       int i;
-
-       if (bus->drv_attrs) {
-               for (i = 0; bus->drv_attrs[i].attr.name; i++)
-                       driver_remove_file(drv, &bus->drv_attrs[i]);
-       }
-}
-
 static int __must_check add_bind_files(struct device_driver *drv)
 {
        int ret;
@@ -720,16 +689,12 @@ int bus_add_driver(struct device_driver *drv)
                printk(KERN_ERR "%s: uevent attr (%s) failed\n",
                        __func__, drv->name);
        }
-       error = driver_add_attrs(bus, drv);
+       error = driver_add_groups(drv, bus->drv_groups);
        if (error) {
                /* How the hell do we get out of this pickle? Give up */
-               printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
-                       __func__, drv->name);
-       }
-       error = driver_add_groups(drv, bus->drv_groups);
-       if (error)
                printk(KERN_ERR "%s: driver_create_groups(%s) failed\n",
                        __func__, drv->name);
+       }
 
        if (!drv->suppress_bind_attrs) {
                error = add_bind_files(drv);
@@ -766,7 +731,6 @@ void bus_remove_driver(struct device_driver *drv)
 
        if (!drv->suppress_bind_attrs)
                remove_bind_files(drv);
-       driver_remove_attrs(drv->bus, drv);
        driver_remove_groups(drv, drv->bus->drv_groups);
        driver_remove_file(drv, &driver_attr_uevent);
        klist_remove(&drv->p->knode_bus);
index 89a852e0896d11d5fe659b8573aa8e31429fb8c2..e7f5b858538012280c37ca0532cde869c1460631 100644 (file)
@@ -64,7 +64,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
  * @dev_name:  Used for subsystems to enumerate devices like ("foo%u", dev->id).
  * @dev_root:  Default device to use as the parent.
  * @dev_attrs: Default attributes of the devices on the bus.
- * @drv_attrs: Default attributes of the device drivers on the bus.
  * @bus_groups:        Default attributes of the bus.
  * @dev_groups:        Default attributes of the devices on the bus.
  * @drv_groups: Default attributes of the device drivers on the bus.
@@ -106,7 +105,6 @@ struct bus_type {
        const char              *dev_name;
        struct device           *dev_root;
        struct device_attribute *dev_attrs;     /* use dev_groups instead */
-       struct driver_attribute *drv_attrs;     /* use drv_groups instead */
        const struct attribute_group **bus_groups;
        const struct attribute_group **dev_groups;
        const struct attribute_group **drv_groups;