aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/base.h5
-rw-r--r--drivers/base/bus.c5
-rw-r--r--drivers/base/driver.c8
-rw-r--r--include/linux/device.h4
4 files changed, 17 insertions, 5 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index fccf954f82fd..2cbc6774f4cd 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -119,6 +119,11 @@ static inline int driver_match_device(struct device_driver *drv,
119 return drv->bus->match ? drv->bus->match(dev, drv) : 1; 119 return drv->bus->match ? drv->bus->match(dev, drv) : 1;
120} 120}
121 121
122extern int driver_add_groups(struct device_driver *drv,
123 const struct attribute_group **groups);
124extern void driver_remove_groups(struct device_driver *drv,
125 const struct attribute_group **groups);
126
122extern int device_add_groups(struct device *dev, 127extern int device_add_groups(struct device *dev,
123 const struct attribute_group **groups); 128 const struct attribute_group **groups);
124extern void device_remove_groups(struct device *dev, 129extern void device_remove_groups(struct device *dev,
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 7b2dc5ba7d79..de5ce22df306 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -725,6 +725,10 @@ int bus_add_driver(struct device_driver *drv)
725 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", 725 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
726 __func__, drv->name); 726 __func__, drv->name);
727 } 727 }
728 error = driver_add_groups(drv, bus->drv_groups);
729 if (error)
730 printk(KERN_ERR "%s: driver_create_groups(%s) failed\n",
731 __func__, drv->name);
728 732
729 if (!drv->suppress_bind_attrs) { 733 if (!drv->suppress_bind_attrs) {
730 error = add_bind_files(drv); 734 error = add_bind_files(drv);
@@ -762,6 +766,7 @@ void bus_remove_driver(struct device_driver *drv)
762 if (!drv->suppress_bind_attrs) 766 if (!drv->suppress_bind_attrs)
763 remove_bind_files(drv); 767 remove_bind_files(drv);
764 driver_remove_attrs(drv->bus, drv); 768 driver_remove_attrs(drv->bus, drv);
769 driver_remove_groups(drv, drv->bus->drv_groups);
765 driver_remove_file(drv, &driver_attr_uevent); 770 driver_remove_file(drv, &driver_attr_uevent);
766 klist_remove(&drv->p->knode_bus); 771 klist_remove(&drv->p->knode_bus);
767 pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name); 772 pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 974e301a1ef0..89db726ebb98 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -123,8 +123,8 @@ void driver_remove_file(struct device_driver *drv,
123} 123}
124EXPORT_SYMBOL_GPL(driver_remove_file); 124EXPORT_SYMBOL_GPL(driver_remove_file);
125 125
126static int driver_add_groups(struct device_driver *drv, 126int driver_add_groups(struct device_driver *drv,
127 const struct attribute_group **groups) 127 const struct attribute_group **groups)
128{ 128{
129 int error = 0; 129 int error = 0;
130 int i; 130 int i;
@@ -143,8 +143,8 @@ static int driver_add_groups(struct device_driver *drv,
143 return error; 143 return error;
144} 144}
145 145
146static void driver_remove_groups(struct device_driver *drv, 146void driver_remove_groups(struct device_driver *drv,
147 const struct attribute_group **groups) 147 const struct attribute_group **groups)
148{ 148{
149 int i; 149 int i;
150 150
diff --git a/include/linux/device.h b/include/linux/device.h
index 3aec4a68b1d4..94d987f128bb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -67,6 +67,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
67 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @drv_attrs: Default attributes of the device drivers on the bus. 68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @dev_groups: Default attributes of the devices on the bus. 69 * @dev_groups: Default attributes of the devices on the bus.
70 * @drv_groups: Default attributes of the device drivers on the bus.
70 * @match: Called, perhaps multiple times, whenever a new device or driver 71 * @match: Called, perhaps multiple times, whenever a new device or driver
71 * is added for this bus. It should return a nonzero value if the 72 * is added for this bus. It should return a nonzero value if the
72 * given device can be handled by the given driver. 73 * given device can be handled by the given driver.
@@ -106,8 +107,9 @@ struct bus_type {
106 struct device *dev_root; 107 struct device *dev_root;
107 struct bus_attribute *bus_attrs; 108 struct bus_attribute *bus_attrs;
108 struct device_attribute *dev_attrs; /* use dev_groups instead */ 109 struct device_attribute *dev_attrs; /* use dev_groups instead */
109 struct driver_attribute *drv_attrs; 110 struct driver_attribute *drv_attrs; /* use drv_groups instead */
110 const struct attribute_group **dev_groups; 111 const struct attribute_group **dev_groups;
112 const struct attribute_group **drv_groups;
111 113
112 int (*match)(struct device *dev, struct device_driver *drv); 114 int (*match)(struct device *dev, struct device_driver *drv);
113 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 115 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);