aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--d01.patch1125
-rw-r--r--i2o-convert-bus-code-to-use-dev_groups.patch (renamed from p17.patch)0
-rw-r--r--ide-convert-bus-code-to-use-dev_groups.patch (renamed from i01.patch)0
-rw-r--r--input-gameport-convert-bus-code-to-use-dev_groups.patch (renamed from p12.patch)0
-rw-r--r--input-serio-remove-bus-usage-of-dev_attrs.patch (renamed from s02.patch)0
-rw-r--r--input-serio-use-device_attr_ro.patch (renamed from s01.patch)0
-rw-r--r--ipack-convert-bus-code-to-use-dev_groups.patch (renamed from i02.patch)0
-rw-r--r--memstick-convert-bus-code-to-use-dev_groups.patch (renamed from p16.patch)0
-rw-r--r--series27
-rw-r--r--spi-convert-bus-code-to-use-dev_groups.patch (renamed from p13.patch)0
-rw-r--r--tifm-convert-bus-code-to-use-dev_groups.patch (renamed from p15.patch)0
-rw-r--r--uwb-clean-up-attribute-use-by-using-attribute_groups.patch (renamed from p30.patch)11
-rw-r--r--virtio-convert-bus-code-to-use-dev_groups.patch (renamed from p14.patch)0
13 files changed, 1152 insertions, 11 deletions
diff --git a/d01.patch b/d01.patch
new file mode 100644
index 00000000000000..47df328d435171
--- /dev/null
+++ b/d01.patch
@@ -0,0 +1,1125 @@
+---
+ drivers/hid/hid-core.c | 24 +-
+ drivers/infiniband/hw/nes/nes.c | 80 +++-----
+ drivers/pci/pci-driver.c | 8
+ drivers/scsi/aic94xx/aic94xx_init.c | 4
+ drivers/scsi/megaraid/megaraid_sas_base.c | 32 +--
+ drivers/scsi/osst.c | 4
+ drivers/scsi/scsi_debug.c | 270 ++++++++++++------------------
+ drivers/scsi/st.c | 74 ++------
+ drivers/tty/hvc/hvcs.c | 7
+ 9 files changed, 190 insertions(+), 313 deletions(-)
+
+--- a/drivers/hid/hid-core.c
++++ b/drivers/hid/hid-core.c
+@@ -1888,7 +1888,7 @@ struct hid_dynid {
+ * Adds a new dynamic hid device ID to this driver,
+ * and causes the driver to probe for all devices again.
+ */
+-static ssize_t store_new_id(struct device_driver *drv, const char *buf,
++static ssize_t new_id_store(struct device_driver *drv, const char *buf,
+ size_t count)
+ {
+ struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
+@@ -1920,7 +1920,13 @@ static ssize_t store_new_id(struct devic
+
+ return ret ? : count;
+ }
+-static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
++static DRIVER_ATTR_WO(new_id);
++
++static struct attribute *hid_drv_attrs[] = {
++ &driver_attr_new_id.attr,
++ NULL,
++};
++ATTRIBUTE_GROUPS(hid_drv);
+
+ static void hid_free_dynids(struct hid_driver *hdrv)
+ {
+@@ -2080,6 +2086,7 @@ static int hid_uevent(struct device *dev
+ static struct bus_type hid_bus_type = {
+ .name = "hid",
+ .dev_groups = hid_dev_groups,
++ .drv_groups = hid_drv_groups,
+ .match = hid_bus_match,
+ .probe = hid_device_probe,
+ .remove = hid_device_remove,
+@@ -2526,8 +2533,6 @@ EXPORT_SYMBOL_GPL(hid_destroy_device);
+ int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
+ const char *mod_name)
+ {
+- int ret;
+-
+ hdrv->driver.name = hdrv->name;
+ hdrv->driver.bus = &hid_bus_type;
+ hdrv->driver.owner = owner;
+@@ -2536,21 +2541,12 @@ int __hid_register_driver(struct hid_dri
+ INIT_LIST_HEAD(&hdrv->dyn_list);
+ spin_lock_init(&hdrv->dyn_lock);
+
+- ret = driver_register(&hdrv->driver);
+- if (ret)
+- return ret;
+-
+- ret = driver_create_file(&hdrv->driver, &driver_attr_new_id);
+- if (ret)
+- driver_unregister(&hdrv->driver);
+-
+- return ret;
++ return driver_register(&hdrv->driver);
+ }
+ EXPORT_SYMBOL_GPL(__hid_register_driver);
+
+ void hid_unregister_driver(struct hid_driver *hdrv)
+ {
+- driver_remove_file(&hdrv->driver, &driver_attr_new_id);
+ driver_unregister(&hdrv->driver);
+ hid_free_dynids(hdrv);
+ }
+--- a/drivers/infiniband/hw/nes/nes.c
++++ b/drivers/infiniband/hw/nes/nes.c
+@@ -815,7 +815,7 @@ static struct pci_driver nes_pci_driver
+ .remove = nes_remove,
+ };
+
+-static ssize_t nes_show_adapter(struct device_driver *ddp, char *buf)
++static ssize_t adapter_show(struct device_driver *ddp, char *buf)
+ {
+ unsigned int devfn = 0xffffffff;
+ unsigned char bus_number = 0xff;
+@@ -834,7 +834,7 @@ static ssize_t nes_show_adapter(struct d
+ return snprintf(buf, PAGE_SIZE, "%x:%x\n", bus_number, devfn);
+ }
+
+-static ssize_t nes_store_adapter(struct device_driver *ddp,
++static ssize_t adapter_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -843,7 +843,7 @@ static ssize_t nes_store_adapter(struct
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_ee_cmd(struct device_driver *ddp, char *buf)
++static ssize_t eeprom_cmd_show(struct device_driver *ddp, char *buf)
+ {
+ u32 eeprom_cmd = 0xdead;
+ u32 i = 0;
+@@ -859,7 +859,7 @@ static ssize_t nes_show_ee_cmd(struct de
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", eeprom_cmd);
+ }
+
+-static ssize_t nes_store_ee_cmd(struct device_driver *ddp,
++static ssize_t eeprom_cmd_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -880,7 +880,7 @@ static ssize_t nes_store_ee_cmd(struct d
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_ee_data(struct device_driver *ddp, char *buf)
++static ssize_t eeprom_data_show(struct device_driver *ddp, char *buf)
+ {
+ u32 eeprom_data = 0xdead;
+ u32 i = 0;
+@@ -897,7 +897,7 @@ static ssize_t nes_show_ee_data(struct d
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", eeprom_data);
+ }
+
+-static ssize_t nes_store_ee_data(struct device_driver *ddp,
++static ssize_t eeprom_data_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -918,7 +918,7 @@ static ssize_t nes_store_ee_data(struct
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_flash_cmd(struct device_driver *ddp, char *buf)
++static ssize_t flash_cmd_show(struct device_driver *ddp, char *buf)
+ {
+ u32 flash_cmd = 0xdead;
+ u32 i = 0;
+@@ -935,7 +935,7 @@ static ssize_t nes_show_flash_cmd(struct
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", flash_cmd);
+ }
+
+-static ssize_t nes_store_flash_cmd(struct device_driver *ddp,
++static ssize_t flash_cmd_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -956,7 +956,7 @@ static ssize_t nes_store_flash_cmd(struc
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_flash_data(struct device_driver *ddp, char *buf)
++static ssize_t flash_data_show(struct device_driver *ddp, char *buf)
+ {
+ u32 flash_data = 0xdead;
+ u32 i = 0;
+@@ -973,7 +973,7 @@ static ssize_t nes_show_flash_data(struc
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", flash_data);
+ }
+
+-static ssize_t nes_store_flash_data(struct device_driver *ddp,
++static ssize_t flash_data_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -994,12 +994,12 @@ static ssize_t nes_store_flash_data(stru
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_nonidx_addr(struct device_driver *ddp, char *buf)
++static ssize_t nonidx_addr_show(struct device_driver *ddp, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", sysfs_nonidx_addr);
+ }
+
+-static ssize_t nes_store_nonidx_addr(struct device_driver *ddp,
++static ssize_t nonidx_addr_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -1010,7 +1010,7 @@ static ssize_t nes_store_nonidx_addr(str
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_nonidx_data(struct device_driver *ddp, char *buf)
++static ssize_t nonidx_data_show(struct device_driver *ddp, char *buf)
+ {
+ u32 nonidx_data = 0xdead;
+ u32 i = 0;
+@@ -1027,7 +1027,7 @@ static ssize_t nes_show_nonidx_data(stru
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", nonidx_data);
+ }
+
+-static ssize_t nes_store_nonidx_data(struct device_driver *ddp,
++static ssize_t nonidx_data_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -1048,12 +1048,12 @@ static ssize_t nes_store_nonidx_data(str
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_idx_addr(struct device_driver *ddp, char *buf)
++static ssize_t idx_addr_show(struct device_driver *ddp, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", sysfs_idx_addr);
+ }
+
+-static ssize_t nes_store_idx_addr(struct device_driver *ddp,
++static ssize_t idx_addr_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -1064,7 +1064,7 @@ static ssize_t nes_store_idx_addr(struct
+ return strnlen(buf, count);
+ }
+
+-static ssize_t nes_show_idx_data(struct device_driver *ddp, char *buf)
++static ssize_t idx_data_show(struct device_driver *ddp, char *buf)
+ {
+ u32 idx_data = 0xdead;
+ u32 i = 0;
+@@ -1081,7 +1081,7 @@ static ssize_t nes_show_idx_data(struct
+ return snprintf(buf, PAGE_SIZE, "0x%x\n", idx_data);
+ }
+
+-static ssize_t nes_store_idx_data(struct device_driver *ddp,
++static ssize_t idx_data_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+ {
+ char *p = (char *)buf;
+@@ -1102,11 +1102,7 @@ static ssize_t nes_store_idx_data(struct
+ return strnlen(buf, count);
+ }
+
+-
+-/**
+- * nes_show_wqm_quanta
+- */
+-static ssize_t nes_show_wqm_quanta(struct device_driver *ddp, char *buf)
++static ssize_t wqm_quanta_show(struct device_driver *ddp, char *buf)
+ {
+ u32 wqm_quanta_value = 0xdead;
+ u32 i = 0;
+@@ -1123,12 +1119,8 @@ static ssize_t nes_show_wqm_quanta(struc
+ return snprintf(buf, PAGE_SIZE, "0x%X\n", wqm_quanta_value);
+ }
+
+-
+-/**
+- * nes_store_wqm_quanta
+- */
+-static ssize_t nes_store_wqm_quanta(struct device_driver *ddp,
+- const char *buf, size_t count)
++static ssize_t wqm_quanta_store(struct device_driver *ddp, const char *buf,
++ size_t count)
+ {
+ unsigned long wqm_quanta_value;
+ u32 wqm_config1;
+@@ -1153,26 +1145,16 @@ static ssize_t nes_store_wqm_quanta(stru
+ return strnlen(buf, count);
+ }
+
+-static DRIVER_ATTR(adapter, S_IRUSR | S_IWUSR,
+- nes_show_adapter, nes_store_adapter);
+-static DRIVER_ATTR(eeprom_cmd, S_IRUSR | S_IWUSR,
+- nes_show_ee_cmd, nes_store_ee_cmd);
+-static DRIVER_ATTR(eeprom_data, S_IRUSR | S_IWUSR,
+- nes_show_ee_data, nes_store_ee_data);
+-static DRIVER_ATTR(flash_cmd, S_IRUSR | S_IWUSR,
+- nes_show_flash_cmd, nes_store_flash_cmd);
+-static DRIVER_ATTR(flash_data, S_IRUSR | S_IWUSR,
+- nes_show_flash_data, nes_store_flash_data);
+-static DRIVER_ATTR(nonidx_addr, S_IRUSR | S_IWUSR,
+- nes_show_nonidx_addr, nes_store_nonidx_addr);
+-static DRIVER_ATTR(nonidx_data, S_IRUSR | S_IWUSR,
+- nes_show_nonidx_data, nes_store_nonidx_data);
+-static DRIVER_ATTR(idx_addr, S_IRUSR | S_IWUSR,
+- nes_show_idx_addr, nes_store_idx_addr);
+-static DRIVER_ATTR(idx_data, S_IRUSR | S_IWUSR,
+- nes_show_idx_data, nes_store_idx_data);
+-static DRIVER_ATTR(wqm_quanta, S_IRUSR | S_IWUSR,
+- nes_show_wqm_quanta, nes_store_wqm_quanta);
++static DRIVER_ATTR_RW(adapter);
++static DRIVER_ATTR_RW(eeprom_cmd);
++static DRIVER_ATTR_RW(eeprom_data);
++static DRIVER_ATTR_RW(flash_cmd);
++static DRIVER_ATTR_RW(flash_data);
++static DRIVER_ATTR_RW(nonidx_addr);
++static DRIVER_ATTR_RW(nonidx_data);
++static DRIVER_ATTR_RW(idx_addr);
++static DRIVER_ATTR_RW(idx_data);
++static DRIVER_ATTR_RW(wqm_quanta);
+
+ static int nes_create_driver_sysfs(struct pci_driver *drv)
+ {
+--- a/drivers/pci/pci-driver.c
++++ b/drivers/pci/pci-driver.c
+@@ -98,7 +98,7 @@ static void pci_free_dynids(struct pci_d
+ * Allow PCI IDs to be added to an existing driver via sysfs.
+ */
+ static ssize_t
+-store_new_id(struct device_driver *driver, const char *buf, size_t count)
++new_id_store(struct device_driver *driver, const char *buf, size_t count)
+ {
+ struct pci_driver *pdrv = to_pci_driver(driver);
+ const struct pci_device_id *ids = pdrv->id_table;
+@@ -135,7 +135,7 @@ store_new_id(struct device_driver *drive
+ return retval;
+ return count;
+ }
+-static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
++static DRIVER_ATTR_WO(new_id);
+
+ /**
+ * store_remove_id - remove a PCI device ID from this driver
+@@ -146,7 +146,7 @@ static DRIVER_ATTR(new_id, S_IWUSR, NULL
+ * Removes a dynamic pci device ID to this driver.
+ */
+ static ssize_t
+-store_remove_id(struct device_driver *driver, const char *buf, size_t count)
++remove_id_store(struct device_driver *driver, const char *buf, size_t count)
+ {
+ struct pci_dynid *dynid, *n;
+ struct pci_driver *pdrv = to_pci_driver(driver);
+@@ -181,7 +181,7 @@ store_remove_id(struct device_driver *dr
+ return retval;
+ return count;
+ }
+-static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id);
++static DRIVER_ATTR_WO(remove_id);
+
+ static struct attribute *pci_drv_attrs[] = {
+ &driver_attr_new_id.attr,
+--- a/drivers/scsi/aic94xx/aic94xx_init.c
++++ b/drivers/scsi/aic94xx/aic94xx_init.c
+@@ -973,11 +973,11 @@ static int asd_scan_finished(struct Scsi
+ return 1;
+ }
+
+-static ssize_t asd_version_show(struct device_driver *driver, char *buf)
++static ssize_t version_show(struct device_driver *driver, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "%s\n", ASD_DRIVER_VERSION);
+ }
+-static DRIVER_ATTR(version, S_IRUGO, asd_version_show, NULL);
++static DRIVER_ATTR_RO(version);
+
+ static int asd_create_driver_attrs(struct device_driver *driver)
+ {
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c
+@@ -5374,50 +5374,43 @@ static struct pci_driver megasas_pci_dri
+ /*
+ * Sysfs driver attributes
+ */
+-static ssize_t megasas_sysfs_show_version(struct device_driver *dd, char *buf)
++static ssize_t version_show(struct device_driver *dd, char *buf)
+ {
+ return snprintf(buf, strlen(MEGASAS_VERSION) + 2, "%s\n",
+ MEGASAS_VERSION);
+ }
+
+-static DRIVER_ATTR(version, S_IRUGO, megasas_sysfs_show_version, NULL);
++static DRIVER_ATTR_RO(version);
+
+-static ssize_t
+-megasas_sysfs_show_release_date(struct device_driver *dd, char *buf)
++static ssize_t release_date_show(struct device_driver *dd, char *buf)
+ {
+ return snprintf(buf, strlen(MEGASAS_RELDATE) + 2, "%s\n",
+ MEGASAS_RELDATE);
+ }
+
+-static DRIVER_ATTR(release_date, S_IRUGO, megasas_sysfs_show_release_date,
+- NULL);
++static DRIVER_ATTR_RO(release_date);
+
+-static ssize_t
+-megasas_sysfs_show_support_poll_for_event(struct device_driver *dd, char *buf)
++static ssize_t support_poll_for_event_show(struct device_driver *dd, char *buf)
+ {
+ return sprintf(buf, "%u\n", support_poll_for_event);
+ }
+
+-static DRIVER_ATTR(support_poll_for_event, S_IRUGO,
+- megasas_sysfs_show_support_poll_for_event, NULL);
++static DRIVER_ATTR_RO(support_poll_for_event);
+
+- static ssize_t
+-megasas_sysfs_show_support_device_change(struct device_driver *dd, char *buf)
++static ssize_t support_device_change_show(struct device_driver *dd, char *buf)
+ {
+ return sprintf(buf, "%u\n", support_device_change);
+ }
+
+-static DRIVER_ATTR(support_device_change, S_IRUGO,
+- megasas_sysfs_show_support_device_change, NULL);
++static DRIVER_ATTR_RO(support_device_change);
+
+-static ssize_t
+-megasas_sysfs_show_dbg_lvl(struct device_driver *dd, char *buf)
++static ssize_t dbg_lvl_show(struct device_driver *dd, char *buf)
+ {
+ return sprintf(buf, "%u\n", megasas_dbg_lvl);
+ }
+
+-static ssize_t
+-megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf, size_t count)
++static ssize_t dbg_lvl_store(struct device_driver *dd, const char *buf,
++ size_t count)
+ {
+ int retval = count;
+ if(sscanf(buf,"%u",&megasas_dbg_lvl)<1){
+@@ -5427,8 +5420,7 @@ megasas_sysfs_set_dbg_lvl(struct device_
+ return retval;
+ }
+
+-static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUSR, megasas_sysfs_show_dbg_lvl,
+- megasas_sysfs_set_dbg_lvl);
++static DRIVER_ATTR_RW(dbg_lvl);
+
+ static void
+ megasas_aen_polling(struct work_struct *work)
+--- a/drivers/scsi/osst.c
++++ b/drivers/scsi/osst.c
+@@ -5663,12 +5663,12 @@ static struct osst_support_data support_
+ * sysfs support for osst driver parameter information
+ */
+
+-static ssize_t osst_version_show(struct device_driver *ddd, char *buf)
++static ssize_t version_show(struct device_driver *ddd, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "%s\n", osst_version);
+ }
+
+-static DRIVER_ATTR(version, S_IRUGO, osst_version_show, NULL);
++static DRIVER_ATTR_RO(version);
+
+ static int osst_create_sysfs_files(struct device_driver *sysfs)
+ {
+--- a/drivers/scsi/scsi_debug.c
++++ b/drivers/scsi/scsi_debug.c
+@@ -276,10 +276,12 @@ static DEFINE_RWLOCK(atomic_rw);
+ static char sdebug_proc_name[] = "scsi_debug";
+
+ static struct bus_type pseudo_lld_bus;
++static const struct attribute_group *sdebug_drv_groups[];
+
+ static struct device_driver sdebug_driverfs_driver = {
+ .name = sdebug_proc_name,
+ .bus = &pseudo_lld_bus,
++ .groups = sdebug_drv_groups,
+ };
+
+ static const int check_condition_result =
+@@ -2864,13 +2866,13 @@ static int scsi_debug_show_info(struct s
+ return 0;
+ }
+
+-static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf)
++static ssize_t delay_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_delay);
+ }
+
+-static ssize_t sdebug_delay_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t delay_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int delay;
+ char work[20];
+@@ -2883,16 +2885,15 @@ static ssize_t sdebug_delay_store(struct
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_show,
+- sdebug_delay_store);
++static DRIVER_ATTR_RW(delay);
+
+-static ssize_t sdebug_opts_show(struct device_driver * ddp, char * buf)
++static ssize_t opts_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "0x%x\n", scsi_debug_opts);
+ }
+
+-static ssize_t sdebug_opts_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t opts_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int opts;
+ char work[20];
+@@ -2912,15 +2913,14 @@ opts_done:
+ scsi_debug_cmnd_count = 0;
+ return count;
+ }
+-DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_show,
+- sdebug_opts_store);
++static DRIVER_ATTR_RW(opts);
+
+-static ssize_t sdebug_ptype_show(struct device_driver * ddp, char * buf)
++static ssize_t ptype_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_ptype);
+ }
+-static ssize_t sdebug_ptype_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t ptype_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -2930,14 +2930,14 @@ static ssize_t sdebug_ptype_store(struct
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(ptype, S_IRUGO | S_IWUSR, sdebug_ptype_show, sdebug_ptype_store);
++static DRIVER_ATTR_RW(ptype);
+
+-static ssize_t sdebug_dsense_show(struct device_driver * ddp, char * buf)
++static ssize_t dsense_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_dsense);
+ }
+-static ssize_t sdebug_dsense_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t dsense_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -2947,15 +2947,14 @@ static ssize_t sdebug_dsense_store(struc
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(dsense, S_IRUGO | S_IWUSR, sdebug_dsense_show,
+- sdebug_dsense_store);
++static DRIVER_ATTR_RW(dsense);
+
+-static ssize_t sdebug_fake_rw_show(struct device_driver * ddp, char * buf)
++static ssize_t fake_rw_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_fake_rw);
+ }
+-static ssize_t sdebug_fake_rw_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t fake_rw_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -2965,15 +2964,14 @@ static ssize_t sdebug_fake_rw_store(stru
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(fake_rw, S_IRUGO | S_IWUSR, sdebug_fake_rw_show,
+- sdebug_fake_rw_store);
++static DRIVER_ATTR_RW(fake_rw);
+
+-static ssize_t sdebug_no_lun_0_show(struct device_driver * ddp, char * buf)
++static ssize_t no_lun_0_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_no_lun_0);
+ }
+-static ssize_t sdebug_no_lun_0_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t no_lun_0_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -2983,15 +2981,14 @@ static ssize_t sdebug_no_lun_0_store(str
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(no_lun_0, S_IRUGO | S_IWUSR, sdebug_no_lun_0_show,
+- sdebug_no_lun_0_store);
++static DRIVER_ATTR_RW(no_lun_0);
+
+-static ssize_t sdebug_num_tgts_show(struct device_driver * ddp, char * buf)
++static ssize_t num_tgts_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_tgts);
+ }
+-static ssize_t sdebug_num_tgts_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t num_tgts_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -3002,27 +2999,26 @@ static ssize_t sdebug_num_tgts_store(str
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(num_tgts, S_IRUGO | S_IWUSR, sdebug_num_tgts_show,
+- sdebug_num_tgts_store);
++static DRIVER_ATTR_RW(num_tgts);
+
+-static ssize_t sdebug_dev_size_mb_show(struct device_driver * ddp, char * buf)
++static ssize_t dev_size_mb_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_dev_size_mb);
+ }
+-DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_show, NULL);
++static DRIVER_ATTR_RO(dev_size_mb);
+
+-static ssize_t sdebug_num_parts_show(struct device_driver * ddp, char * buf)
++static ssize_t num_parts_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_parts);
+ }
+-DRIVER_ATTR(num_parts, S_IRUGO, sdebug_num_parts_show, NULL);
++static DRIVER_ATTR_RO(num_parts);
+
+-static ssize_t sdebug_every_nth_show(struct device_driver * ddp, char * buf)
++static ssize_t every_nth_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_every_nth);
+ }
+-static ssize_t sdebug_every_nth_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t every_nth_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int nth;
+
+@@ -3033,15 +3029,14 @@ static ssize_t sdebug_every_nth_store(st
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(every_nth, S_IRUGO | S_IWUSR, sdebug_every_nth_show,
+- sdebug_every_nth_store);
++static DRIVER_ATTR_RW(every_nth);
+
+-static ssize_t sdebug_max_luns_show(struct device_driver * ddp, char * buf)
++static ssize_t max_luns_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_max_luns);
+ }
+-static ssize_t sdebug_max_luns_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t max_luns_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -3052,15 +3047,14 @@ static ssize_t sdebug_max_luns_store(str
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(max_luns, S_IRUGO | S_IWUSR, sdebug_max_luns_show,
+- sdebug_max_luns_store);
++static DRIVER_ATTR_RW(max_luns);
+
+-static ssize_t sdebug_max_queue_show(struct device_driver * ddp, char * buf)
++static ssize_t max_queue_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_max_queue);
+ }
+-static ssize_t sdebug_max_queue_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t max_queue_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -3071,27 +3065,26 @@ static ssize_t sdebug_max_queue_store(st
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(max_queue, S_IRUGO | S_IWUSR, sdebug_max_queue_show,
+- sdebug_max_queue_store);
++static DRIVER_ATTR_RW(max_queue);
+
+-static ssize_t sdebug_no_uld_show(struct device_driver * ddp, char * buf)
++static ssize_t no_uld_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_no_uld);
+ }
+-DRIVER_ATTR(no_uld, S_IRUGO, sdebug_no_uld_show, NULL);
++static DRIVER_ATTR_RO(no_uld);
+
+-static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf)
++static ssize_t scsi_level_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_scsi_level);
+ }
+-DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_show, NULL);
++static DRIVER_ATTR_RO(scsi_level);
+
+-static ssize_t sdebug_virtual_gb_show(struct device_driver * ddp, char * buf)
++static ssize_t virtual_gb_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_virtual_gb);
+ }
+-static ssize_t sdebug_virtual_gb_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t virtual_gb_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int n;
+
+@@ -3104,16 +3097,15 @@ static ssize_t sdebug_virtual_gb_store(s
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(virtual_gb, S_IRUGO | S_IWUSR, sdebug_virtual_gb_show,
+- sdebug_virtual_gb_store);
++static DRIVER_ATTR_RW(virtual_gb);
+
+-static ssize_t sdebug_add_host_show(struct device_driver * ddp, char * buf)
++static ssize_t add_host_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_add_host);
+ }
+
+-static ssize_t sdebug_add_host_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t add_host_store(struct device_driver * ddp, const char * buf,
++ size_t count)
+ {
+ int delta_hosts;
+
+@@ -3130,16 +3122,14 @@ static ssize_t sdebug_add_host_store(str
+ }
+ return count;
+ }
+-DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show,
+- sdebug_add_host_store);
++static DRIVER_ATTR_RW(add_host);
+
+-static ssize_t sdebug_vpd_use_hostno_show(struct device_driver * ddp,
+- char * buf)
++static ssize_t vpd_use_hostno_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_vpd_use_hostno);
+ }
+-static ssize_t sdebug_vpd_use_hostno_store(struct device_driver * ddp,
+- const char * buf, size_t count)
++static ssize_t vpd_use_hostno_store(struct device_driver * ddp,
++ const char * buf, size_t count)
+ {
+ int n;
+
+@@ -3149,40 +3139,39 @@ static ssize_t sdebug_vpd_use_hostno_sto
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(vpd_use_hostno, S_IRUGO | S_IWUSR, sdebug_vpd_use_hostno_show,
+- sdebug_vpd_use_hostno_store);
++static DRIVER_ATTR_RW(vpd_use_hostno);
+
+-static ssize_t sdebug_sector_size_show(struct device_driver * ddp, char * buf)
++static ssize_t sector_size_show(struct device_driver * ddp, char * buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%u\n", scsi_debug_sector_size);
+ }
+-DRIVER_ATTR(sector_size, S_IRUGO, sdebug_sector_size_show, NULL);
++static DRIVER_ATTR_RO(sector_size);
+
+-static ssize_t sdebug_dix_show(struct device_driver *ddp, char *buf)
++static ssize_t dix_show(struct device_driver *ddp, char *buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_dix);
+ }
+-DRIVER_ATTR(dix, S_IRUGO, sdebug_dix_show, NULL);
++static DRIVER_ATTR_RO(dix);
+
+-static ssize_t sdebug_dif_show(struct device_driver *ddp, char *buf)
++static ssize_t dif_show(struct device_driver *ddp, char *buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_dif);
+ }
+-DRIVER_ATTR(dif, S_IRUGO, sdebug_dif_show, NULL);
++static DRIVER_ATTR_RO(dif);
+
+-static ssize_t sdebug_guard_show(struct device_driver *ddp, char *buf)
++static ssize_t guard_show(struct device_driver *ddp, char *buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_guard);
+ }
+-DRIVER_ATTR(guard, S_IRUGO, sdebug_guard_show, NULL);
++static DRIVER_ATTR_RO(guard);
+
+-static ssize_t sdebug_ato_show(struct device_driver *ddp, char *buf)
++static ssize_t ato_show(struct device_driver *ddp, char *buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_ato);
+ }
+-DRIVER_ATTR(ato, S_IRUGO, sdebug_ato_show, NULL);
++static DRIVER_ATTR_RO(ato);
+
+-static ssize_t sdebug_map_show(struct device_driver *ddp, char *buf)
++static ssize_t map_show(struct device_driver *ddp, char *buf)
+ {
+ ssize_t count;
+
+@@ -3197,15 +3186,14 @@ static ssize_t sdebug_map_show(struct de
+
+ return count;
+ }
+-DRIVER_ATTR(map, S_IRUGO, sdebug_map_show, NULL);
++static DRIVER_ATTR_RO(map);
+
+-static ssize_t sdebug_removable_show(struct device_driver *ddp,
+- char *buf)
++static ssize_t removable_show(struct device_driver *ddp, char *buf)
+ {
+ return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_removable ? 1 : 0);
+ }
+-static ssize_t sdebug_removable_store(struct device_driver *ddp,
+- const char *buf, size_t count)
++static ssize_t removable_store(struct device_driver *ddp, const char *buf,
++ size_t count)
+ {
+ int n;
+
+@@ -3215,74 +3203,42 @@ static ssize_t sdebug_removable_store(st
+ }
+ return -EINVAL;
+ }
+-DRIVER_ATTR(removable, S_IRUGO | S_IWUSR, sdebug_removable_show,
+- sdebug_removable_store);
++static DRIVER_ATTR_RW(removable);
+
+-
+-/* Note: The following function creates attribute files in the
++/* Note: The following function attribute files are located in the
+ /sys/bus/pseudo/drivers/scsi_debug directory. The advantage of these
+ files (over those found in the /sys/module/scsi_debug/parameters
+ directory) is that auxiliary actions can be triggered when an attribute
+- is changed. For example see: sdebug_add_host_store() above.
++ is changed. For example see: add_host_store() above.
+ */
+-static int do_create_driverfs_files(void)
+-{
+- int ret;
+-
+- ret = driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_dsense);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_fake_rw);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_queue);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_no_lun_0);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_no_uld);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_parts);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_ptype);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_removable);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_scsi_level);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_virtual_gb);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_vpd_use_hostno);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_sector_size);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_dix);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_dif);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_guard);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_ato);
+- ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_map);
+- return ret;
+-}
+-
+-static void do_remove_driverfs_files(void)
+-{
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_map);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_ato);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_guard);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dif);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dix);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_sector_size);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_vpd_use_hostno);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_virtual_gb);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_scsi_level);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_opts);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_ptype);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_removable);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_tgts);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_parts);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_no_uld);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_no_lun_0);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_queue);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_luns);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_fake_rw);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_every_nth);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dsense);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_delay);
+- driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host);
+-}
++static struct attribute *sdebug_drv_attrs[] = {
++ &driver_attr_add_host.attr,
++ &driver_attr_delay.attr,
++ &driver_attr_dev_size_mb.attr,
++ &driver_attr_dsense.attr,
++ &driver_attr_every_nth.attr,
++ &driver_attr_fake_rw.attr,
++ &driver_attr_max_luns.attr,
++ &driver_attr_max_queue.attr,
++ &driver_attr_no_lun_0.attr,
++ &driver_attr_no_uld.attr,
++ &driver_attr_num_parts.attr,
++ &driver_attr_num_tgts.attr,
++ &driver_attr_ptype.attr,
++ &driver_attr_opts.attr,
++ &driver_attr_removable.attr,
++ &driver_attr_scsi_level.attr,
++ &driver_attr_virtual_gb.attr,
++ &driver_attr_vpd_use_hostno.attr,
++ &driver_attr_sector_size.attr,
++ &driver_attr_dix.attr,
++ &driver_attr_dif.attr,
++ &driver_attr_guard.attr,
++ &driver_attr_ato.attr,
++ &driver_attr_map.attr,
++ NULL,
++};
++ATTRIBUTE_GROUPS(sdebug_drv);
+
+ struct device *pseudo_primary;
+
+@@ -3447,12 +3403,6 @@ static int __init scsi_debug_init(void)
+ ret);
+ goto bus_unreg;
+ }
+- ret = do_create_driverfs_files();
+- if (ret < 0) {
+- printk(KERN_WARNING "scsi_debug: driver_create_file error: %d\n",
+- ret);
+- goto del_files;
+- }
+
+ init_all_queued();
+
+@@ -3473,9 +3423,6 @@ static int __init scsi_debug_init(void)
+ }
+ return 0;
+
+-del_files:
+- do_remove_driverfs_files();
+- driver_unregister(&sdebug_driverfs_driver);
+ bus_unreg:
+ bus_unregister(&pseudo_lld_bus);
+ dev_unreg:
+@@ -3497,7 +3444,6 @@ static void __exit scsi_debug_exit(void)
+ stop_all_queued();
+ for (; k; k--)
+ sdebug_remove_adapter();
+- do_remove_driverfs_files();
+ driver_unregister(&sdebug_driverfs_driver);
+ bus_unregister(&pseudo_lld_bus);
+ root_device_unregister(pseudo_primary);
+--- a/drivers/scsi/st.c
++++ b/drivers/scsi/st.c
+@@ -83,6 +83,7 @@ static int try_wdio = 1;
+
+ static struct class st_sysfs_class;
+ static const struct attribute_group *st_dev_groups[];
++static const struct attribute_group *st_drv_groups[];
+
+ MODULE_AUTHOR("Kai Makisara");
+ MODULE_DESCRIPTION("SCSI tape (st) driver");
+@@ -190,15 +191,13 @@ static int sgl_unmap_user_pages(struct s
+ static int st_probe(struct device *);
+ static int st_remove(struct device *);
+
+-static int do_create_sysfs_files(void);
+-static void do_remove_sysfs_files(void);
+-
+ static struct scsi_driver st_template = {
+ .owner = THIS_MODULE,
+ .gendrv = {
+ .name = "st",
+ .probe = st_probe,
+ .remove = st_remove,
++ .groups = st_drv_groups,
+ },
+ };
+
+@@ -4304,14 +4303,8 @@ static int __init init_st(void)
+ if (err)
+ goto err_chrdev;
+
+- err = do_create_sysfs_files();
+- if (err)
+- goto err_scsidrv;
+-
+ return 0;
+
+-err_scsidrv:
+- scsi_unregister_driver(&st_template.gendrv);
+ err_chrdev:
+ unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
+ ST_MAX_TAPE_ENTRIES);
+@@ -4322,7 +4315,6 @@ err_class:
+
+ static void __exit exit_st(void)
+ {
+- do_remove_sysfs_files();
+ scsi_unregister_driver(&st_template.gendrv);
+ unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
+ ST_MAX_TAPE_ENTRIES);
+@@ -4335,68 +4327,38 @@ module_exit(exit_st);
+
+
+ /* The sysfs driver interface. Read-only at the moment */
+-static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf)
++static ssize_t try_direct_io_show(struct device_driver *ddp, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "%d\n", try_direct_io);
+ }
+-static DRIVER_ATTR(try_direct_io, S_IRUGO, st_try_direct_io_show, NULL);
++static DRIVER_ATTR_RO(try_direct_io);
+
+-static ssize_t st_fixed_buffer_size_show(struct device_driver *ddp, char *buf)
++static ssize_t fixed_buffer_size_show(struct device_driver *ddp, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "%d\n", st_fixed_buffer_size);
+ }
+-static DRIVER_ATTR(fixed_buffer_size, S_IRUGO, st_fixed_buffer_size_show, NULL);
++static DRIVER_ATTR_RO(fixed_buffer_size);
+
+-static ssize_t st_max_sg_segs_show(struct device_driver *ddp, char *buf)
++static ssize_t max_sg_segs_show(struct device_driver *ddp, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "%d\n", st_max_sg_segs);
+ }
+-static DRIVER_ATTR(max_sg_segs, S_IRUGO, st_max_sg_segs_show, NULL);
++static DRIVER_ATTR_RO(max_sg_segs);
+
+-static ssize_t st_version_show(struct device_driver *ddd, char *buf)
++static ssize_t version_show(struct device_driver *ddd, char *buf)
+ {
+ return snprintf(buf, PAGE_SIZE, "[%s]\n", verstr);
+ }
+-static DRIVER_ATTR(version, S_IRUGO, st_version_show, NULL);
+-
+-static int do_create_sysfs_files(void)
+-{
+- struct device_driver *sysfs = &st_template.gendrv;
+- int err;
+-
+- err = driver_create_file(sysfs, &driver_attr_try_direct_io);
+- if (err)
+- return err;
+- err = driver_create_file(sysfs, &driver_attr_fixed_buffer_size);
+- if (err)
+- goto err_try_direct_io;
+- err = driver_create_file(sysfs, &driver_attr_max_sg_segs);
+- if (err)
+- goto err_attr_fixed_buf;
+- err = driver_create_file(sysfs, &driver_attr_version);
+- if (err)
+- goto err_attr_max_sg;
+-
+- return 0;
+-
+-err_attr_max_sg:
+- driver_remove_file(sysfs, &driver_attr_max_sg_segs);
+-err_attr_fixed_buf:
+- driver_remove_file(sysfs, &driver_attr_fixed_buffer_size);
+-err_try_direct_io:
+- driver_remove_file(sysfs, &driver_attr_try_direct_io);
+- return err;
+-}
+-
+-static void do_remove_sysfs_files(void)
+-{
+- struct device_driver *sysfs = &st_template.gendrv;
++static DRIVER_ATTR_RO(version);
+
+- driver_remove_file(sysfs, &driver_attr_version);
+- driver_remove_file(sysfs, &driver_attr_max_sg_segs);
+- driver_remove_file(sysfs, &driver_attr_fixed_buffer_size);
+- driver_remove_file(sysfs, &driver_attr_try_direct_io);
+-}
++static struct attribute *st_drv_attrs[] = {
++ &driver_attr_try_direct_io.attr,
++ &driver_attr_fixed_buffer_size.attr,
++ &driver_attr_max_sg_segs.attr,
++ &driver_attr_version.attr,
++ NULL,
++};
++ATTRIBUTE_GROUPS(st_drv);
+
+ /* The sysfs simple class interface */
+ static ssize_t
+--- a/drivers/tty/hvc/hvcs.c
++++ b/drivers/tty/hvc/hvcs.c
+@@ -484,13 +484,13 @@ static struct attribute_group hvcs_attr_
+ .attrs = hvcs_attrs,
+ };
+
+-static ssize_t hvcs_rescan_show(struct device_driver *ddp, char *buf)
++static ssize_t rescan_show(struct device_driver *ddp, char *buf)
+ {
+ /* A 1 means it is updating, a 0 means it is done updating */
+ return snprintf(buf, PAGE_SIZE, "%d\n", hvcs_rescan_status);
+ }
+
+-static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf,
++static ssize_t rescan_store(struct device_driver *ddp, const char * buf,
+ size_t count)
+ {
+ if ((simple_strtol(buf, NULL, 0) != 1)
+@@ -505,8 +505,7 @@ static ssize_t hvcs_rescan_store(struct
+ return count;
+ }
+
+-static DRIVER_ATTR(rescan,
+- S_IRUGO | S_IWUSR, hvcs_rescan_show, hvcs_rescan_store);
++static DRIVER_ATTR_RW(rescan);
+
+ static void hvcs_kick(void)
+ {
diff --git a/p17.patch b/i2o-convert-bus-code-to-use-dev_groups.patch
index 097268b6aece3c..097268b6aece3c 100644
--- a/p17.patch
+++ b/i2o-convert-bus-code-to-use-dev_groups.patch
diff --git a/i01.patch b/ide-convert-bus-code-to-use-dev_groups.patch
index 728914bc139ddb..728914bc139ddb 100644
--- a/i01.patch
+++ b/ide-convert-bus-code-to-use-dev_groups.patch
diff --git a/p12.patch b/input-gameport-convert-bus-code-to-use-dev_groups.patch
index c388af43bb36f5..c388af43bb36f5 100644
--- a/p12.patch
+++ b/input-gameport-convert-bus-code-to-use-dev_groups.patch
diff --git a/s02.patch b/input-serio-remove-bus-usage-of-dev_attrs.patch
index 43ba0e10413ab2..43ba0e10413ab2 100644
--- a/s02.patch
+++ b/input-serio-remove-bus-usage-of-dev_attrs.patch
diff --git a/s01.patch b/input-serio-use-device_attr_ro.patch
index 9c838730d460e0..9c838730d460e0 100644
--- a/s01.patch
+++ b/input-serio-use-device_attr_ro.patch
diff --git a/i02.patch b/ipack-convert-bus-code-to-use-dev_groups.patch
index f0864cf6b0a888..f0864cf6b0a888 100644
--- a/i02.patch
+++ b/ipack-convert-bus-code-to-use-dev_groups.patch
diff --git a/p16.patch b/memstick-convert-bus-code-to-use-dev_groups.patch
index 6d5b1b0d2f3a9b..6d5b1b0d2f3a9b 100644
--- a/p16.patch
+++ b/memstick-convert-bus-code-to-use-dev_groups.patch
diff --git a/series b/series
index 7496fcdb843e57..d68fcbf1b092a3 100644
--- a/series
+++ b/series
@@ -64,16 +64,21 @@ hsi-convert-bus-code-to-use-dev_groups.patch
driver-core-remove-struct-bus_type.dev_attrs.patch
-s01.patch
-s02.patch
-i01.patch
-i02.patch
-p12.patch
-p13.patch
-p14.patch
-p15.patch
-p16.patch
-p17.patch
+input-serio-use-device_attr_ro.patch
+input-serio-remove-bus-usage-of-dev_attrs.patch
+
+ide-convert-bus-code-to-use-dev_groups.patch
+ipack-convert-bus-code-to-use-dev_groups.patch
+
+input-gameport-convert-bus-code-to-use-dev_groups.patch
+spi-convert-bus-code-to-use-dev_groups.patch
+virtio-convert-bus-code-to-use-dev_groups.patch
+tifm-convert-bus-code-to-use-dev_groups.patch
+memstick-convert-bus-code-to-use-dev_groups.patch
+i2o-convert-bus-code-to-use-dev_groups.patch
+
+uwb-clean-up-attribute-use-by-using-attribute_groups.patch
+
p18.patch
p19.patch
p20.patch
@@ -87,6 +92,6 @@ p27.patch
p28.patch
p29.patch
-p30.patch
qlcnic_sysfs.patch
+d01.patch
diff --git a/p13.patch b/spi-convert-bus-code-to-use-dev_groups.patch
index 90e12654f8604a..90e12654f8604a 100644
--- a/p13.patch
+++ b/spi-convert-bus-code-to-use-dev_groups.patch
diff --git a/p15.patch b/tifm-convert-bus-code-to-use-dev_groups.patch
index b8cf0af7f089dc..b8cf0af7f089dc 100644
--- a/p15.patch
+++ b/tifm-convert-bus-code-to-use-dev_groups.patch
diff --git a/p30.patch b/uwb-clean-up-attribute-use-by-using-attribute_groups.patch
index 87dd8fcdfc87a6..cb1baaa3b450aa 100644
--- a/p30.patch
+++ b/uwb-clean-up-attribute-use-by-using-attribute_groups.patch
@@ -1,3 +1,14 @@
+From foo@baz Sat Oct 19 20:13:26 PDT 2013
+Date: Sat, 19 Oct 2013 20:13:26 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: UWB: clean up attribute use by using ATTRIBUTE_GROUPS()
+
+The ATTRIBUTE_GROUPS() macro can be used in the uwb code to reduce the
+number of lines of code.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
---
drivers/uwb/lc-dev.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/p14.patch b/virtio-convert-bus-code-to-use-dev_groups.patch
index 1e68f1ae1f8b97..1e68f1ae1f8b97 100644
--- a/p14.patch
+++ b/virtio-convert-bus-code-to-use-dev_groups.patch