aboutsummaryrefslogtreecommitdiffstats
path: root/ide-convert-bus-code-to-use-dev_groups.patch
diff options
Diffstat (limited to 'ide-convert-bus-code-to-use-dev_groups.patch')
-rw-r--r--ide-convert-bus-code-to-use-dev_groups.patch126
1 files changed, 126 insertions, 0 deletions
diff --git a/ide-convert-bus-code-to-use-dev_groups.patch b/ide-convert-bus-code-to-use-dev_groups.patch
new file mode 100644
index 00000000000000..728914bc139ddb
--- /dev/null
+++ b/ide-convert-bus-code-to-use-dev_groups.patch
@@ -0,0 +1,126 @@
+From foo@baz Sun Oct 6 13:26:44 PDT 2013
+Date: Sun, 06 Oct 2013 13:26:44 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: ide: convert bus code to use dev_groups
+
+The dev_attrs field of struct bus_type is going away soon, dev_groups
+should be used instead. This converts the ide bus code to use the
+correct field.
+
+Cc: David S. Miller <davem@davemloft.net>
+Cc: <linux-ide@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+
+David, I can take this through my driver-core tree if you don't want to
+take it through yours, just let me know what works best for you.
+
+ drivers/ide/ide-sysfs.c | 35 ++++++++++++++++++++++++++---------
+ drivers/ide/ide.c | 2 +-
+ include/linux/ide.h | 2 +-
+ 3 files changed, 28 insertions(+), 11 deletions(-)
+
+--- a/drivers/ide/ide-sysfs.c
++++ b/drivers/ide/ide-sysfs.c
+@@ -25,6 +25,7 @@ static ssize_t media_show(struct device
+ ide_drive_t *drive = to_ide_device(dev);
+ return sprintf(buf, "%s\n", ide_media_string(drive));
+ }
++static DEVICE_ATTR_RO(media);
+
+ static ssize_t drivename_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+@@ -32,6 +33,7 @@ static ssize_t drivename_show(struct dev
+ ide_drive_t *drive = to_ide_device(dev);
+ return sprintf(buf, "%s\n", drive->name);
+ }
++static DEVICE_ATTR_RO(drivename);
+
+ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+@@ -39,6 +41,7 @@ static ssize_t modalias_show(struct devi
+ ide_drive_t *drive = to_ide_device(dev);
+ return sprintf(buf, "ide:m-%s\n", ide_media_string(drive));
+ }
++static DEVICE_ATTR_RO(modalias);
+
+ static ssize_t model_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+@@ -46,6 +49,7 @@ static ssize_t model_show(struct device
+ ide_drive_t *drive = to_ide_device(dev);
+ return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]);
+ }
++static DEVICE_ATTR_RO(model);
+
+ static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+@@ -53,6 +57,7 @@ static ssize_t firmware_show(struct devi
+ ide_drive_t *drive = to_ide_device(dev);
+ return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]);
+ }
++static DEVICE_ATTR_RO(firmware);
+
+ static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+@@ -60,16 +65,28 @@ static ssize_t serial_show(struct device
+ ide_drive_t *drive = to_ide_device(dev);
+ return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]);
+ }
++static DEVICE_ATTR(serial, 0400, serial_show, NULL);
+
+-struct device_attribute ide_dev_attrs[] = {
+- __ATTR_RO(media),
+- __ATTR_RO(drivename),
+- __ATTR_RO(modalias),
+- __ATTR_RO(model),
+- __ATTR_RO(firmware),
+- __ATTR(serial, 0400, serial_show, NULL),
+- __ATTR(unload_heads, 0644, ide_park_show, ide_park_store),
+- __ATTR_NULL
++static DEVICE_ATTR(unload_heads, 0644, ide_park_show, ide_park_store);
++
++static struct attribute *ide_attrs[] = {
++ &dev_attr_media.attr,
++ &dev_attr_drivename.attr,
++ &dev_attr_modalias.attr,
++ &dev_attr_model.attr,
++ &dev_attr_firmware.attr,
++ &dev_attr_serial.attr,
++ &dev_attr_unload_heads.attr,
++ NULL,
++};
++
++static const struct attribute_group ide_attr_group = {
++ .attrs = ide_attrs,
++};
++
++const struct attribute_group *ide_dev_groups[] = {
++ &ide_attr_group,
++ NULL,
+ };
+
+ static ssize_t store_delete_devices(struct device *portdev,
+--- a/drivers/ide/ide.c
++++ b/drivers/ide/ide.c
+@@ -158,7 +158,7 @@ struct bus_type ide_bus_type = {
+ .probe = generic_ide_probe,
+ .remove = generic_ide_remove,
+ .shutdown = generic_ide_shutdown,
+- .dev_attrs = ide_dev_attrs,
++ .dev_groups = ide_dev_groups,
+ .suspend = generic_ide_suspend,
+ .resume = generic_ide_resume,
+ };
+--- a/include/linux/ide.h
++++ b/include/linux/ide.h
+@@ -1514,7 +1514,7 @@ static inline void ide_set_max_pio(ide_d
+
+ char *ide_media_string(ide_drive_t *);
+
+-extern struct device_attribute ide_dev_attrs[];
++extern const struct attribute_group *ide_dev_groups[];
+ extern struct bus_type ide_bus_type;
+ extern struct class *ide_port_class;
+