diff options
| -rw-r--r-- | d1.patch | 1299 | ||||
| -rw-r--r-- | driver-core-add-default-groups-to-struct-class.patch | 65 | ||||
| -rw-r--r-- | driver-core-remove-dev_attrs-from-struct-class.patch | 104 | ||||
| -rw-r--r-- | series | 2 |
4 files changed, 1151 insertions, 319 deletions
diff --git a/d1.patch b/d1.patch index 2cc1d2ba2d6a4f..31a54208149752 100644 --- a/d1.patch +++ b/d1.patch @@ -3,100 +3,255 @@ Subject: meta-patch of all of the dev_attr conversions --- - drivers/base/core.c | 19 ++++--- - drivers/dma/dmaengine.c | 16 +++-- - drivers/leds/led-class.c | 34 ++++++++++-- - drivers/misc/c2port/core.c | 41 +++++++++------ - drivers/pci/pci-sysfs.c | 26 +++++++-- + drivers/devfreq/devfreq.c | 76 ++++++++++------- + drivers/dma/dmaengine.c | 26 +++--- + drivers/leds/led-class.c | 38 +++++++- + drivers/misc/c2port/core.c | 50 ++++++----- + drivers/pci/pci-sysfs.c | 32 ++++--- drivers/pci/pci.h | 2 drivers/pci/probe.c | 2 drivers/pps/pps.c | 2 - drivers/pps/sysfs.c | 31 ++++++++--- + drivers/pps/sysfs.c | 55 ++++++++----- drivers/ptp/ptp_clock.c | 2 drivers/ptp/ptp_private.h | 2 - drivers/ptp/ptp_sysfs.c | 51 ++++++++++-------- - drivers/rtc/rtc-sysfs.c | 27 ++++++---- - drivers/scsi/sd.c | 94 +++++++++++++++++++---------------- - drivers/staging/comedi/comedi_fops.c | 27 +++++----- - drivers/uio/uio.c | 16 +++-- - drivers/video/backlight/backlight.c | 26 +++++---- - drivers/video/output.c | 20 +++---- - include/linux/device.h | 3 - + drivers/ptp/ptp_sysfs.c | 51 ++++++------ + drivers/rtc/rtc-sysfs.c | 46 +++++----- + drivers/scsi/sd.c | 148 +++++++++++++++++------------------ + drivers/staging/comedi/comedi_fops.c | 39 ++++----- + drivers/uio/uio.c | 22 +++-- + drivers/video/backlight/backlight.c | 44 +++++----- + drivers/video/backlight/lcd.c | 1 + drivers/video/output.c | 20 ++-- + fs/fuse/cuse.c | 13 +-- include/linux/pps_kernel.h | 2 - mm/backing-dev.c | 22 +++++--- - net/core/net-sysfs.c | 94 ++++++++++++++++++++--------------- - net/rfkill/core.c | 38 +++++++------- - 23 files changed, 365 insertions(+), 232 deletions(-) + mm/backing-dev.c | 19 ++-- + net/core/net-sysfs.c | 134 +++++++++++++++++-------------- + net/rfkill/core.c | 88 +++++++++----------- + 24 files changed, 508 insertions(+), 406 deletions(-) ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -528,12 +528,15 @@ static int device_add_attrs(struct devic - int error; - - if (class) { -- error = device_add_attributes(dev, class->dev_attrs); -+// error = device_add_attributes(dev, class->dev_attrs); -+// if (error) -+// return error; -+ error = device_add_groups(dev, class->dev_groups); - if (error) -- return error; -+ goto err_remove_class_attrs; - error = device_add_bin_attributes(dev, class->dev_bin_attrs); - if (error) -- goto err_remove_class_attrs; -+ goto err_remove_class_groups; - } +--- a/drivers/devfreq/devfreq.c ++++ b/drivers/devfreq/devfreq.c +@@ -703,7 +703,7 @@ err_out: + } + EXPORT_SYMBOL(devfreq_remove_governor); + +-static ssize_t show_governor(struct device *dev, ++static ssize_t governor_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + if (!to_devfreq(dev)->governor) +@@ -712,7 +712,7 @@ static ssize_t show_governor(struct devi + return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name); + } - if (type) { -@@ -566,9 +569,12 @@ static int device_add_attrs(struct devic - err_remove_class_bin_attrs: - if (class) - device_remove_bin_attributes(dev, class->dev_bin_attrs); -+ err_remove_class_groups: -+ if (class) -+ device_remove_groups(dev, class->dev_groups); - err_remove_class_attrs: -- if (class) -- device_remove_attributes(dev, class->dev_attrs); -+// if (class) -+// device_remove_attributes(dev, class->dev_attrs); - - return error; - } -@@ -586,7 +592,8 @@ static void device_remove_attrs(struct d - device_remove_groups(dev, type->groups); - - if (class) { -- device_remove_attributes(dev, class->dev_attrs); -+ device_remove_groups(dev, class->dev_groups); -+// device_remove_attributes(dev, class->dev_attrs); - device_remove_bin_attributes(dev, class->dev_bin_attrs); +-static ssize_t store_governor(struct device *dev, struct device_attribute *attr, ++static ssize_t governor_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { + struct devfreq *df = to_devfreq(dev); +@@ -754,9 +754,11 @@ out: + ret = count; + return ret; + } +-static ssize_t show_available_governors(struct device *d, +- struct device_attribute *attr, +- char *buf) ++static DEVICE_ATTR_RW(governor); ++ ++static ssize_t available_governors_show(struct device *d, ++ struct device_attribute *attr, ++ char *buf) + { + struct devfreq_governor *tmp_governor; + ssize_t count = 0; +@@ -775,9 +777,10 @@ static ssize_t show_available_governors( + + return count; + } ++static DEVICE_ATTR_RO(available_governors); + +-static ssize_t show_freq(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + unsigned long freq; + struct devfreq *devfreq = to_devfreq(dev); +@@ -788,20 +791,22 @@ static ssize_t show_freq(struct device * + + return sprintf(buf, "%lu\n", devfreq->previous_freq); + } ++static DEVICE_ATTR_RO(cur_freq); + +-static ssize_t show_target_freq(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t target_freq_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq); + } ++static DEVICE_ATTR_RO(target_freq); + +-static ssize_t show_polling_interval(struct device *dev, ++static ssize_t polling_interval_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%d\n", to_devfreq(dev)->profile->polling_ms); + } + +-static ssize_t store_polling_interval(struct device *dev, ++static ssize_t polling_interval_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -821,8 +826,9 @@ static ssize_t store_polling_interval(st + + return ret; + } ++static DEVICE_ATTR_RW(polling_interval); + +-static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { + struct devfreq *df = to_devfreq(dev); +@@ -849,13 +855,13 @@ unlock: + return ret; + } + +-static ssize_t show_min_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq); + } + +-static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { + struct devfreq *df = to_devfreq(dev); +@@ -881,16 +887,18 @@ unlock: + mutex_unlock(&df->lock); + return ret; + } ++static DEVICE_ATTR_RW(min_freq); + +-static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); + } ++static DEVICE_ATTR_RW(max_freq); + +-static ssize_t show_available_freqs(struct device *d, +- struct device_attribute *attr, +- char *buf) ++static ssize_t available_frequencies_show(struct device *d, ++ struct device_attribute *attr, ++ char *buf) + { + struct devfreq *df = to_devfreq(d); + struct device *dev = df->dev.parent; +@@ -918,9 +926,10 @@ static ssize_t show_available_freqs(stru + + return count; + } ++static DEVICE_ATTR_RO(available_frequencies); + +-static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr, +- char *buf) ++static ssize_t trans_stat_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct devfreq *devfreq = to_devfreq(dev); + ssize_t len; +@@ -959,20 +968,21 @@ static ssize_t show_trans_table(struct d + devfreq->total_trans); + return len; + } ++static DEVICE_ATTR_RO(trans_stat); + +-static struct device_attribute devfreq_attrs[] = { +- __ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), +- __ATTR(available_governors, S_IRUGO, show_available_governors, NULL), +- __ATTR(cur_freq, S_IRUGO, show_freq, NULL), +- __ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL), +- __ATTR(target_freq, S_IRUGO, show_target_freq, NULL), +- __ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval, +- store_polling_interval), +- __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), +- __ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), +- __ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), +- { }, ++static struct attribute *devfreq_attrs[] = { ++ &dev_attr_governor.attr, ++ &dev_attr_available_governors.attr, ++ &dev_attr_cur_freq.attr, ++ &dev_attr_available_frequencies.attr, ++ &dev_attr_target_freq.attr, ++ &dev_attr_polling_interval.attr, ++ &dev_attr_min_freq.attr, ++ &dev_attr_max_freq.attr, ++ &dev_attr_trans_stat.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(devfreq); + + static int __init devfreq_init(void) + { +@@ -988,7 +998,7 @@ static int __init devfreq_init(void) + pr_err("%s: couldn't create workqueue\n", __FILE__); + return PTR_ERR(devfreq_wq); } +- devfreq_class->dev_attrs = devfreq_attrs; ++ devfreq_class->dev_groups = devfreq_groups; + + return 0; } --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c -@@ -106,6 +106,7 @@ static ssize_t show_memcpy_count(struct +@@ -87,7 +87,8 @@ static struct dma_chan *dev_to_dma_chan( + return chan_dev->chan; + } + +-static ssize_t show_memcpy_count(struct device *dev, struct device_attribute *attr, char *buf) ++static ssize_t memcpy_count_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct dma_chan *chan; + unsigned long count = 0; +@@ -106,9 +107,10 @@ static ssize_t show_memcpy_count(struct return err; } -+static DEVICE_ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL); ++static DEVICE_ATTR_RO(memcpy_count); - static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr, - char *buf) -@@ -127,6 +128,7 @@ static ssize_t show_bytes_transferred(st +-static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr, +- char *buf) ++static ssize_t bytes_transferred_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct dma_chan *chan; + unsigned long count = 0; +@@ -127,8 +129,10 @@ static ssize_t show_bytes_transferred(st return err; } -+static DEVICE_ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL); ++static DEVICE_ATTR_RO(bytes_transferred); - static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf) +-static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf) ++static ssize_t in_use_show(struct device *dev, struct device_attribute *attr, ++ char *buf) { -@@ -143,13 +145,15 @@ static ssize_t show_in_use(struct device + struct dma_chan *chan; + int err; +@@ -143,13 +147,15 @@ static ssize_t show_in_use(struct device return err; } -+static DEVICE_ATTR(in_use, S_IRUGO, show_in_use, NULL); ++static DEVICE_ATTR_RO(in_use); -static struct device_attribute dma_attrs[] = { - __ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL), @@ -113,7 +268,7 @@ Subject: meta-patch of all of the dev_attr conversions static void chan_dev_release(struct device *dev) { -@@ -167,7 +171,7 @@ static void chan_dev_release(struct devi +@@ -167,7 +173,7 @@ static void chan_dev_release(struct devi static struct class dma_devclass = { .name = "dma", @@ -124,11 +279,29 @@ Subject: meta-patch of all of the dev_attr conversions --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c +@@ -29,7 +29,7 @@ static void led_update_brightness(struct + led_cdev->brightness = led_cdev->brightness_get(led_cdev); + } + +-static ssize_t led_brightness_show(struct device *dev, ++static ssize_t brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct led_classdev *led_cdev = dev_get_drvdata(dev); +@@ -40,7 +40,7 @@ static ssize_t led_brightness_show(struc + return sprintf(buf, "%u\n", led_cdev->brightness); + } + +-static ssize_t led_brightness_store(struct device *dev, ++static ssize_t brightness_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) + { + struct led_classdev *led_cdev = dev_get_drvdata(dev); @@ -57,6 +57,7 @@ static ssize_t led_brightness_store(stru return size; } -+static DEVICE_ATTR(brightness, 0644, led_brightness_show, led_brightness_store); ++static DEVICE_ATTR_RW(brightness); static ssize_t led_max_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -208,23 +381,39 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t c2port_show_flash_size(struct device *dev, struct device_attribute *attr, char *buf) -@@ -338,6 +341,7 @@ static ssize_t c2port_show_flash_size(st +@@ -338,18 +341,18 @@ static ssize_t c2port_show_flash_size(st return sprintf(buf, "%d\n", ops->blocks_num * ops->block_size); } +static DEVICE_ATTR(flash_size, 0444, c2port_show_flash_size, NULL); - static ssize_t c2port_show_access(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -375,6 +379,7 @@ static ssize_t c2port_store_access(struc +-static ssize_t c2port_show_access(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t access_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct c2port_device *c2dev = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", c2dev->access); + } + +-static ssize_t c2port_store_access(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t access_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct c2port_device *c2dev = dev_get_drvdata(dev); + struct c2port_ops *ops = c2dev->ops; +@@ -375,6 +378,7 @@ static ssize_t c2port_store_access(struc return count; } -+static DEVICE_ATTR(access, 0644, c2port_show_access, c2port_store_access); ++static DEVICE_ATTR_RW(access); static ssize_t c2port_store_reset(struct device *dev, struct device_attribute *attr, -@@ -395,6 +400,7 @@ static ssize_t c2port_store_reset(struct +@@ -395,6 +399,7 @@ static ssize_t c2port_store_reset(struct return count; } @@ -232,7 +421,7 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t __c2port_show_dev_id(struct c2port_device *dev, char *buf) { -@@ -431,6 +437,7 @@ static ssize_t c2port_show_dev_id(struct +@@ -431,6 +436,7 @@ static ssize_t c2port_show_dev_id(struct return ret; } @@ -240,7 +429,7 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t __c2port_show_rev_id(struct c2port_device *dev, char *buf) { -@@ -467,6 +474,7 @@ static ssize_t c2port_show_rev_id(struct +@@ -467,6 +473,7 @@ static ssize_t c2port_show_rev_id(struct return ret; } @@ -248,7 +437,7 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t c2port_show_flash_access(struct device *dev, struct device_attribute *attr, char *buf) -@@ -536,6 +544,8 @@ static ssize_t c2port_store_flash_access +@@ -536,6 +543,8 @@ static ssize_t c2port_store_flash_access return count; } @@ -257,7 +446,7 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t __c2port_write_flash_erase(struct c2port_device *dev) { -@@ -616,6 +626,7 @@ static ssize_t c2port_store_flash_erase( +@@ -616,6 +625,7 @@ static ssize_t c2port_store_flash_erase( return count; } @@ -265,7 +454,7 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t __c2port_read_flash_data(struct c2port_device *dev, char *buffer, loff_t offset, size_t count) -@@ -850,22 +861,20 @@ static ssize_t c2port_write_flash_data(s +@@ -850,22 +860,20 @@ static ssize_t c2port_write_flash_data(s /* * Class attributes */ @@ -301,7 +490,7 @@ Subject: meta-patch of all of the dev_attr conversions static struct bin_attribute c2port_bin_attrs[] = { { -@@ -979,7 +988,7 @@ static int __init c2port_init(void) +@@ -979,7 +987,7 @@ static int __init c2port_init(void) printk(KERN_ERR "c2port: failed to allocate class\n"); return PTR_ERR(c2port_class); } @@ -312,31 +501,33 @@ Subject: meta-patch of all of the dev_attr conversions return 0; --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c -@@ -131,19 +131,21 @@ static ssize_t pci_bus_show_cpuaffinity( +@@ -131,19 +131,19 @@ static ssize_t pci_bus_show_cpuaffinity( return ret; } -static inline ssize_t pci_bus_show_cpumaskaffinity(struct device *dev, -+static ssize_t pci_bus_show_cpumaskaffinity(struct device *dev, - struct device_attribute *attr, - char *buf) +- struct device_attribute *attr, +- char *buf) ++static ssize_t cpuaffinity_show(struct device *dev, ++ struct device_attribute *attr, char *buf) { return pci_bus_show_cpuaffinity(dev, 0, attr, buf); } -+static DEVICE_ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpumaskaffinity, NULL); ++static DEVICE_ATTR_RO(cpuaffinity); -static inline ssize_t pci_bus_show_cpulistaffinity(struct device *dev, -+static ssize_t pci_bus_show_cpulistaffinity(struct device *dev, - struct device_attribute *attr, - char *buf) +- struct device_attribute *attr, +- char *buf) ++static ssize_t cpulistaffinity_show(struct device *dev, ++ struct device_attribute *attr, char *buf) { return pci_bus_show_cpuaffinity(dev, 1, attr, buf); } -+static DEVICE_ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL); ++static DEVICE_ATTR_RO(cpulistaffinity); /* show resources */ static ssize_t -@@ -379,6 +381,7 @@ dev_bus_rescan_store(struct device *dev, +@@ -379,6 +379,7 @@ dev_bus_rescan_store(struct device *dev, } return count; } @@ -344,7 +535,7 @@ Subject: meta-patch of all of the dev_attr conversions #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) static ssize_t d3cold_allowed_store(struct device *dev, -@@ -514,11 +517,20 @@ struct device_attribute pci_dev_attrs[] +@@ -514,11 +515,20 @@ struct device_attribute pci_dev_attrs[] __ATTR_NULL, }; @@ -405,51 +596,79 @@ Subject: meta-patch of all of the dev_attr conversions if (err < 0) { --- a/drivers/pps/sysfs.c +++ b/drivers/pps/sysfs.c -@@ -41,6 +41,7 @@ static ssize_t pps_show_assert(struct de +@@ -29,8 +29,8 @@ + * Attribute functions + */ + +-static ssize_t pps_show_assert(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t assert_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + +@@ -41,9 +41,10 @@ static ssize_t pps_show_assert(struct de (long long) pps->assert_tu.sec, pps->assert_tu.nsec, pps->assert_sequence); } -+static DEVICE_ATTR(assert, S_IRUGO, pps_show_assert, NULL); ++static DEVICE_ATTR_RO(assert); - static ssize_t pps_show_clear(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -54,6 +55,7 @@ static ssize_t pps_show_clear(struct dev +-static ssize_t pps_show_clear(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t clear_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + +@@ -54,45 +55,59 @@ static ssize_t pps_show_clear(struct dev (long long) pps->clear_tu.sec, pps->clear_tu.nsec, pps->clear_sequence); } -+static DEVICE_ATTR(clear, S_IRUGO, pps_show_clear, NULL); ++static DEVICE_ATTR_RO(clear); - static ssize_t pps_show_mode(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -62,6 +64,7 @@ static ssize_t pps_show_mode(struct devi +-static ssize_t pps_show_mode(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t mode_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); return sprintf(buf, "%4x\n", pps->info.mode); } -+static DEVICE_ATTR(mode, S_IRUGO, pps_show_mode, NULL); ++static DEVICE_ATTR_RO(mode); - static ssize_t pps_show_echo(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -70,6 +73,7 @@ static ssize_t pps_show_echo(struct devi +-static ssize_t pps_show_echo(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t echo_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); return sprintf(buf, "%d\n", !!pps->info.echo); } -+static DEVICE_ATTR(echo, S_IRUGO, pps_show_echo, NULL); ++static DEVICE_ATTR_RO(echo); - static ssize_t pps_show_name(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -78,6 +82,7 @@ static ssize_t pps_show_name(struct devi +-static ssize_t pps_show_name(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t name_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); return sprintf(buf, "%s\n", pps->info.name); } -+static DEVICE_ATTR(name, S_IRUGO, pps_show_name, NULL); ++static DEVICE_ATTR_RO(name); - static ssize_t pps_show_path(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -86,13 +91,23 @@ static ssize_t pps_show_path(struct devi +-static ssize_t pps_show_path(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t path_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); return sprintf(buf, "%s\n", pps->info.path); } -+static DEVICE_ATTR(path, S_IRUGO, pps_show_path, NULL); ++static DEVICE_ATTR_RO(path); -struct device_attribute pps_attrs[] = { - __ATTR(assert, S_IRUGO, pps_show_assert, NULL), @@ -569,52 +788,94 @@ Subject: meta-patch of all of the dev_attr conversions const char *buf, size_t count) --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c -@@ -30,6 +30,7 @@ rtc_sysfs_show_name(struct device *dev, +@@ -25,15 +25,14 @@ + */ + + static ssize_t +-rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr, +- char *buf) ++name_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%s\n", to_rtc_device(dev)->name); } -+static DEVICE_ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL); ++static DEVICE_ATTR_RO(name); static ssize_t - rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr, -@@ -46,6 +47,7 @@ rtc_sysfs_show_date(struct device *dev, +-rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr, +- char *buf) ++date_show(struct device *dev, struct device_attribute *attr, char *buf) + { + ssize_t retval; + struct rtc_time tm; +@@ -46,10 +45,10 @@ rtc_sysfs_show_date(struct device *dev, return retval; } -+static DEVICE_ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL); ++static DEVICE_ATTR_RO(date); static ssize_t - rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr, -@@ -62,6 +64,7 @@ rtc_sysfs_show_time(struct device *dev, +-rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr, +- char *buf) ++time_show(struct device *dev, struct device_attribute *attr, char *buf) + { + ssize_t retval; + struct rtc_time tm; +@@ -62,10 +61,10 @@ rtc_sysfs_show_time(struct device *dev, return retval; } -+static DEVICE_ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL); ++static DEVICE_ATTR_RO(time); static ssize_t - rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr, -@@ -79,6 +82,7 @@ rtc_sysfs_show_since_epoch(struct device +-rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr, +- char *buf) ++since_epoch_show(struct device *dev, struct device_attribute *attr, char *buf) + { + ssize_t retval; + struct rtc_time tm; +@@ -79,16 +78,16 @@ rtc_sysfs_show_since_epoch(struct device return retval; } -+static DEVICE_ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL); ++static DEVICE_ATTR_RO(since_epoch); static ssize_t - rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr, -@@ -101,6 +105,8 @@ rtc_sysfs_set_max_user_freq(struct devic +-rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr, +- char *buf) ++max_user_freq_show(struct device *dev, struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%d\n", to_rtc_device(dev)->max_user_freq); + } + + static ssize_t +-rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr, ++max_user_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t n) + { + struct rtc_device *rtc = to_rtc_device(dev); +@@ -101,6 +100,7 @@ rtc_sysfs_set_max_user_freq(struct devic return n; } -+static DEVICE_ATTR(max_user_freq, S_IRUGO | S_IWUSR, -+ rtc_sysfs_show_max_user_freq, rtc_sysfs_set_max_user_freq); ++static DEVICE_ATTR_RW(max_user_freq); /** * rtc_sysfs_show_hctosys - indicate if the given RTC set the system time -@@ -121,17 +127,18 @@ rtc_sysfs_show_hctosys(struct device *de +@@ -109,8 +109,7 @@ rtc_sysfs_set_max_user_freq(struct devic + * boot or resume event. + */ + static ssize_t +-rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr, +- char *buf) ++hctosys_show(struct device *dev, struct device_attribute *attr, char *buf) + { + #ifdef CONFIG_RTC_HCTOSYS_DEVICE + if (rtc_hctosys_ret == 0 && +@@ -121,17 +120,18 @@ rtc_sysfs_show_hctosys(struct device *de #endif return sprintf(buf, "0\n"); } -+static DEVICE_ATTR(hctosys, S_IRUGO, rtc_sysfs_show_hctosys, NULL); ++static DEVICE_ATTR_RO(hctosys); -static struct device_attribute rtc_attrs[] = { - __ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL), @@ -638,7 +899,7 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr, -@@ -261,5 +268,5 @@ void rtc_sysfs_del_device(struct rtc_dev +@@ -261,5 +261,5 @@ void rtc_sysfs_del_device(struct rtc_dev void __init rtc_sysfs_init(struct class *rtc_class) { @@ -647,12 +908,25 @@ Subject: meta-patch of all of the dev_attr conversions } --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c -@@ -199,6 +199,16 @@ sd_store_cache_type(struct device *dev, +@@ -132,8 +132,8 @@ static const char *sd_cache_types[] = { + }; + + static ssize_t +-sd_store_cache_type(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++cache_type_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + int i, ct = -1, rcd, wce, sp; + struct scsi_disk *sdkp = to_scsi_disk(dev); +@@ -199,8 +199,18 @@ sd_store_cache_type(struct device *dev, } static ssize_t -+sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr, -+ char *buf) +-sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++manage_start_stop_show(struct device *dev, struct device_attribute *attr, ++ char *buf) +{ + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; @@ -661,15 +935,16 @@ Subject: meta-patch of all of the dev_attr conversions +} + +static ssize_t - sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) ++manage_start_stop_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) { -@@ -212,6 +222,17 @@ sd_store_manage_start_stop(struct device + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -212,10 +222,20 @@ sd_store_manage_start_stop(struct device return count; } -+static DEVICE_ATTR(manage_start_stop, S_IRUGO|S_IWUSR, -+ sd_show_manage_start_stop, sd_store_manage_start_stop); ++static DEVICE_ATTR_RW(manage_start_stop); + +static ssize_t +sd_show_allow_restart(struct device *dev, struct device_attribute *attr, @@ -681,31 +956,42 @@ Subject: meta-patch of all of the dev_attr conversions +} static ssize_t - sd_store_allow_restart(struct device *dev, struct device_attribute *attr, -@@ -230,6 +251,8 @@ sd_store_allow_restart(struct device *de +-sd_store_allow_restart(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++allow_restart_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -230,47 +250,30 @@ sd_store_allow_restart(struct device *de return count; } -+static DEVICE_ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart, -+ sd_store_allow_restart); ++static DEVICE_ATTR_RW(allow_restart); static ssize_t - sd_show_cache_type(struct device *dev, struct device_attribute *attr, -@@ -240,6 +263,8 @@ sd_show_cache_type(struct device *dev, s +-sd_show_cache_type(struct device *dev, struct device_attribute *attr, +- char *buf) ++cache_type_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + int ct = sdkp->RCD + 2*sdkp->WCE; return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); } -+static DEVICE_ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, -+ sd_store_cache_type); ++static DEVICE_ATTR_RW(cache_type) static ssize_t - sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) -@@ -248,25 +273,7 @@ sd_show_fua(struct device *dev, struct d +-sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) ++FUA_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); } -- --static ssize_t ++static DEVICE_ATTR_RO(FUA); + + static ssize_t -sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr, - char *buf) -{ @@ -723,68 +1009,150 @@ Subject: meta-patch of all of the dev_attr conversions - - return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); -} -+static DEVICE_ATTR(FUA, S_IRUGO, sd_show_fua, NULL); +- +-static ssize_t +-sd_show_protection_type(struct device *dev, struct device_attribute *attr, +- char *buf) ++protection_type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -278,8 +281,8 @@ sd_show_protection_type(struct device *d + } static ssize_t - sd_show_protection_type(struct device *dev, struct device_attribute *attr, -@@ -298,6 +305,8 @@ sd_store_protection_type(struct device * +-sd_store_protection_type(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++protection_type_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + unsigned int val; +@@ -298,10 +301,11 @@ sd_store_protection_type(struct device * return count; } -+static DEVICE_ATTR(protection_type, S_IRUGO|S_IWUSR, sd_show_protection_type, -+ sd_store_protection_type); ++static DEVICE_ATTR_RW(protection_type); static ssize_t - sd_show_protection_mode(struct device *dev, struct device_attribute *attr, -@@ -320,6 +329,7 @@ sd_show_protection_mode(struct device *d +-sd_show_protection_mode(struct device *dev, struct device_attribute *attr, +- char *buf) ++protection_mode_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -320,24 +324,26 @@ sd_show_protection_mode(struct device *d return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif); } -+static DEVICE_ATTR(protection_mode, S_IRUGO, sd_show_protection_mode, NULL); ++static DEVICE_ATTR_RO(protection_mode); static ssize_t - sd_show_app_tag_own(struct device *dev, struct device_attribute *attr, -@@ -329,6 +339,7 @@ sd_show_app_tag_own(struct device *dev, +-sd_show_app_tag_own(struct device *dev, struct device_attribute *attr, +- char *buf) ++app_tag_own_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->ATO); } -+static DEVICE_ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL); ++static DEVICE_ATTR_RO(app_tag_own); static ssize_t - sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr, -@@ -338,6 +349,7 @@ sd_show_thin_provisioning(struct device +-sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr, +- char *buf) ++thin_provisioning_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->lbpme); } -+static DEVICE_ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL); ++static DEVICE_ATTR_RO(thin_provisioning); static const char *lbp_mode[] = { [SD_LBP_FULL] = "full", -@@ -385,6 +397,8 @@ sd_store_provisioning_mode(struct device +@@ -349,8 +355,8 @@ static const char *lbp_mode[] = { + }; + + static ssize_t +-sd_show_provisioning_mode(struct device *dev, struct device_attribute *attr, +- char *buf) ++provisioning_mode_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -358,8 +364,8 @@ sd_show_provisioning_mode(struct device + } + + static ssize_t +-sd_store_provisioning_mode(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++provisioning_mode_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -385,10 +391,11 @@ sd_store_provisioning_mode(struct device return count; } -+static DEVICE_ATTR(provisioning_mode, S_IRUGO|S_IWUSR, -+ sd_show_provisioning_mode, sd_store_provisioning_mode); ++static DEVICE_ATTR_RW(provisioning_mode); static ssize_t - sd_show_max_medium_access_timeouts(struct device *dev, -@@ -410,6 +424,9 @@ sd_store_max_medium_access_timeouts(stru +-sd_show_max_medium_access_timeouts(struct device *dev, +- struct device_attribute *attr, char *buf) ++max_medium_access_timeouts_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -396,9 +403,9 @@ sd_show_max_medium_access_timeouts(struc + } + + static ssize_t +-sd_store_max_medium_access_timeouts(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++max_medium_access_timeouts_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, ++ size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + int err; +@@ -410,10 +417,11 @@ sd_store_max_medium_access_timeouts(stru return err ? err : count; } -+static DEVICE_ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR, -+ sd_show_max_medium_access_timeouts, -+ sd_store_max_medium_access_timeouts); ++static DEVICE_ATTR_RW(max_medium_access_timeouts); static ssize_t - sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr, -@@ -451,35 +468,30 @@ sd_store_write_same_blocks(struct device +-sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr, +- char *buf) ++write_same_blocks_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -421,8 +429,8 @@ sd_show_write_same_blocks(struct device + } + + static ssize_t +-sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++write_same_blocks_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -451,35 +459,29 @@ sd_store_write_same_blocks(struct device return count; } -+static DEVICE_ATTR(max_write_same_blocks, S_IRUGO|S_IWUSR, -+ sd_show_write_same_blocks, sd_store_write_same_blocks); ++static DEVICE_ATTR_RW(max_write_same_blocks); -static struct device_attribute sd_disk_attrs[] = { - __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, @@ -834,39 +1202,89 @@ Subject: meta-patch of all of the dev_attr conversions static const struct dev_pm_ops sd_pm_ops = { --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c -@@ -314,6 +314,8 @@ static ssize_t store_max_read_buffer_kb( +@@ -262,7 +262,7 @@ static int resize_async_buffer(struct co + + /* sysfs attribute files */ + +-static ssize_t show_max_read_buffer_kb(struct device *csdev, ++static ssize_t max_read_buffer_kb_show(struct device *csdev, + struct device_attribute *attr, char *buf) + { + unsigned int minor = MINOR(csdev->devt); +@@ -283,7 +283,7 @@ static ssize_t show_max_read_buffer_kb(s + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_max_read_buffer_kb(struct device *csdev, ++static ssize_t max_read_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -314,8 +314,9 @@ static ssize_t store_max_read_buffer_kb( return err ? err : count; } -+static DEVICE_ATTR(max_read_buffer_kb, S_IRUGO | S_IWUSR, -+ show_max_read_buffer_kb, store_max_read_buffer_kb); ++static DEVICE_ATTR_RW(max_read_buffer_kb); - static ssize_t show_read_buffer_kb(struct device *csdev, +-static ssize_t show_read_buffer_kb(struct device *csdev, ++static ssize_t read_buffer_kb_show(struct device *csdev, struct device_attribute *attr, char *buf) -@@ -367,6 +369,8 @@ static ssize_t store_read_buffer_kb(stru + { + unsigned int minor = MINOR(csdev->devt); +@@ -336,7 +337,7 @@ static ssize_t show_read_buffer_kb(struc + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_read_buffer_kb(struct device *csdev, ++static ssize_t read_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -367,8 +368,9 @@ static ssize_t store_read_buffer_kb(stru return err ? err : count; } -+static DEVICE_ATTR(read_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP, -+ show_read_buffer_kb, store_read_buffer_kb); ++static DEVICE_ATTR_RW(read_buffer_kb); - static ssize_t show_max_write_buffer_kb(struct device *csdev, +-static ssize_t show_max_write_buffer_kb(struct device *csdev, ++static ssize_t max_write_buffer_kb_show(struct device *csdev, struct device_attribute *attr, -@@ -421,6 +425,8 @@ static ssize_t store_max_write_buffer_kb + char *buf) + { +@@ -390,7 +392,7 @@ static ssize_t show_max_write_buffer_kb( + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_max_write_buffer_kb(struct device *csdev, ++static ssize_t max_write_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -421,8 +423,9 @@ static ssize_t store_max_write_buffer_kb return err ? err : count; } -+static DEVICE_ATTR(max_write_buffer_kb, S_IRUGO | S_IWUSR, -+ show_max_write_buffer_kb, store_max_write_buffer_kb); ++static DEVICE_ATTR_RW(max_write_buffer_kb); - static ssize_t show_write_buffer_kb(struct device *csdev, +-static ssize_t show_write_buffer_kb(struct device *csdev, ++static ssize_t write_buffer_kb_show(struct device *csdev, struct device_attribute *attr, char *buf) -@@ -474,18 +480,17 @@ static ssize_t store_write_buffer_kb(str + { + unsigned int minor = MINOR(csdev->devt); +@@ -443,7 +446,7 @@ static ssize_t show_write_buffer_kb(stru + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_write_buffer_kb(struct device *csdev, ++static ssize_t write_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -474,18 +477,16 @@ static ssize_t store_write_buffer_kb(str return err ? err : count; } -+static DEVICE_ATTR(write_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP, -+ show_write_buffer_kb, store_write_buffer_kb); ++static DEVICE_ATTR_RW(write_buffer_kb); -static struct device_attribute comedi_dev_attrs[] = { - __ATTR(max_read_buffer_kb, S_IRUGO | S_IWUSR, @@ -889,7 +1307,7 @@ Subject: meta-patch of all of the dev_attr conversions static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask, unsigned bits) -@@ -2554,7 +2559,7 @@ static int __init comedi_init(void) +@@ -2554,7 +2555,7 @@ static int __init comedi_init(void) return PTR_ERR(comedi_class); } @@ -900,27 +1318,36 @@ Subject: meta-patch of all of the dev_attr conversions comedi_proc_init(); --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c -@@ -230,6 +230,7 @@ static ssize_t show_name(struct device * +@@ -224,38 +224,42 @@ static struct kobj_type portio_attr_type + .default_attrs = portio_attrs, + }; + +-static ssize_t show_name(struct device *dev, ++static ssize_t name_show(struct device *dev, + struct device_attribute *attr, char *buf) + { struct uio_device *idev = dev_get_drvdata(dev); return sprintf(buf, "%s\n", idev->info->name); } -+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); ++static DEVICE_ATTR_RO(name); - static ssize_t show_version(struct device *dev, +-static ssize_t show_version(struct device *dev, ++static ssize_t version_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -237,6 +238,7 @@ static ssize_t show_version(struct devic + { struct uio_device *idev = dev_get_drvdata(dev); return sprintf(buf, "%s\n", idev->info->version); } -+static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); ++static DEVICE_ATTR_RO(version); - static ssize_t show_event(struct device *dev, +-static ssize_t show_event(struct device *dev, ++static ssize_t event_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -244,18 +246,20 @@ static ssize_t show_event(struct device + { struct uio_device *idev = dev_get_drvdata(dev); return sprintf(buf, "%u\n", (unsigned int)atomic_read(&idev->event)); } -+static DEVICE_ATTR(event, S_IRUGO, show_event, NULL); ++static DEVICE_ATTR_RO(event); -static struct device_attribute uio_class_attributes[] = { - __ATTR(name, S_IRUGO, show_name, NULL), @@ -945,49 +1372,88 @@ Subject: meta-patch of all of the dev_attr conversions /* --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c -@@ -136,6 +136,7 @@ static ssize_t backlight_store_power(str +@@ -103,16 +103,16 @@ static void backlight_generate_event(str + sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); + } + +-static ssize_t backlight_show_power(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t bl_power_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct backlight_device *bd = to_backlight_device(dev); + + return sprintf(buf, "%d\n", bd->props.power); + } + +-static ssize_t backlight_store_power(struct device *dev, +- struct device_attribute *attr, const char *buf, size_t count) ++static ssize_t bl_power_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + int rc; + struct backlight_device *bd = to_backlight_device(dev); +@@ -136,8 +136,9 @@ static ssize_t backlight_store_power(str return rc; } -+static DEVICE_ATTR(bl_power, 0644, backlight_show_power, backlight_store_power); ++static DEVICE_ATTR_RW(bl_power); - static ssize_t backlight_show_brightness(struct device *dev, +-static ssize_t backlight_show_brightness(struct device *dev, ++static ssize_t brightness_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -175,6 +176,8 @@ static ssize_t backlight_store_brightnes + { + struct backlight_device *bd = to_backlight_device(dev); +@@ -145,7 +146,7 @@ static ssize_t backlight_show_brightness + return sprintf(buf, "%d\n", bd->props.brightness); + } + +-static ssize_t backlight_store_brightness(struct device *dev, ++static ssize_t brightness_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + int rc; +@@ -175,24 +176,27 @@ static ssize_t backlight_store_brightnes return rc; } -+static DEVICE_ATTR(brightness, 0644, backlight_show_brightness, -+ backlight_store_brightness); ++static DEVICE_ATTR_RW(brightness); - static ssize_t backlight_show_type(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -183,6 +186,7 @@ static ssize_t backlight_show_type(struc +-static ssize_t backlight_show_type(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct backlight_device *bd = to_backlight_device(dev); return sprintf(buf, "%s\n", backlight_types[bd->props.type]); } -+static DEVICE_ATTR(type, 0444, backlight_show_type, NULL); ++static DEVICE_ATTR_RO(type); - static ssize_t backlight_show_max_brightness(struct device *dev, +-static ssize_t backlight_show_max_brightness(struct device *dev, ++static ssize_t max_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -191,6 +195,7 @@ static ssize_t backlight_show_max_bright + { + struct backlight_device *bd = to_backlight_device(dev); return sprintf(buf, "%d\n", bd->props.max_brightness); } -+static DEVICE_ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL); ++static DEVICE_ATTR_RO(max_brightness); - static ssize_t backlight_show_actual_brightness(struct device *dev, +-static ssize_t backlight_show_actual_brightness(struct device *dev, ++static ssize_t actual_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -205,6 +210,8 @@ static ssize_t backlight_show_actual_bri + { + int rc = -ENXIO; +@@ -205,6 +209,7 @@ static ssize_t backlight_show_actual_bri return rc; } -+static DEVICE_ATTR(actual_brightness, 0444, backlight_show_actual_brightness, -+ NULL); ++static DEVICE_ATTR_RO(actual_brightness); static struct class *backlight_class; -@@ -247,16 +254,15 @@ static void bl_device_release(struct dev +@@ -247,16 +252,15 @@ static void bl_device_release(struct dev kfree(bd); } @@ -1012,7 +1478,7 @@ Subject: meta-patch of all of the dev_attr conversions /** * backlight_force_update - tell the backlight subsystem that hardware state -@@ -493,7 +499,7 @@ static int __init backlight_class_init(v +@@ -493,7 +497,7 @@ static int __init backlight_class_init(v return PTR_ERR(backlight_class); } @@ -1021,6 +1487,16 @@ Subject: meta-patch of all of the dev_attr conversions backlight_class->pm = &backlight_class_dev_pm_ops; return 0; } +--- a/drivers/video/backlight/lcd.c ++++ b/drivers/video/backlight/lcd.c +@@ -189,6 +189,7 @@ static struct device_attribute lcd_devic + __ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL), + __ATTR_NULL, + }; ++ATTRIBUTE_GROUPS(lcd_device); + + /** + * lcd_device_register - register a new object of lcd_device class. --- a/drivers/video/output.c +++ b/drivers/video/output.c @@ -32,8 +32,8 @@ MODULE_DESCRIPTION("Display Output Switc @@ -1076,18 +1552,44 @@ Subject: meta-patch of all of the dev_attr conversions }; struct output_device *video_output_register(const char *name, ---- a/include/linux/device.h -+++ b/include/linux/device.h -@@ -342,7 +342,8 @@ struct class { - struct module *owner; - - struct class_attribute *class_attrs; -- struct device_attribute *dev_attrs; -+ const struct attribute_group **dev_groups; -+// struct device_attribute *dev_attrs; - struct bin_attribute *dev_bin_attrs; - struct kobject *dev_kobj; +--- a/fs/fuse/cuse.c ++++ b/fs/fuse/cuse.c +@@ -568,6 +568,7 @@ static ssize_t cuse_class_waiting_show(s + return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting)); + } ++static DEVICE_ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL); + + static ssize_t cuse_class_abort_store(struct device *dev, + struct device_attribute *attr, +@@ -578,12 +579,14 @@ static ssize_t cuse_class_abort_store(st + fuse_abort_conn(&cc->fc); + return count; + } ++static DEVICE_ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store); + +-static struct device_attribute cuse_class_dev_attrs[] = { +- __ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL), +- __ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store), +- { } ++static struct attribute *cuse_class_dev_attrs[] = { ++ &dev_attr_waiting.attr, ++ &dev_attr_abort.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(cuse_class_dev); + + static struct miscdevice cuse_miscdev = { + .minor = MISC_DYNAMIC_MINOR, +@@ -609,7 +612,7 @@ static int __init cuse_init(void) + if (IS_ERR(cuse_class)) + return PTR_ERR(cuse_class); + +- cuse_class->dev_attrs = cuse_class_dev_attrs; ++ cuse_class->dev_groups = cuse_class_dev_groups; + + rc = misc_register(&cuse_miscdev); + if (rc) { --- a/include/linux/pps_kernel.h +++ b/include/linux/pps_kernel.h @@ -80,7 +80,7 @@ struct pps_device { @@ -1101,37 +1603,21 @@ Subject: meta-patch of all of the dev_attr conversions * Internal functions. --- a/mm/backing-dev.c +++ b/mm/backing-dev.c -@@ -183,6 +183,7 @@ static ssize_t name##_show(struct device - } +@@ -180,7 +180,8 @@ static ssize_t name##_show(struct device + struct backing_dev_info *bdi = dev_get_drvdata(dev); \ + \ + return snprintf(page, PAGE_SIZE-1, "%lld\n", (long long)expr); \ +-} ++} \ ++static DEVICE_ATTR_RW(name); BDI_SHOW(read_ahead_kb, K(bdi->ra_pages)) -+static DEVICE_ATTR(read_ahead_kb, 0644, read_ahead_kb_show, read_ahead_kb_store); - - static ssize_t min_ratio_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -@@ -201,7 +202,8 @@ static ssize_t min_ratio_store(struct de - - return ret; - } --BDI_SHOW(min_ratio, bdi->min_ratio) -+BDI_SHOW(min_ratio, bdi->min_ratio); -+static DEVICE_ATTR(min_ratio, 0644, min_ratio_show, min_ratio_store); - static ssize_t max_ratio_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -@@ -221,6 +223,7 @@ static ssize_t max_ratio_store(struct de - return ret; - } - BDI_SHOW(max_ratio, bdi->max_ratio) -+static DEVICE_ATTR(max_ratio, 0644, max_ratio_show, max_ratio_store); - - static ssize_t stable_pages_required_show(struct device *dev, - struct device_attribute *attr, -@@ -231,14 +234,17 @@ static ssize_t stable_pages_required_sho +@@ -231,14 +232,16 @@ static ssize_t stable_pages_required_sho return snprintf(page, PAGE_SIZE-1, "%d\n", bdi_cap_stable_pages_required(bdi) ? 1 : 0); } -+static DEVICE_ATTR(stable_pages_required, 0444, stable_pages_required_show, NULL); ++static DEVICE_ATTR_RO(stable_pages_required); -static struct device_attribute bdi_dev_attrs[] = { - __ATTR_RW(read_ahead_kb), @@ -1139,7 +1625,6 @@ Subject: meta-patch of all of the dev_attr conversions - __ATTR_RW(max_ratio), - __ATTR_RO(stable_pages_required), - __ATTR_NULL, -+ +static struct attribute *bdi_dev_attrs[] = { + &dev_attr_read_ahead_kb.attr, + &dev_attr_min_ratio.attr, @@ -1151,7 +1636,7 @@ Subject: meta-patch of all of the dev_attr conversions static __init int bdi_class_init(void) { -@@ -246,7 +252,7 @@ static __init int bdi_class_init(void) +@@ -246,7 +249,7 @@ static __init int bdi_class_init(void) if (IS_ERR(bdi_class)) return PTR_ERR(bdi_class); @@ -1162,7 +1647,12 @@ Subject: meta-patch of all of the dev_attr conversions } --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c -@@ -64,8 +64,15 @@ static ssize_t show_##field(struct devic +@@ -60,12 +60,19 @@ static ssize_t format_##field(const stru + { \ + return sprintf(buf, format_string, net->field); \ + } \ +-static ssize_t show_##field(struct device *dev, \ ++static ssize_t field##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ return netdev_show(dev, attr, buf, format_##field); \ @@ -1171,15 +1661,15 @@ Subject: meta-patch of all of the dev_attr conversions +#define NETDEVICE_SHOW_RO(field, format_string) \ +NETDEVICE_SHOW(field, format_string); \ -+static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL) ++static DEVICE_ATTR_RO(field) + +#define NETDEVICE_SHOW_RW(field, format_string) \ +NETDEVICE_SHOW(field, format_string); \ -+static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field) ++static DEVICE_ATTR_RW(field) /* use same locking and permission rules as SIF* ioctl's */ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, -@@ -96,13 +103,13 @@ static ssize_t netdev_store(struct devic +@@ -96,16 +103,16 @@ static ssize_t netdev_store(struct devic return ret; } @@ -1199,67 +1689,115 @@ Subject: meta-patch of all of the dev_attr conversions +NETDEVICE_SHOW_RO(link_mode, fmt_dec); /* use same locking rules as GIFHWADDR ioctl's */ - static ssize_t show_address(struct device *dev, struct device_attribute *attr, -@@ -117,6 +124,7 @@ static ssize_t show_address(struct devic +-static ssize_t show_address(struct device *dev, struct device_attribute *attr, ++static ssize_t address_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + struct net_device *net = to_net_dev(dev); +@@ -117,15 +124,17 @@ static ssize_t show_address(struct devic read_unlock(&dev_base_lock); return ret; } -+static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); ++static DEVICE_ATTR_RO(address); - static ssize_t show_broadcast(struct device *dev, - struct device_attribute *attr, char *buf) -@@ -126,6 +134,7 @@ static ssize_t show_broadcast(struct dev +-static ssize_t show_broadcast(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t broadcast_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct net_device *net = to_net_dev(dev); + if (dev_isalive(net)) return sysfs_format_mac(buf, net->broadcast, net->addr_len); return -EINVAL; } -+static DEVICE_ATTR(broadcast, S_IRUGO, show_broadcast, NULL); ++static DEVICE_ATTR_RO(broadcast); static int change_carrier(struct net_device *net, unsigned long new_carrier) { -@@ -149,6 +158,7 @@ static ssize_t show_carrier(struct devic +@@ -134,13 +143,13 @@ static int change_carrier(struct net_dev + return dev_change_carrier(net, (bool) new_carrier); + } + +-static ssize_t store_carrier(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t len) ++static ssize_t carrier_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t len) + { + return netdev_store(dev, attr, buf, len, change_carrier); + } + +-static ssize_t show_carrier(struct device *dev, ++static ssize_t carrier_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct net_device *netdev = to_net_dev(dev); +@@ -149,8 +158,9 @@ static ssize_t show_carrier(struct devic } return -EINVAL; } -+static DEVICE_ATTR(carrier, S_IRUGO | S_IWUSR, show_carrier, store_carrier); ++static DEVICE_ATTR_RW(carrier); - static ssize_t show_speed(struct device *dev, +-static ssize_t show_speed(struct device *dev, ++static ssize_t speed_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -167,6 +177,7 @@ static ssize_t show_speed(struct device + { + struct net_device *netdev = to_net_dev(dev); +@@ -167,8 +177,9 @@ static ssize_t show_speed(struct device rtnl_unlock(); return ret; } -+static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); ++static DEVICE_ATTR_RO(speed); - static ssize_t show_duplex(struct device *dev, +-static ssize_t show_duplex(struct device *dev, ++static ssize_t duplex_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -198,6 +209,7 @@ static ssize_t show_duplex(struct device + { + struct net_device *netdev = to_net_dev(dev); +@@ -198,8 +209,9 @@ static ssize_t show_duplex(struct device rtnl_unlock(); return ret; } -+static DEVICE_ATTR(duplex, S_IRUGO, show_duplex, NULL); ++static DEVICE_ATTR_RO(duplex); - static ssize_t show_dormant(struct device *dev, +-static ssize_t show_dormant(struct device *dev, ++static ssize_t dormant_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct net_device *netdev = to_net_dev(dev); @@ -209,6 +221,7 @@ static ssize_t show_dormant(struct devic return -EINVAL; } -+static DEVICE_ATTR(dormant, S_IRUGO, show_dormant, NULL); ++static DEVICE_ATTR_RO(dormant); static const char *const operstates[] = { "unknown", -@@ -237,9 +250,9 @@ static ssize_t show_operstate(struct dev +@@ -220,7 +233,7 @@ static const char *const operstates[] = + "up" + }; + +-static ssize_t show_operstate(struct device *dev, ++static ssize_t operstate_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + const struct net_device *netdev = to_net_dev(dev); +@@ -237,35 +250,33 @@ static ssize_t show_operstate(struct dev return sprintf(buf, "%s\n", operstates[operstate]); } -+static DEVICE_ATTR(operstate, S_IRUGO, show_operstate, NULL); ++static DEVICE_ATTR_RO(operstate); /* read-write attributes */ -NETDEVICE_SHOW(mtu, fmt_dec); static int change_mtu(struct net_device *net, unsigned long new_mtu) { -@@ -251,8 +264,7 @@ static ssize_t store_mtu(struct device * + return dev_set_mtu(net, (int) new_mtu); + } + +-static ssize_t store_mtu(struct device *dev, struct device_attribute *attr, ++static ssize_t mtu_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) { return netdev_store(dev, attr, buf, len, change_mtu); } @@ -1269,7 +1807,12 @@ Subject: meta-patch of all of the dev_attr conversions static int change_flags(struct net_device *net, unsigned long new_flags) { -@@ -264,8 +276,7 @@ static ssize_t store_flags(struct device + return dev_change_flags(net, (unsigned int) new_flags); + } + +-static ssize_t store_flags(struct device *dev, struct device_attribute *attr, ++static ssize_t flags_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) { return netdev_store(dev, attr, buf, len, change_flags); } @@ -1279,30 +1822,58 @@ Subject: meta-patch of all of the dev_attr conversions static int change_tx_queue_len(struct net_device *net, unsigned long new_len) { -@@ -282,6 +293,7 @@ static ssize_t store_tx_queue_len(struct +@@ -273,7 +284,7 @@ static int change_tx_queue_len(struct ne + return 0; + } + +-static ssize_t store_tx_queue_len(struct device *dev, ++static ssize_t tx_queue_len_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) + { +@@ -282,8 +293,9 @@ static ssize_t store_tx_queue_len(struct return netdev_store(dev, attr, buf, len, change_tx_queue_len); } +NETDEVICE_SHOW_RW(tx_queue_len, fmt_ulong); - static ssize_t store_ifalias(struct device *dev, struct device_attribute *attr, +-static ssize_t store_ifalias(struct device *dev, struct device_attribute *attr, ++static ssize_t ifalias_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) + { + struct net_device *netdev = to_net_dev(dev); +@@ -306,7 +318,7 @@ static ssize_t store_ifalias(struct devi + return ret < 0 ? ret : len; + } + +-static ssize_t show_ifalias(struct device *dev, ++static ssize_t ifalias_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + const struct net_device *netdev = to_net_dev(dev); @@ -319,8 +331,7 @@ static ssize_t show_ifalias(struct devic rtnl_unlock(); return ret; } - -NETDEVICE_SHOW(group, fmt_dec); -+static DEVICE_ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias); ++static DEVICE_ATTR_RW(ifalias); static int change_group(struct net_device *net, unsigned long new_group) { -@@ -333,30 +344,32 @@ static ssize_t store_group(struct device +@@ -328,35 +339,37 @@ static int change_group(struct net_devic + return 0; + } + +-static ssize_t store_group(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t len) ++static ssize_t group_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t len) { return netdev_store(dev, attr, buf, len, change_group); } +NETDEVICE_SHOW(group, fmt_dec); -+static DEVICE_ATTR(netdev_group, S_IRUGO | S_IWUSR, show_group, store_group); ++static DEVICE_ATTR(netdev_group, S_IRUGO | S_IWUSR, group_show, group_store); -static struct device_attribute net_class_attributes[] = { - __ATTR(addr_assign_type, S_IRUGO, show_addr_assign_type, NULL), @@ -1352,6 +1923,22 @@ Subject: meta-patch of all of the dev_attr conversions /* Show a given an attribute in the statistics group */ static ssize_t netstat_show(const struct device *d, +@@ -382,13 +395,13 @@ static ssize_t netstat_show(const struct + + /* generate a read-only statistics attribute */ + #define NETSTAT_ENTRY(name) \ +-static ssize_t show_##name(struct device *d, \ ++static ssize_t name##_show(struct device *d, \ + struct device_attribute *attr, char *buf) \ + { \ + return netstat_show(d, attr, buf, \ + offsetof(struct rtnl_link_stats64, name)); \ + } \ +-static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) ++static DEVICE_ATTR_RO(name) + + NETSTAT_ENTRY(rx_packets); + NETSTAT_ENTRY(tx_packets); @@ -457,6 +470,9 @@ static struct attribute_group wireless_g .attrs = wireless_attrs, }; @@ -1375,67 +1962,141 @@ Subject: meta-patch of all of the dev_attr conversions .namespace = net_namespace, --- a/net/rfkill/core.c +++ b/net/rfkill/core.c -@@ -584,6 +584,7 @@ static ssize_t rfkill_name_show(struct d +@@ -576,14 +576,14 @@ void rfkill_set_states(struct rfkill *rf + } + EXPORT_SYMBOL(rfkill_set_states); + +-static ssize_t rfkill_name_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t name_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); return sprintf(buf, "%s\n", rfkill->name); } -+static DEVICE_ATTR(name, S_IRUGO, rfkill_name_show, NULL); ++static DEVICE_ATTR_RO(name); static const char *rfkill_get_type_str(enum rfkill_type type) { -@@ -619,6 +620,7 @@ static ssize_t rfkill_type_show(struct d +@@ -611,54 +611,52 @@ static const char *rfkill_get_type_str(e + } + } + +-static ssize_t rfkill_type_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); return sprintf(buf, "%s\n", rfkill_get_type_str(rfkill->type)); } -+static DEVICE_ATTR(type, S_IRUGO, rfkill_type_show, NULL); ++static DEVICE_ATTR_RO(type); - static ssize_t rfkill_idx_show(struct device *dev, - struct device_attribute *attr, -@@ -628,6 +630,7 @@ static ssize_t rfkill_idx_show(struct de +-static ssize_t rfkill_idx_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t idx_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); return sprintf(buf, "%d\n", rfkill->idx); } -+static DEVICE_ATTR(index, S_IRUGO, rfkill_idx_show, NULL); ++static DEVICE_ATTR_RO(index); - static ssize_t rfkill_persistent_show(struct device *dev, - struct device_attribute *attr, -@@ -637,6 +640,7 @@ static ssize_t rfkill_persistent_show(st +-static ssize_t rfkill_persistent_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t persistent_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); return sprintf(buf, "%d\n", rfkill->persistent); } -+static DEVICE_ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL); ++static DEVICE_ATTR_RO(persistent); - static ssize_t rfkill_hard_show(struct device *dev, - struct device_attribute *attr, -@@ -646,6 +650,7 @@ static ssize_t rfkill_hard_show(struct d +-static ssize_t rfkill_hard_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t hard_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 ); } -+static DEVICE_ATTR(hard, S_IRUGO, rfkill_hard_show, NULL); ++static DEVICE_ATTR_RO(hard); + +-static ssize_t rfkill_soft_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t soft_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0 ); + } - static ssize_t rfkill_soft_show(struct device *dev, - struct device_attribute *attr, -@@ -680,6 +685,7 @@ static ssize_t rfkill_soft_store(struct +-static ssize_t rfkill_soft_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t soft_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct rfkill *rfkill = to_rfkill(dev); + unsigned long state; +@@ -680,6 +678,7 @@ static ssize_t rfkill_soft_store(struct return count; } -+static DEVICE_ATTR(soft, S_IRUGO|S_IWUSR, rfkill_soft_show, rfkill_soft_store); ++static DEVICE_ATTR_RW(soft); static u8 user_state_from_blocked(unsigned long state) { -@@ -725,6 +731,7 @@ static ssize_t rfkill_state_store(struct +@@ -691,18 +690,16 @@ static u8 user_state_from_blocked(unsign + return RFKILL_USER_STATE_UNBLOCKED; + } + +-static ssize_t rfkill_state_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t state_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", user_state_from_blocked(rfkill->state)); + } + +-static ssize_t rfkill_state_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t state_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct rfkill *rfkill = to_rfkill(dev); + unsigned long state; +@@ -725,32 +722,27 @@ static ssize_t rfkill_state_store(struct return count; } -+static DEVICE_ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store); ++static DEVICE_ATTR_RW(state); - static ssize_t rfkill_claim_show(struct device *dev, - struct device_attribute *attr, -@@ -732,25 +739,20 @@ static ssize_t rfkill_claim_show(struct +-static ssize_t rfkill_claim_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t claim_show(struct device *dev, struct device_attribute *attr, ++ char *buf) { return sprintf(buf, "%d\n", 0); } -+static DEVICE_ATTR(claim, S_IRUGO, rfkill_claim_show, NULL); ++static DEVICE_ATTR_RO(claim); -static ssize_t rfkill_claim_store(struct device *dev, - struct device_attribute *attr, @@ -1469,7 +2130,7 @@ Subject: meta-patch of all of the dev_attr conversions static void rfkill_release(struct device *dev) { -@@ -830,7 +832,7 @@ static int rfkill_resume(struct device * +@@ -830,7 +822,7 @@ static int rfkill_resume(struct device * static struct class rfkill_class = { .name = "rfkill", .dev_release = rfkill_release, diff --git a/driver-core-add-default-groups-to-struct-class.patch b/driver-core-add-default-groups-to-struct-class.patch new file mode 100644 index 00000000000000..79787cc18472ed --- /dev/null +++ b/driver-core-add-default-groups-to-struct-class.patch @@ -0,0 +1,65 @@ +From foo@baz Tue Jul 9 12:00:06 PDT 2013 +Date: Tue, 09 Jul 2013 12:00:06 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: 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. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 8 +++++++- + include/linux/device.h | 4 +++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -528,9 +528,12 @@ static int device_add_attrs(struct devic + 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; +@@ -569,6 +572,9 @@ static int device_add_attrs(struct devic + 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; + } +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -313,6 +313,7 @@ int subsys_virtual_register(struct bus_t + * @name: Name of the class. + * @owner: The module owner. + * @class_attrs: Default attributes of this class. ++ * @dev_groups: Default attributes of the devices that belong to the class. + * @dev_attrs: Default attributes of the devices belong to the class. + * @dev_bin_attrs: Default binary attributes of the devices belong to the class. + * @dev_kobj: The kobject that represents this class and links it into the hierarchy. +@@ -342,7 +343,8 @@ struct class { + struct module *owner; + + struct class_attribute *class_attrs; +- struct device_attribute *dev_attrs; ++ struct device_attribute *dev_attrs; /* use dev_groups instead */ ++ const struct attribute_group **dev_groups; + struct bin_attribute *dev_bin_attrs; + struct kobject *dev_kobj; + diff --git a/driver-core-remove-dev_attrs-from-struct-class.patch b/driver-core-remove-dev_attrs-from-struct-class.patch new file mode 100644 index 00000000000000..a10c3cc1add959 --- /dev/null +++ b/driver-core-remove-dev_attrs-from-struct-class.patch @@ -0,0 +1,104 @@ +From foo@baz Tue Jul 9 12:07:03 PDT 2013 +Date: Tue, 09 Jul 2013 12:07:03 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: remove dev_attrs from struct class + +Now that all in-kernel users of the dev_attrs field are converted to use +dev_groups, we can safely remove dev_attrs from struct class. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 39 ++------------------------------------- + include/linux/device.h | 2 -- + 2 files changed, 2 insertions(+), 39 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -433,35 +433,6 @@ static ssize_t store_online(struct devic + static struct device_attribute online_attr = + __ATTR(online, S_IRUGO | S_IWUSR, show_online, store_online); + +-static int device_add_attributes(struct device *dev, +- struct device_attribute *attrs) +-{ +- int error = 0; +- int i; +- +- if (attrs) { +- for (i = 0; attr_name(attrs[i]); i++) { +- error = device_create_file(dev, &attrs[i]); +- if (error) +- break; +- } +- if (error) +- while (--i >= 0) +- device_remove_file(dev, &attrs[i]); +- } +- return error; +-} +- +-static void device_remove_attributes(struct device *dev, +- struct device_attribute *attrs) +-{ +- int i; +- +- if (attrs) +- for (i = 0; attr_name(attrs[i]); i++) +- device_remove_file(dev, &attrs[i]); +-} +- + static int device_add_bin_attributes(struct device *dev, + const struct bin_attribute *attrs) + { +@@ -531,12 +502,9 @@ static int device_add_attrs(struct devic + 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; ++ goto err_remove_class_groups; + } + + if (type) { +@@ -569,9 +537,6 @@ static int device_add_attrs(struct devic + err_remove_class_bin_attrs: + if (class) + device_remove_bin_attributes(dev, class->dev_bin_attrs); +- 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); +@@ -592,7 +557,7 @@ static void device_remove_attrs(struct d + device_remove_groups(dev, type->groups); + + if (class) { +- device_remove_attributes(dev, class->dev_attrs); ++ device_remove_groups(dev, class->dev_groups); + device_remove_bin_attributes(dev, class->dev_bin_attrs); + } + } +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -314,7 +314,6 @@ int subsys_virtual_register(struct bus_t + * @owner: The module owner. + * @class_attrs: Default attributes of this class. + * @dev_groups: Default attributes of the devices that belong to the class. +- * @dev_attrs: Default attributes of the devices belong to the class. + * @dev_bin_attrs: Default binary attributes of the devices belong to the class. + * @dev_kobj: The kobject that represents this class and links it into the hierarchy. + * @dev_uevent: Called when a device is added, removed from this class, or a +@@ -343,7 +342,6 @@ struct class { + struct module *owner; + + struct class_attribute *class_attrs; +- struct device_attribute *dev_attrs; /* use dev_groups instead */ + const struct attribute_group **dev_groups; + struct bin_attribute *dev_bin_attrs; + struct kobject *dev_kobj; @@ -4,6 +4,8 @@ sysfs.h-add-attribute_groups-macro.patch driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch driver-core-add-binary-attributes-to-struct-device.patch misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch +driver-core-add-default-groups-to-struct-class.patch +driver-core-remove-dev_attrs-from-struct-class.patch d1.patch usb-ldusb-remove-custom-dbg_info-macro.patch usb-legotower-remove-unneeded-tracing-macros.patch |
