diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-14 16:05:58 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-16 10:57:37 -0700 |
commit | d05a6f96c76062b5f25858ac02cf677602076f7e (patch) | |
tree | 4c159b303e3e88c0a5e490f03619f2f7f7a2a859 /drivers/base/core.c | |
parent | 39ef311204941ddd01ea2950d6220c8ccc710d15 (diff) | |
download | lwn-d05a6f96c76062b5f25858ac02cf677602076f7e.tar.gz lwn-d05a6f96c76062b5f25858ac02cf677602076f7e.zip |
driver core: add default groups to struct class
We should be using groups, not attribute lists, for classes to allow
subdirectories, and soon, binary files. Groups are just more flexible
overall, so add them.
The dev_attrs list will go away after all in-kernel users are converted
to use dev_groups.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index a8aae1823f73..8856d74545d9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -528,9 +528,12 @@ static int device_add_attrs(struct device *dev) int error; if (class) { - error = device_add_attributes(dev, class->dev_attrs); + error = device_add_groups(dev, class->dev_groups); if (error) return error; + error = device_add_attributes(dev, class->dev_attrs); + if (error) + goto err_remove_class_groups; error = device_add_bin_attributes(dev, class->dev_bin_attrs); if (error) goto err_remove_class_attrs; @@ -563,6 +566,9 @@ static int device_add_attrs(struct device *dev) err_remove_class_attrs: if (class) device_remove_attributes(dev, class->dev_attrs); + err_remove_class_groups: + if (class) + device_remove_groups(dev, class->dev_groups); return error; } @@ -581,6 +587,7 @@ static void device_remove_attrs(struct device *dev) if (class) { device_remove_attributes(dev, class->dev_attrs); device_remove_bin_attributes(dev, class->dev_bin_attrs); + device_remove_groups(dev, class->dev_groups); } } |