aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r--drivers/base/driver.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 89db726ebb98..c7efccb6f3bb 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -126,31 +126,13 @@ EXPORT_SYMBOL_GPL(driver_remove_file);
126int 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 return sysfs_create_groups(&drv->p->kobj, groups);
130 int i;
131
132 if (groups) {
133 for (i = 0; groups[i]; i++) {
134 error = sysfs_create_group(&drv->p->kobj, groups[i]);
135 if (error) {
136 while (--i >= 0)
137 sysfs_remove_group(&drv->p->kobj,
138 groups[i]);
139 break;
140 }
141 }
142 }
143 return error;
144} 130}
145 131
146void driver_remove_groups(struct device_driver *drv, 132void driver_remove_groups(struct device_driver *drv,
147 const struct attribute_group **groups) 133 const struct attribute_group **groups)
148{ 134{
149 int i; 135 sysfs_remove_groups(&drv->p->kobj, groups);
150
151 if (groups)
152 for (i = 0; groups[i]; i++)
153 sysfs_remove_group(&drv->p->kobj, groups[i]);
154} 136}
155 137
156/** 138/**