aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--driver-core-remove-dev_attrs-from-struct-class.patch52
1 files changed, 51 insertions, 1 deletions
diff --git a/driver-core-remove-dev_attrs-from-struct-class.patch b/driver-core-remove-dev_attrs-from-struct-class.patch
index bea741a07f5754..5c1f58be3df8f0 100644
--- a/driver-core-remove-dev_attrs-from-struct-class.patch
+++ b/driver-core-remove-dev_attrs-from-struct-class.patch
@@ -10,8 +10,9 @@ dev_groups, we can safely remove dev_attrs from struct class.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/core.c | 38 +-------------------------------------
+ drivers/pwm/sysfs.c | 21 ++++++++++++---------
include/linux/device.h | 2 --
- 2 files changed, 1 insertion(+), 39 deletions(-)
+ 3 files changed, 13 insertions(+), 48 deletions(-)
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -83,6 +84,55 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
device_remove_bin_attributes(dev, class->dev_bin_attrs);
device_remove_groups(dev, class->dev_groups);
}
+--- a/drivers/pwm/sysfs.c
++++ b/drivers/pwm/sysfs.c
+@@ -268,6 +268,7 @@ static ssize_t pwm_export_store(struct d
+
+ return ret ? : len;
+ }
++static DEVICE_ATTR(export, 0200, NULL, pwm_export_store);
+
+ static ssize_t pwm_unexport_store(struct device *parent,
+ struct device_attribute *attr,
+@@ -288,27 +289,29 @@ static ssize_t pwm_unexport_store(struct
+
+ return ret ? : len;
+ }
++static DEVICE_ATTR(unexport, 0200, NULL, pwm_unexport_store);
+
+-static ssize_t pwm_npwm_show(struct device *parent,
+- struct device_attribute *attr,
+- char *buf)
++static ssize_t npwm_show(struct device *parent, struct device_attribute *attr,
++ char *buf)
+ {
+ const struct pwm_chip *chip = dev_get_drvdata(parent);
+
+ return sprintf(buf, "%u\n", chip->npwm);
+ }
++static DEVICE_ATTR_RO(npwm);
+
+-static struct device_attribute pwm_chip_attrs[] = {
+- __ATTR(export, 0200, NULL, pwm_export_store),
+- __ATTR(unexport, 0200, NULL, pwm_unexport_store),
+- __ATTR(npwm, 0444, pwm_npwm_show, NULL),
+- __ATTR_NULL,
++static struct attribute *pwm_chip_attrs[] = {
++ &dev_attr_export.attr,
++ &dev_attr_unexport.attr,
++ &dev_attr_npwm.attr,
++ NULL,
+ };
++ATTRIBUTE_GROUPS(pwm_chip);
+
+ static struct class pwm_class = {
+ .name = "pwm",
+ .owner = THIS_MODULE,
+- .dev_attrs = pwm_chip_attrs,
++ .dev_groups = pwm_chip_groups,
+ };
+
+ static int pwmchip_sysfs_match(struct device *parent, const void *data)
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -321,7 +321,6 @@ int subsys_virtual_register(struct bus_t