aboutsummaryrefslogtreecommitdiffstats
path: root/enclosure-convert-class-code-to-use-dev_groups.patch
diff options
Diffstat (limited to 'enclosure-convert-class-code-to-use-dev_groups.patch')
-rw-r--r--enclosure-convert-class-code-to-use-dev_groups.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/enclosure-convert-class-code-to-use-dev_groups.patch b/enclosure-convert-class-code-to-use-dev_groups.patch
new file mode 100644
index 00000000000000..ac3d0fd0d1e22f
--- /dev/null
+++ b/enclosure-convert-class-code-to-use-dev_groups.patch
@@ -0,0 +1,88 @@
+From foo@baz Tue Jul 9 15:11:14 PDT 2013
+Date: Tue, 09 Jul 2013 15:11:14 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: enclosure: convert class code to use dev_groups
+
+The dev_attrs field of struct class is going away soon, dev_groups
+should be used instead. This converts the enclosure class code to use
+the correct field.
+
+Cc: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/enclosure.c | 29 +++++++++++------------------
+ 1 file changed, 11 insertions(+), 18 deletions(-)
+
+--- a/drivers/misc/enclosure.c
++++ b/drivers/misc/enclosure.c
+@@ -239,7 +239,7 @@ static void enclosure_component_release(
+ put_device(dev->parent);
+ }
+
+-static const struct attribute_group *enclosure_groups[];
++static const struct attribute_group *enclosure_component_groups[];
+
+ /**
+ * enclosure_component_register - add a particular component to an enclosure
+@@ -282,7 +282,7 @@ enclosure_component_register(struct encl
+ dev_set_name(cdev, "%u", number);
+
+ cdev->release = enclosure_component_release;
+- cdev->groups = enclosure_groups;
++ cdev->groups = enclosure_component_groups;
+
+ err = device_register(cdev);
+ if (err) {
+@@ -365,25 +365,26 @@ EXPORT_SYMBOL_GPL(enclosure_remove_devic
+ * sysfs pieces below
+ */
+
+-static ssize_t enclosure_show_components(struct device *cdev,
+- struct device_attribute *attr,
+- char *buf)
++static ssize_t components_show(struct device *cdev,
++ struct device_attribute *attr, char *buf)
+ {
+ struct enclosure_device *edev = to_enclosure_device(cdev);
+
+ return snprintf(buf, 40, "%d\n", edev->components);
+ }
++static DEVICE_ATTR_RO(components);
+
+-static struct device_attribute enclosure_attrs[] = {
+- __ATTR(components, S_IRUGO, enclosure_show_components, NULL),
+- __ATTR_NULL
++static struct attribute *enclosure_class_attrs[] = {
++ &dev_attr_components.attr,
++ NULL,
+ };
++ATTRIBUTE_GROUPS(enclosure_class);
+
+ static struct class enclosure_class = {
+ .name = "enclosure",
+ .owner = THIS_MODULE,
+ .dev_release = enclosure_release,
+- .dev_attrs = enclosure_attrs,
++ .dev_groups = enclosure_class_groups,
+ };
+
+ static const char *const enclosure_status [] = {
+@@ -536,15 +537,7 @@ static struct attribute *enclosure_compo
+ &dev_attr_type.attr,
+ NULL
+ };
+-
+-static struct attribute_group enclosure_group = {
+- .attrs = enclosure_component_attrs,
+-};
+-
+-static const struct attribute_group *enclosure_groups[] = {
+- &enclosure_group,
+- NULL
+-};
++ATTRIBUTE_GROUPS(enclosure_component);
+
+ static int __init enclosure_init(void)
+ {