aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-07 21:27:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-16 21:40:57 -0400
commitfb3fed7926545e44ce36574e1b1c5cdeb018db5c (patch)
tree4ae81ad7f2338298f3315f562c5bceb63192b213 /drivers/ide
parent00173146897b15b07b8be6c95dd74486e530825d (diff)
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. Acked-by: David S. Miller <davem@davemloft.net> Cc: <linux-ide@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-sysfs.c35
-rw-r--r--drivers/ide/ide.c2
2 files changed, 27 insertions, 10 deletions
diff --git a/drivers/ide/ide-sysfs.c b/drivers/ide/ide-sysfs.c
index 883ffacaf45a..84a6a9e08d64 100644
--- a/drivers/ide/ide-sysfs.c
+++ b/drivers/ide/ide-sysfs.c
@@ -25,6 +25,7 @@ static ssize_t media_show(struct device *dev, struct device_attribute *attr,
25 ide_drive_t *drive = to_ide_device(dev); 25 ide_drive_t *drive = to_ide_device(dev);
26 return sprintf(buf, "%s\n", ide_media_string(drive)); 26 return sprintf(buf, "%s\n", ide_media_string(drive));
27} 27}
28static DEVICE_ATTR_RO(media);
28 29
29static ssize_t drivename_show(struct device *dev, struct device_attribute *attr, 30static ssize_t drivename_show(struct device *dev, struct device_attribute *attr,
30 char *buf) 31 char *buf)
@@ -32,6 +33,7 @@ static ssize_t drivename_show(struct device *dev, struct device_attribute *attr,
32 ide_drive_t *drive = to_ide_device(dev); 33 ide_drive_t *drive = to_ide_device(dev);
33 return sprintf(buf, "%s\n", drive->name); 34 return sprintf(buf, "%s\n", drive->name);
34} 35}
36static DEVICE_ATTR_RO(drivename);
35 37
36static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 38static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
37 char *buf) 39 char *buf)
@@ -39,6 +41,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
39 ide_drive_t *drive = to_ide_device(dev); 41 ide_drive_t *drive = to_ide_device(dev);
40 return sprintf(buf, "ide:m-%s\n", ide_media_string(drive)); 42 return sprintf(buf, "ide:m-%s\n", ide_media_string(drive));
41} 43}
44static DEVICE_ATTR_RO(modalias);
42 45
43static ssize_t model_show(struct device *dev, struct device_attribute *attr, 46static ssize_t model_show(struct device *dev, struct device_attribute *attr,
44 char *buf) 47 char *buf)
@@ -46,6 +49,7 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr,
46 ide_drive_t *drive = to_ide_device(dev); 49 ide_drive_t *drive = to_ide_device(dev);
47 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]); 50 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]);
48} 51}
52static DEVICE_ATTR_RO(model);
49 53
50static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, 54static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
51 char *buf) 55 char *buf)
@@ -53,6 +57,7 @@ static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
53 ide_drive_t *drive = to_ide_device(dev); 57 ide_drive_t *drive = to_ide_device(dev);
54 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]); 58 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]);
55} 59}
60static DEVICE_ATTR_RO(firmware);
56 61
57static ssize_t serial_show(struct device *dev, struct device_attribute *attr, 62static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
58 char *buf) 63 char *buf)
@@ -60,16 +65,28 @@ static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
60 ide_drive_t *drive = to_ide_device(dev); 65 ide_drive_t *drive = to_ide_device(dev);
61 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]); 66 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]);
62} 67}
68static DEVICE_ATTR(serial, 0400, serial_show, NULL);
69
70static DEVICE_ATTR(unload_heads, 0644, ide_park_show, ide_park_store);
71
72static struct attribute *ide_attrs[] = {
73 &dev_attr_media.attr,
74 &dev_attr_drivename.attr,
75 &dev_attr_modalias.attr,
76 &dev_attr_model.attr,
77 &dev_attr_firmware.attr,
78 &dev_attr_serial.attr,
79 &dev_attr_unload_heads.attr,
80 NULL,
81};
82
83static const struct attribute_group ide_attr_group = {
84 .attrs = ide_attrs,
85};
63 86
64struct device_attribute ide_dev_attrs[] = { 87const struct attribute_group *ide_dev_groups[] = {
65 __ATTR_RO(media), 88 &ide_attr_group,
66 __ATTR_RO(drivename), 89 NULL,
67 __ATTR_RO(modalias),
68 __ATTR_RO(model),
69 __ATTR_RO(firmware),
70 __ATTR(serial, 0400, serial_show, NULL),
71 __ATTR(unload_heads, 0644, ide_park_show, ide_park_store),
72 __ATTR_NULL
73}; 90};
74 91
75static ssize_t store_delete_devices(struct device *portdev, 92static ssize_t store_delete_devices(struct device *portdev,
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index fa896210ed7b..2ce6268a2734 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -158,7 +158,7 @@ struct bus_type ide_bus_type = {
158 .probe = generic_ide_probe, 158 .probe = generic_ide_probe,
159 .remove = generic_ide_remove, 159 .remove = generic_ide_remove,
160 .shutdown = generic_ide_shutdown, 160 .shutdown = generic_ide_shutdown,
161 .dev_attrs = ide_dev_attrs, 161 .dev_groups = ide_dev_groups,
162 .suspend = generic_ide_suspend, 162 .suspend = generic_ide_suspend,
163 .resume = generic_ide_resume, 163 .resume = generic_ide_resume,
164}; 164};