diff options
| -rw-r--r-- | d1.patch | 1190 |
1 files changed, 1158 insertions, 32 deletions
diff --git a/d1.patch b/d1.patch index 31a54208149752..f4257c7d721b26 100644 --- a/d1.patch +++ b/d1.patch @@ -1,33 +1,47 @@ Subject: meta-patch of all of the dev_attr conversions - - --- - drivers/devfreq/devfreq.c | 76 ++++++++++------- + drivers/devfreq/devfreq.c | 76 ++++++++++-------- drivers/dma/dmaengine.c | 26 +++--- - drivers/leds/led-class.c | 38 +++++++- + drivers/extcon/extcon-class.c | 13 +-- + drivers/hid/hid-roccat-arvo.c | 25 +++-- + drivers/hid/hid-roccat-isku.c | 13 +-- + drivers/hid/hid-roccat-kone.c | 30 ++++--- + drivers/hid/hid-roccat-koneplus.c | 26 +++--- + drivers/hid/hid-roccat-kovaplus.c | 33 ++++--- + drivers/hid/hid-roccat-pyra.c | 22 +++-- + drivers/isdn/mISDN/core.c | 62 ++++++++------ + drivers/leds/led-class.c | 38 +++++++-- + drivers/media/v4l2-core/v4l2-dev.c | 30 ++++--- drivers/misc/c2port/core.c | 50 ++++++----- - drivers/pci/pci-sysfs.c | 32 ++++--- + drivers/misc/enclosure.c | 29 ++---- + drivers/pci/pci-sysfs.c | 32 +++++-- drivers/pci/pci.h | 2 drivers/pci/probe.c | 2 + drivers/platform/x86/wmi.c | 10 +- drivers/pps/pps.c | 2 drivers/pps/sysfs.c | 55 ++++++++----- drivers/ptp/ptp_clock.c | 2 drivers/ptp/ptp_private.h | 2 drivers/ptp/ptp_sysfs.c | 51 ++++++------ + drivers/regulator/core.c | 28 +++--- drivers/rtc/rtc-sysfs.c | 46 +++++----- - drivers/scsi/sd.c | 148 +++++++++++++++++------------------ + drivers/scsi/osd/osd_uld.c | 13 +-- + drivers/scsi/sd.c | 147 +++++++++++++++++------------------ + drivers/scsi/st.c | 25 +++-- 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/backlight/lcd.c | 26 +++--- drivers/video/output.c | 20 ++-- fs/fuse/cuse.c | 13 +-- include/linux/pps_kernel.h | 2 mm/backing-dev.c | 19 ++-- net/core/net-sysfs.c | 134 +++++++++++++++++-------------- + net/ieee802154/wpan-class.c | 21 ++--- net/rfkill/core.c | 88 +++++++++----------- - 24 files changed, 508 insertions(+), 406 deletions(-) + net/wireless/sysfs.c | 23 +++-- + 40 files changed, 748 insertions(+), 593 deletions(-) --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -277,6 +291,580 @@ Subject: meta-patch of all of the dev_attr conversions .dev_release = chan_dev_release, }; +--- a/drivers/extcon/extcon-class.c ++++ b/drivers/extcon/extcon-class.c +@@ -148,6 +148,7 @@ static ssize_t state_store(struct device + + return count; + } ++static DEVICE_ATTR_RW(state); + + static ssize_t name_show(struct device *dev, struct device_attribute *attr, + char *buf) +@@ -163,6 +164,7 @@ static ssize_t name_show(struct device * + + return sprintf(buf, "%s\n", dev_name(edev->dev)); + } ++static DEVICE_ATTR_RO(name); + + static ssize_t cable_name_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -527,11 +529,12 @@ int extcon_unregister_notifier(struct ex + } + EXPORT_SYMBOL_GPL(extcon_unregister_notifier); + +-static struct device_attribute extcon_attrs[] = { +- __ATTR(state, S_IRUGO | S_IWUSR, state_show, state_store), +- __ATTR_RO(name), +- __ATTR_NULL, ++static struct attribute *extcon_attrs[] = { ++ &dev_attr_state.attr, ++ &dev_attr_name.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(extcon); + + static int create_extcon_class(void) + { +@@ -539,7 +542,7 @@ static int create_extcon_class(void) + extcon_class = class_create(THIS_MODULE, "extcon"); + if (IS_ERR(extcon_class)) + return PTR_ERR(extcon_class); +- extcon_class->dev_attrs = extcon_attrs; ++ extcon_class->dev_groups = extcon_groups; + + #if defined(CONFIG_ANDROID) + switch_class = class_compat_register("switch"); +--- a/drivers/hid/hid-roccat-arvo.c ++++ b/drivers/hid/hid-roccat-arvo.c +@@ -75,6 +75,8 @@ static ssize_t arvo_sysfs_set_mode_key(s + + return size; + } ++static DEVICE_ATTR(mode_key, 0660, ++ arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key); + + static ssize_t arvo_sysfs_show_key_mask(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -123,6 +125,8 @@ static ssize_t arvo_sysfs_set_key_mask(s + + return size; + } ++static DEVICE_ATTR(key_mask, 0660, ++ arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask); + + /* retval is 1-5 on success, < 0 on error */ + static int arvo_get_actual_profile(struct usb_device *usb_dev) +@@ -179,6 +183,9 @@ static ssize_t arvo_sysfs_set_actual_pro + mutex_unlock(&arvo->arvo_lock); + return retval; + } ++static DEVICE_ATTR(actual_profile, 0660, ++ arvo_sysfs_show_actual_profile, ++ arvo_sysfs_set_actual_profile); + + static ssize_t arvo_sysfs_write(struct file *fp, + struct kobject *kobj, void const *buf, +@@ -239,17 +246,13 @@ static ssize_t arvo_sysfs_read_info(stru + sizeof(struct arvo_info), ARVO_COMMAND_INFO); + } + +- +-static struct device_attribute arvo_attributes[] = { +- __ATTR(mode_key, 0660, +- arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key), +- __ATTR(key_mask, 0660, +- arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask), +- __ATTR(actual_profile, 0660, +- arvo_sysfs_show_actual_profile, +- arvo_sysfs_set_actual_profile), +- __ATTR_NULL ++static struct attribute *arvo_attrs[] = { ++ &dev_attr_mode_key.attr, ++ &dev_attr_key_mask.attr, ++ &dev_attr_actual_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(arvo); + + static struct bin_attribute arvo_bin_attributes[] = { + { +@@ -430,7 +433,7 @@ static int __init arvo_init(void) + arvo_class = class_create(THIS_MODULE, "arvo"); + if (IS_ERR(arvo_class)) + return PTR_ERR(arvo_class); +- arvo_class->dev_attrs = arvo_attributes; ++ arvo_class->dev_groups = arvo_groups; + arvo_class->dev_bin_attrs = arvo_bin_attributes; + + retval = hid_register_driver(&arvo_driver); +--- a/drivers/hid/hid-roccat-isku.c ++++ b/drivers/hid/hid-roccat-isku.c +@@ -109,13 +109,14 @@ static ssize_t isku_sysfs_set_actual_pro + + return size; + } ++static DEVICE_ATTR(actual_profile, 0660, isku_sysfs_show_actual_profile, ++ isku_sysfs_set_actual_profile); + +-static struct device_attribute isku_attributes[] = { +- __ATTR(actual_profile, 0660, +- isku_sysfs_show_actual_profile, +- isku_sysfs_set_actual_profile), +- __ATTR_NULL ++static struct attribute *isku_attrs[] = { ++ &dev_attr_actual_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(isku); + + static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, + char *buf, loff_t off, size_t count, +@@ -427,7 +428,7 @@ static int __init isku_init(void) + isku_class = class_create(THIS_MODULE, "isku"); + if (IS_ERR(isku_class)) + return PTR_ERR(isku_class); +- isku_class->dev_attrs = isku_attributes; ++ isku_class->dev_groups = isku_groups; + isku_class->dev_bin_attrs = isku_bin_attributes; + + retval = hid_register_driver(&isku_driver); +--- a/drivers/hid/hid-roccat-kone.c ++++ b/drivers/hid/hid-roccat-kone.c +@@ -386,6 +386,7 @@ static ssize_t kone_sysfs_show_actual_pr + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile); + } ++static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL); + + static ssize_t kone_sysfs_show_actual_dpi(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -394,6 +395,7 @@ static ssize_t kone_sysfs_show_actual_dp + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi); + } ++static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL); + + /* weight is read each time, since we don't get informed when it's changed */ + static ssize_t kone_sysfs_show_weight(struct device *dev, +@@ -416,6 +418,7 @@ static ssize_t kone_sysfs_show_weight(st + return retval; + return snprintf(buf, PAGE_SIZE, "%d\n", weight); + } ++static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL); + + static ssize_t kone_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -424,6 +427,8 @@ static ssize_t kone_sysfs_show_firmware_ + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version, ++ NULL); + + static ssize_t kone_sysfs_show_tcu(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -524,6 +529,7 @@ exit_unlock: + mutex_unlock(&kone->kone_lock); + return retval; + } ++static DEVICE_ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu); + + static ssize_t kone_sysfs_show_startup_profile(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -570,15 +576,17 @@ static ssize_t kone_sysfs_set_startup_pr + mutex_unlock(&kone->kone_lock); + return size; + } ++static DEVICE_ATTR(startup_profile, 0660, kone_sysfs_show_startup_profile, ++ kone_sysfs_set_startup_profile); + +-static struct device_attribute kone_attributes[] = { ++static struct attribute *kone_attrs[] = { + /* + * Read actual dpi settings. + * Returns raw value for further processing. Refer to enum + * kone_polling_rates to get real value. + */ +- __ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL), +- __ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL), ++ &dev_attr_actual_dpi.attr, ++ &dev_attr_actual_profile.attr, + + /* + * The mouse can be equipped with one of four supplied weights from 5 +@@ -587,7 +595,7 @@ static struct device_attribute kone_attr + * by software. Refer to enum kone_weights to get corresponding real + * weight. + */ +- __ATTR(weight, 0440, kone_sysfs_show_weight, NULL), ++ &dev_attr_weight.attr, + + /* + * Prints firmware version stored in mouse as integer. +@@ -595,22 +603,20 @@ static struct device_attribute kone_attr + * to get the real version number the decimal point has to be shifted 2 + * positions to the left. E.g. a value of 138 means 1.38. + */ +- __ATTR(firmware_version, 0440, +- kone_sysfs_show_firmware_version, NULL), ++ &dev_attr_firmware_version.attr, + + /* + * Prints state of Tracking Control Unit as number where 0 = off and + * 1 = on. Writing 0 deactivates tcu and writing 1 calibrates and + * activates the tcu + */ +- __ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu), ++ &dev_attr_tcu.attr, + + /* Prints and takes the number of the profile the mouse starts with */ +- __ATTR(startup_profile, 0660, +- kone_sysfs_show_startup_profile, +- kone_sysfs_set_startup_profile), +- __ATTR_NULL ++ &dev_attr_startup_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(kone); + + static struct bin_attribute kone_bin_attributes[] = { + { +@@ -891,7 +897,7 @@ static int __init kone_init(void) + kone_class = class_create(THIS_MODULE, "kone"); + if (IS_ERR(kone_class)) + return PTR_ERR(kone_class); +- kone_class->dev_attrs = kone_attributes; ++ kone_class->dev_groups = kone_groups; + kone_class->dev_bin_attrs = kone_bin_attributes; + + retval = hid_register_driver(&kone_driver); +--- a/drivers/hid/hid-roccat-koneplus.c ++++ b/drivers/hid/hid-roccat-koneplus.c +@@ -274,6 +274,12 @@ static ssize_t koneplus_sysfs_set_actual + + return size; + } ++static DEVICE_ATTR(actual_profile, 0660, ++ koneplus_sysfs_show_actual_profile, ++ koneplus_sysfs_set_actual_profile); ++static DEVICE_ATTR(startup_profile, 0660, ++ koneplus_sysfs_show_actual_profile, ++ koneplus_sysfs_set_actual_profile); + + static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -293,18 +299,16 @@ static ssize_t koneplus_sysfs_show_firmw + + return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, ++ koneplus_sysfs_show_firmware_version, NULL); + +-static struct device_attribute koneplus_attributes[] = { +- __ATTR(actual_profile, 0660, +- koneplus_sysfs_show_actual_profile, +- koneplus_sysfs_set_actual_profile), +- __ATTR(startup_profile, 0660, +- koneplus_sysfs_show_actual_profile, +- koneplus_sysfs_set_actual_profile), +- __ATTR(firmware_version, 0440, +- koneplus_sysfs_show_firmware_version, NULL), +- __ATTR_NULL ++static struct attribute *koneplus_attrs[] = { ++ &dev_attr_actual_profile.attr, ++ &dev_attr_startup_profile.attr, ++ &dev_attr_firmware_version.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(koneplus); + + static struct bin_attribute koneplus_bin_attributes[] = { + KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL), +@@ -572,7 +576,7 @@ static int __init koneplus_init(void) + koneplus_class = class_create(THIS_MODULE, "koneplus"); + if (IS_ERR(koneplus_class)) + return PTR_ERR(koneplus_class); +- koneplus_class->dev_attrs = koneplus_attributes; ++ koneplus_class->dev_groups = koneplus_groups; + koneplus_class->dev_bin_attrs = koneplus_bin_attributes; + + retval = hid_register_driver(&koneplus_driver); +--- a/drivers/hid/hid-roccat-kovaplus.c ++++ b/drivers/hid/hid-roccat-kovaplus.c +@@ -310,6 +310,9 @@ static ssize_t kovaplus_sysfs_set_actual + + return size; + } ++static DEVICE_ATTR(actual_profile, 0660, ++ kovaplus_sysfs_show_actual_profile, ++ kovaplus_sysfs_set_actual_profile); + + static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -318,6 +321,7 @@ static ssize_t kovaplus_sysfs_show_actua + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi); + } ++static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL); + + static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -326,6 +330,8 @@ static ssize_t kovaplus_sysfs_show_actua + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity); + } ++static DEVICE_ATTR(actual_sensitivity_x, 0440, ++ kovaplus_sysfs_show_actual_sensitivity_x, NULL); + + static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -334,6 +340,8 @@ static ssize_t kovaplus_sysfs_show_actua + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity); + } ++static DEVICE_ATTR(actual_sensitivity_y, 0440, ++ kovaplus_sysfs_show_actual_sensitivity_y, NULL); + + static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -353,21 +361,18 @@ static ssize_t kovaplus_sysfs_show_firmw + + return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, ++ kovaplus_sysfs_show_firmware_version, NULL); + +-static struct device_attribute kovaplus_attributes[] = { +- __ATTR(actual_cpi, 0440, +- kovaplus_sysfs_show_actual_cpi, NULL), +- __ATTR(firmware_version, 0440, +- kovaplus_sysfs_show_firmware_version, NULL), +- __ATTR(actual_profile, 0660, +- kovaplus_sysfs_show_actual_profile, +- kovaplus_sysfs_set_actual_profile), +- __ATTR(actual_sensitivity_x, 0440, +- kovaplus_sysfs_show_actual_sensitivity_x, NULL), +- __ATTR(actual_sensitivity_y, 0440, +- kovaplus_sysfs_show_actual_sensitivity_y, NULL), +- __ATTR_NULL ++static struct attribute *kovaplus_attrs[] = { ++ &dev_attr_actual_cpi.attr, ++ &dev_attr_firmware_version.attr, ++ &dev_attr_actual_profile.attr, ++ &dev_attr_actual_sensitivity_x.attr, ++ &dev_attr_actual_sensitivity_y.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(kovaplus); + + static struct bin_attribute kovaplus_bin_attributes[] = { + KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL), +@@ -662,7 +667,7 @@ static int __init kovaplus_init(void) + kovaplus_class = class_create(THIS_MODULE, "kovaplus"); + if (IS_ERR(kovaplus_class)) + return PTR_ERR(kovaplus_class); +- kovaplus_class->dev_attrs = kovaplus_attributes; ++ kovaplus_class->dev_groups = kovaplus_groups; + kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes; + + retval = hid_register_driver(&kovaplus_driver); +--- a/drivers/hid/hid-roccat-pyra.c ++++ b/drivers/hid/hid-roccat-pyra.c +@@ -266,6 +266,7 @@ static ssize_t pyra_sysfs_show_actual_cp + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); + } ++static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL); + + static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -282,6 +283,8 @@ static ssize_t pyra_sysfs_show_actual_pr + + return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile); + } ++static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL); ++static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL); + + static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -301,16 +304,17 @@ static ssize_t pyra_sysfs_show_firmware_ + + return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version, ++ NULL); + +-static struct device_attribute pyra_attributes[] = { +- __ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL), +- __ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL), +- __ATTR(firmware_version, 0440, +- pyra_sysfs_show_firmware_version, NULL), +- __ATTR(startup_profile, 0440, +- pyra_sysfs_show_actual_profile, NULL), +- __ATTR_NULL ++static struct attribute *pyra_attrs[] = { ++ &dev_attr_actual_cpi.attr, ++ &dev_attr_actual_profile.attr, ++ &dev_attr_firmware_version.attr, ++ &dev_attr_startup_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(pyra); + + static struct bin_attribute pyra_bin_attributes[] = { + PYRA_BIN_ATTRIBUTE_W(control, CONTROL), +@@ -600,7 +604,7 @@ static int __init pyra_init(void) + pyra_class = class_create(THIS_MODULE, "pyra"); + if (IS_ERR(pyra_class)) + return PTR_ERR(pyra_class); +- pyra_class->dev_attrs = pyra_attributes; ++ pyra_class->dev_groups = pyra_groups; + pyra_class->dev_bin_attrs = pyra_bin_attributes; + + retval = hid_register_driver(&pyra_driver); +--- a/drivers/isdn/mISDN/core.c ++++ b/drivers/isdn/mISDN/core.c +@@ -37,8 +37,8 @@ static void mISDN_dev_release(struct dev + /* nothing to do: the device is part of its parent's data structure */ + } + +-static ssize_t _show_id(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t id_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -46,9 +46,10 @@ static ssize_t _show_id(struct device *d + return -ENODEV; + return sprintf(buf, "%d\n", mdev->id); + } ++static DEVICE_ATTR_RO(id); + +-static ssize_t _show_nrbchan(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t nrbchan_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -56,9 +57,10 @@ static ssize_t _show_nrbchan(struct devi + return -ENODEV; + return sprintf(buf, "%d\n", mdev->nrbchan); + } ++static DEVICE_ATTR_RO(nrbchan); + +-static ssize_t _show_d_protocols(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t d_protocols_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -66,9 +68,10 @@ static ssize_t _show_d_protocols(struct + return -ENODEV; + return sprintf(buf, "%d\n", mdev->Dprotocols); + } ++static DEVICE_ATTR_RO(d_protocols); + +-static ssize_t _show_b_protocols(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t b_protocols_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -76,9 +79,10 @@ static ssize_t _show_b_protocols(struct + return -ENODEV; + return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); + } ++static DEVICE_ATTR_RO(b_protocols); + +-static ssize_t _show_protocol(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t protocol_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -86,17 +90,19 @@ static ssize_t _show_protocol(struct dev + return -ENODEV; + return sprintf(buf, "%d\n", mdev->D.protocol); + } ++static DEVICE_ATTR_RO(protocol); + +-static ssize_t _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) + { + strcpy(buf, dev_name(dev)); + return strlen(buf); + } ++static DEVICE_ATTR_RO(name); + + #if 0 /* hangs */ +-static ssize_t _set_name(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t name_set(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + int err = 0; + char *out = kmalloc(count + 1, GFP_KERNEL); +@@ -113,10 +119,11 @@ static ssize_t _set_name(struct device * + + return (err < 0) ? err : count; + } ++static DEVICE_ATTR_RW(name); + #endif + +-static ssize_t _show_channelmap(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t channelmap_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + char *bp = buf; +@@ -127,18 +134,19 @@ static ssize_t _show_channelmap(struct d + + return bp - buf; + } ++static DEVICE_ATTR_RO(channelmap); + +-static struct device_attribute mISDN_dev_attrs[] = { +- __ATTR(id, S_IRUGO, _show_id, NULL), +- __ATTR(d_protocols, S_IRUGO, _show_d_protocols, NULL), +- __ATTR(b_protocols, S_IRUGO, _show_b_protocols, NULL), +- __ATTR(protocol, S_IRUGO, _show_protocol, NULL), +- __ATTR(channelmap, S_IRUGO, _show_channelmap, NULL), +- __ATTR(nrbchan, S_IRUGO, _show_nrbchan, NULL), +- __ATTR(name, S_IRUGO, _show_name, NULL), +-/* __ATTR(name, S_IRUGO | S_IWUSR, _show_name, _set_name), */ +- {} ++static struct attribute *mISDN_attrs[] = { ++ &dev_attr_id.attr, ++ &dev_attr_d_protocols.attr, ++ &dev_attr_b_protocols.attr, ++ &dev_attr_protocol.attr, ++ &dev_attr_channelmap.attr, ++ &dev_attr_nrbchan.attr, ++ &dev_attr_name.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(mISDN); + + static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -162,7 +170,7 @@ static struct class mISDN_class = { + .name = "mISDN", + .owner = THIS_MODULE, + .dev_uevent = mISDN_uevent, +- .dev_attrs = mISDN_dev_attrs, ++ .dev_groups = mISDN_groups, + .dev_release = mISDN_dev_release, + .class_release = mISDN_class_release, + }; --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -29,7 +29,7 @@ static void led_update_brightness(struct @@ -355,6 +943,80 @@ Subject: meta-patch of all of the dev_attr conversions return 0; } +--- a/drivers/media/v4l2-core/v4l2-dev.c ++++ b/drivers/media/v4l2-core/v4l2-dev.c +@@ -38,24 +38,25 @@ + * sysfs stuff + */ + +-static ssize_t show_index(struct device *cd, +- struct device_attribute *attr, char *buf) ++static ssize_t index_show(struct device *cd, ++ struct device_attribute *attr, char *buf) + { + struct video_device *vdev = to_video_device(cd); + + return sprintf(buf, "%i\n", vdev->index); + } ++static DEVICE_ATTR_RO(index); + +-static ssize_t show_debug(struct device *cd, +- struct device_attribute *attr, char *buf) ++static ssize_t debug_show(struct device *cd, ++ struct device_attribute *attr, char *buf) + { + struct video_device *vdev = to_video_device(cd); + + return sprintf(buf, "%i\n", vdev->debug); + } + +-static ssize_t set_debug(struct device *cd, struct device_attribute *attr, +- const char *buf, size_t len) ++static ssize_t debug_store(struct device *cd, struct device_attribute *attr, ++ const char *buf, size_t len) + { + struct video_device *vdev = to_video_device(cd); + int res = 0; +@@ -68,21 +69,24 @@ static ssize_t set_debug(struct device * + vdev->debug = value; + return len; + } ++static DEVICE_ATTR_RW(debug); + +-static ssize_t show_name(struct device *cd, ++static ssize_t name_show(struct device *cd, + struct device_attribute *attr, char *buf) + { + struct video_device *vdev = to_video_device(cd); + + return sprintf(buf, "%.*s\n", (int)sizeof(vdev->name), vdev->name); + } ++static DEVICE_ATTR_RO(name); + +-static struct device_attribute video_device_attrs[] = { +- __ATTR(name, S_IRUGO, show_name, NULL), +- __ATTR(debug, 0644, show_debug, set_debug), +- __ATTR(index, S_IRUGO, show_index, NULL), +- __ATTR_NULL ++static struct attribute *video_device_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_debug.attr, ++ &dev_attr_index.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(video_device); + + /* + * Active devices +@@ -217,7 +221,7 @@ static void v4l2_device_release(struct d + + static struct class video_class = { + .name = VIDEO_NAME, +- .dev_attrs = video_device_attrs, ++ .dev_groups = video_device_groups, + }; + + struct video_device *video_devdata(struct file *file) --- a/drivers/misc/c2port/core.c +++ b/drivers/misc/c2port/core.c @@ -311,6 +311,7 @@ static ssize_t c2port_show_name(struct d @@ -499,6 +1161,77 @@ Subject: meta-patch of all of the dev_attr conversions c2port_class->dev_bin_attrs = c2port_bin_attrs; return 0; +--- 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) + { --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -131,19 +131,19 @@ static ssize_t pci_bus_show_cpuaffinity( @@ -583,6 +1316,34 @@ Subject: meta-patch of all of the dev_attr conversions }; static int __init pcibus_class_init(void) +--- a/drivers/platform/x86/wmi.c ++++ b/drivers/platform/x86/wmi.c +@@ -693,11 +693,13 @@ static ssize_t modalias_show(struct devi + + return sprintf(buf, "wmi:%s\n", guid_string); + } ++static DEVICE_ATTR_RO(modalias); + +-static struct device_attribute wmi_dev_attrs[] = { +- __ATTR_RO(modalias), +- __ATTR_NULL ++static struct attribute *wmi_attrs[] = { ++ &dev_attr_modalias.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(wmi); + + static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -732,7 +734,7 @@ static struct class wmi_class = { + .name = "wmi", + .dev_release = wmi_dev_free, + .dev_uevent = wmi_dev_uevent, +- .dev_attrs = wmi_dev_attrs, ++ .dev_groups = wmi_groups, + }; + + static int wmi_create_device(const struct guid_block *gblock, --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c @@ -406,7 +406,7 @@ static int __init pps_init(void) @@ -786,6 +1547,82 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t extts_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -323,13 +323,14 @@ static ssize_t regulator_uA_show(struct + } + static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL); + +-static ssize_t regulator_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 regulator_dev *rdev = dev_get_drvdata(dev); + + return sprintf(buf, "%s\n", rdev_get_name(rdev)); + } ++static DEVICE_ATTR_RO(name); + + static ssize_t regulator_print_opmode(char *buf, int mode) + { +@@ -489,15 +490,16 @@ static ssize_t regulator_total_uA_show(s + } + static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL); + +-static ssize_t regulator_num_users_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t num_users_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct regulator_dev *rdev = dev_get_drvdata(dev); + return sprintf(buf, "%d\n", rdev->use_count); + } ++static DEVICE_ATTR_RO(num_users); + +-static ssize_t regulator_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 regulator_dev *rdev = dev_get_drvdata(dev); + +@@ -509,6 +511,7 @@ static ssize_t regulator_type_show(struc + } + return sprintf(buf, "unknown\n"); + } ++static DEVICE_ATTR_RO(type); + + static ssize_t regulator_suspend_mem_uV_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -632,12 +635,13 @@ static DEVICE_ATTR(bypass, 0444, + * These are the only attributes are present for all regulators. + * Other attributes are a function of regulator functionality. + */ +-static struct device_attribute regulator_dev_attrs[] = { +- __ATTR(name, 0444, regulator_name_show, NULL), +- __ATTR(num_users, 0444, regulator_num_users_show, NULL), +- __ATTR(type, 0444, regulator_type_show, NULL), +- __ATTR_NULL, ++static struct attribute *regulator_dev_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_num_users.attr, ++ &dev_attr_type.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(regulator_dev); + + static void regulator_dev_release(struct device *dev) + { +@@ -648,7 +652,7 @@ static void regulator_dev_release(struct + static struct class regulator_class = { + .name = "regulator", + .dev_release = regulator_dev_release, +- .dev_attrs = regulator_dev_attrs, ++ .dev_groups = regulator_dev_groups, + }; + + /* Calculate the new optimum regulator operating mode based on the new total --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c @@ -25,15 +25,14 @@ @@ -906,6 +1743,41 @@ Subject: meta-patch of all of the dev_attr conversions - rtc_class->dev_attrs = rtc_attrs; + rtc_class->dev_groups = rtc_groups; } +--- a/drivers/scsi/osd/osd_uld.c ++++ b/drivers/scsi/osd/osd_uld.c +@@ -107,6 +107,7 @@ static ssize_t osdname_show(struct devic + class_dev); + return sprintf(buf, "%s\n", ould->odi.osdname); + } ++static DEVICE_ATTR_RO(osdname); + + static ssize_t systemid_show(struct device *dev, struct device_attribute *attr, + char *buf) +@@ -117,17 +118,19 @@ static ssize_t systemid_show(struct devi + memcpy(buf, ould->odi.systemid, ould->odi.systemid_len); + return ould->odi.systemid_len; + } ++static DEVICE_ATTR_RO(systemid); + +-static struct device_attribute osd_uld_attrs[] = { +- __ATTR(osdname, S_IRUGO, osdname_show, NULL), +- __ATTR(systemid, S_IRUGO, systemid_show, NULL), +- __ATTR_NULL, ++static struct attribute *osd_uld_attrs[] = { ++ &dev_attr_osdname.attr, ++ &dev_attr_systemid.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(osd_uld); + + static struct class osd_uld_class = { + .owner = THIS_MODULE, + .name = "scsi_osd", +- .dev_attrs = osd_uld_attrs, ++ .dev_groups = osd_uld_groups, + }; + + /* --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -132,8 +132,8 @@ static const char *sd_cache_types[] = { @@ -940,15 +1812,14 @@ Subject: meta-patch of all of the dev_attr conversions { 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 +@@ -212,10 +222,19 @@ sd_store_manage_start_stop(struct device return count; } +static DEVICE_ATTR_RW(manage_start_stop); + +static ssize_t -+sd_show_allow_restart(struct device *dev, struct device_attribute *attr, -+ char *buf) ++allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct scsi_disk *sdkp = to_scsi_disk(dev); + @@ -963,7 +1834,7 @@ Subject: meta-patch of all of the dev_attr conversions { 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 +@@ -230,47 +249,30 @@ sd_store_allow_restart(struct device *de return count; } @@ -979,7 +1850,7 @@ Subject: meta-patch of all of the dev_attr conversions return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); } -+static DEVICE_ATTR_RW(cache_type) ++static DEVICE_ATTR_RW(cache_type); static ssize_t -sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) @@ -1018,7 +1889,7 @@ Subject: meta-patch of all of the dev_attr conversions { struct scsi_disk *sdkp = to_scsi_disk(dev); -@@ -278,8 +281,8 @@ sd_show_protection_type(struct device *d +@@ -278,8 +280,8 @@ sd_show_protection_type(struct device *d } static ssize_t @@ -1029,7 +1900,7 @@ Subject: meta-patch of all of the dev_attr conversions { struct scsi_disk *sdkp = to_scsi_disk(dev); unsigned int val; -@@ -298,10 +301,11 @@ sd_store_protection_type(struct device * +@@ -298,10 +300,11 @@ sd_store_protection_type(struct device * return count; } @@ -1043,7 +1914,7 @@ Subject: meta-patch of all of the dev_attr conversions { 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 +@@ -320,24 +323,26 @@ sd_show_protection_mode(struct device *d return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif); } @@ -1074,7 +1945,7 @@ Subject: meta-patch of all of the dev_attr conversions static const char *lbp_mode[] = { [SD_LBP_FULL] = "full", -@@ -349,8 +355,8 @@ static const char *lbp_mode[] = { +@@ -349,8 +354,8 @@ static const char *lbp_mode[] = { }; static ssize_t @@ -1085,7 +1956,7 @@ Subject: meta-patch of all of the dev_attr conversions { struct scsi_disk *sdkp = to_scsi_disk(dev); -@@ -358,8 +364,8 @@ sd_show_provisioning_mode(struct device +@@ -358,8 +363,8 @@ sd_show_provisioning_mode(struct device } static ssize_t @@ -1096,7 +1967,7 @@ Subject: meta-patch of all of the dev_attr conversions { struct scsi_disk *sdkp = to_scsi_disk(dev); struct scsi_device *sdp = sdkp->device; -@@ -385,10 +391,11 @@ sd_store_provisioning_mode(struct device +@@ -385,10 +390,11 @@ sd_store_provisioning_mode(struct device return count; } @@ -1110,7 +1981,7 @@ Subject: meta-patch of all of the dev_attr conversions { struct scsi_disk *sdkp = to_scsi_disk(dev); -@@ -396,9 +403,9 @@ sd_show_max_medium_access_timeouts(struc +@@ -396,9 +402,9 @@ sd_show_max_medium_access_timeouts(struc } static ssize_t @@ -1123,7 +1994,7 @@ Subject: meta-patch of all of the dev_attr conversions { struct scsi_disk *sdkp = to_scsi_disk(dev); int err; -@@ -410,10 +417,11 @@ sd_store_max_medium_access_timeouts(stru +@@ -410,10 +416,11 @@ sd_store_max_medium_access_timeouts(stru return err ? err : count; } @@ -1132,23 +2003,23 @@ Subject: meta-patch of all of the dev_attr conversions static ssize_t -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) ++max_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 +@@ -421,8 +428,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) ++max_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 +@@ -451,35 +458,29 @@ sd_store_write_same_blocks(struct device return count; } @@ -1200,6 +2071,84 @@ Subject: meta-patch of all of the dev_attr conversions }; static const struct dev_pm_ops sd_pm_ops = { +--- a/drivers/scsi/st.c ++++ b/drivers/scsi/st.c +@@ -82,7 +82,7 @@ static int try_rdio = 1; + static int try_wdio = 1; + + static struct class st_sysfs_class; +-static struct device_attribute st_dev_attrs[]; ++static const struct attribute_group *st_dev_groups[]; + + MODULE_AUTHOR("Kai Makisara"); + MODULE_DESCRIPTION("SCSI tape (st) driver"); +@@ -4274,7 +4274,7 @@ static void scsi_tape_release(struct kre + + static struct class st_sysfs_class = { + .name = "scsi_tape", +- .dev_attrs = st_dev_attrs, ++ .dev_groups = st_dev_groups, + }; + + static int __init init_st(void) +@@ -4408,6 +4408,7 @@ defined_show(struct device *dev, struct + l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); + return l; + } ++static DEVICE_ATTR_RO(defined); + + static ssize_t + default_blksize_show(struct device *dev, struct device_attribute *attr, +@@ -4419,7 +4420,7 @@ default_blksize_show(struct device *dev, + l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); + return l; + } +- ++static DEVICE_ATTR_RO(default_blksize); + + static ssize_t + default_density_show(struct device *dev, struct device_attribute *attr, +@@ -4433,6 +4434,7 @@ default_density_show(struct device *dev, + l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density); + return l; + } ++static DEVICE_ATTR_RO(default_density); + + static ssize_t + default_compression_show(struct device *dev, struct device_attribute *attr, +@@ -4444,6 +4446,7 @@ default_compression_show(struct device * + l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); + return l; + } ++static DEVICE_ATTR_RO(default_compression); + + static ssize_t + options_show(struct device *dev, struct device_attribute *attr, char *buf) +@@ -4472,15 +4475,17 @@ options_show(struct device *dev, struct + l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options); + return l; + } ++static DEVICE_ATTR_RO(options); + +-static struct device_attribute st_dev_attrs[] = { +- __ATTR_RO(defined), +- __ATTR_RO(default_blksize), +- __ATTR_RO(default_density), +- __ATTR_RO(default_compression), +- __ATTR_RO(options), +- __ATTR_NULL, ++static struct attribute *st_dev_attrs[] = { ++ &dev_attr_defined.attr, ++ &dev_attr_default_blksize.attr, ++ &dev_attr_default_density.attr, ++ &dev_attr_default_compression.attr, ++ &dev_attr_options.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(st_dev); + + /* The following functions may be useful for a larger audience. */ + static int sgl_map_user_pages(struct st_buffer *STbp, --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -262,7 +262,7 @@ static int resize_async_buffer(struct co @@ -1489,14 +2438,90 @@ Subject: meta-patch of all of the dev_attr conversions } --- 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, +@@ -89,7 +89,7 @@ static inline void lcd_unregister_fb(str + } + #endif /* CONFIG_FB */ + +-static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr, ++static ssize_t lcd_power_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + int rc; +@@ -105,7 +105,7 @@ static ssize_t lcd_show_power(struct dev + return rc; + } + +-static ssize_t lcd_store_power(struct device *dev, ++static ssize_t lcd_power_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + int rc; +@@ -128,8 +128,9 @@ static ssize_t lcd_store_power(struct de + + return rc; + } ++static DEVICE_ATTR_RW(lcd_power); + +-static ssize_t lcd_show_contrast(struct device *dev, ++static ssize_t contrast_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + int rc = -ENXIO; +@@ -143,7 +144,7 @@ static ssize_t lcd_show_contrast(struct + return rc; + } + +-static ssize_t lcd_store_contrast(struct device *dev, ++static ssize_t contrast_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + int rc; +@@ -166,14 +167,16 @@ static ssize_t lcd_store_contrast(struct + + return rc; + } ++static DEVICE_ATTR_RW(contrast); + +-static ssize_t lcd_show_max_contrast(struct device *dev, ++static ssize_t max_contrast_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct lcd_device *ld = to_lcd_device(dev); + + return sprintf(buf, "%d\n", ld->props.max_contrast); + } ++static DEVICE_ATTR_RO(max_contrast); + + static struct class *lcd_class; + +@@ -183,12 +186,13 @@ static void lcd_device_release(struct de + kfree(ld); + } + +-static struct device_attribute lcd_device_attributes[] = { +- __ATTR(lcd_power, 0644, lcd_show_power, lcd_store_power), +- __ATTR(contrast, 0644, lcd_show_contrast, lcd_store_contrast), +- __ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL), +- __ATTR_NULL, ++static struct attribute *lcd_device_attrs[] = { ++ &dev_attr_lcd_power.attr, ++ &dev_attr_contrast.attr, ++ &dev_attr_max_contrast.attr, ++ NULL, }; +ATTRIBUTE_GROUPS(lcd_device); /** * lcd_device_register - register a new object of lcd_device class. +@@ -344,7 +348,7 @@ static int __init lcd_class_init(void) + return PTR_ERR(lcd_class); + } + +- lcd_class->dev_attrs = lcd_device_attributes; ++ lcd_class->dev_groups = lcd_device_groups; + return 0; + } + --- a/drivers/video/output.c +++ b/drivers/video/output.c @@ -32,8 +32,8 @@ MODULE_DESCRIPTION("Display Output Switc @@ -1960,6 +2985,52 @@ Subject: meta-patch of all of the dev_attr conversions .dev_uevent = netdev_uevent, .ns_type = &net_ns_type_operations, .namespace = net_namespace, +--- a/net/ieee802154/wpan-class.c ++++ b/net/ieee802154/wpan-class.c +@@ -36,7 +36,8 @@ static ssize_t name ## _show(struct devi + ret = snprintf(buf, PAGE_SIZE, format_string "\n", args); \ + mutex_unlock(&phy->pib_lock); \ + return ret; \ +-} ++} \ ++static DEVICE_ATTR_RO(name); + + #define MASTER_SHOW(field, format_string) \ + MASTER_SHOW_COMPLEX(field, format_string, phy->field) +@@ -66,15 +67,17 @@ static ssize_t channels_supported_show(s + mutex_unlock(&phy->pib_lock); + return len; + } ++static DEVICE_ATTR_RO(channels_supported); + +-static struct device_attribute pmib_attrs[] = { +- __ATTR_RO(current_channel), +- __ATTR_RO(current_page), +- __ATTR_RO(channels_supported), +- __ATTR_RO(transmit_power), +- __ATTR_RO(cca_mode), +- {}, ++static struct attribute *pmib_attrs[] = { ++ &dev_attr_current_channel.attr, ++ &dev_attr_current_page.attr, ++ &dev_attr_channels_supported.attr, ++ &dev_attr_transmit_power.attr, ++ &dev_attr_cca_mode.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(pmib); + + static void wpan_phy_release(struct device *d) + { +@@ -85,7 +88,7 @@ static void wpan_phy_release(struct devi + static struct class wpan_phy_class = { + .name = "ieee802154", + .dev_release = wpan_phy_release, +- .dev_attrs = pmib_attrs, ++ .dev_groups = pmib_groups, + }; + + static DEFINE_MUTEX(wpan_phy_mutex); --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -576,14 +576,14 @@ void rfkill_set_states(struct rfkill *rf @@ -1999,8 +3070,8 @@ Subject: meta-patch of all of the dev_attr conversions -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) ++static ssize_t index_show(struct device *dev, struct device_attribute *attr, ++ char *buf) { struct rfkill *rfkill = to_rfkill(dev); @@ -2139,3 +3210,58 @@ Subject: meta-patch of all of the dev_attr conversions .dev_uevent = rfkill_dev_uevent, .suspend = rfkill_suspend, .resume = rfkill_resume, +--- a/net/wireless/sysfs.c ++++ b/net/wireless/sysfs.c +@@ -30,7 +30,8 @@ static ssize_t name ## _show(struct devi + char *buf) \ + { \ + return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \ +-} ++} \ ++static DEVICE_ATTR_RO(name) + + SHOW_FMT(index, "%d", wiphy_idx); + SHOW_FMT(macaddress, "%pM", wiphy.perm_addr); +@@ -42,7 +43,7 @@ static ssize_t name_show(struct device * + struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy; + return sprintf(buf, "%s\n", dev_name(&wiphy->dev)); + } +- ++static DEVICE_ATTR_RO(name); + + static ssize_t addresses_show(struct device *dev, + struct device_attribute *attr, +@@ -60,15 +61,17 @@ static ssize_t addresses_show(struct dev + + return buf - start; + } ++static DEVICE_ATTR_RO(addresses); + +-static struct device_attribute ieee80211_dev_attrs[] = { +- __ATTR_RO(index), +- __ATTR_RO(macaddress), +- __ATTR_RO(address_mask), +- __ATTR_RO(addresses), +- __ATTR_RO(name), +- {} ++static struct attribute *ieee80211_attrs[] = { ++ &dev_attr_index.attr, ++ &dev_attr_macaddress.attr, ++ &dev_attr_address_mask.attr, ++ &dev_attr_addresses.attr, ++ &dev_attr_name.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(ieee80211); + + static void wiphy_dev_release(struct device *dev) + { +@@ -144,7 +147,7 @@ struct class ieee80211_class = { + .name = "ieee80211", + .owner = THIS_MODULE, + .dev_release = wiphy_dev_release, +- .dev_attrs = ieee80211_dev_attrs, ++ .dev_groups = ieee80211_groups, + .dev_uevent = wiphy_uevent, + .suspend = wiphy_suspend, + .resume = wiphy_resume, |
