Skip to contentSkip to conversation

superhyway: convert code to use dev_groups

PATCH New Quentin Lambert 1 participant 1 message Jun 12, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 superhyway: convert code to use dev_groups

The dev_attrs field of struct bus_type is going away, use dev_groups instead. This converts the soundbus code to use the correct field.

These modifications were made using Coccinelle.

---
 drivers/sh/superhyway/superhyway-sysfs.c |   26 ++++++++++++++++----------
 drivers/sh/superhyway/superhyway.c       |    4 +++-
 include/linux/superhyway.h               |    2 +-
 3 files changed, 20 insertions(+), 12 deletions(-)
drivers/sh/superhyway/superhyway-sysfs.c +16 -10
@@ -23,23 +23,29 @@ static ssize_t name##_show(struct device
 
 /* VCR flags */
 superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags);
+static DEVICE_ATTR_RO(perr_flags);
 superhyway_ro_attr(merr_flags, "0x%02x\n", vcr.merr_flags);
+static DEVICE_ATTR_RO(merr_flags);
 superhyway_ro_attr(mod_vers, "0x%04x\n", vcr.mod_vers);
+static DEVICE_ATTR_RO(mod_vers);
 superhyway_ro_attr(mod_id, "0x%04x\n", vcr.mod_id);
+static DEVICE_ATTR_RO(mod_id);
 superhyway_ro_attr(bot_mb, "0x%02x\n", vcr.bot_mb);
+static DEVICE_ATTR_RO(bot_mb);
 superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb);
+static DEVICE_ATTR_RO(top_mb);
 
 /* Misc */
 superhyway_ro_attr(resource, "0x%08lx\n", resource[0].start);
+static DEVICE_ATTR_RO(resource);
 
-struct device_attribute superhyway_dev_attrs[] = {
-	__ATTR_RO(perr_flags),
-	__ATTR_RO(merr_flags),
-	__ATTR_RO(mod_vers),
-	__ATTR_RO(mod_id),
-	__ATTR_RO(bot_mb),
-	__ATTR_RO(top_mb),
-	__ATTR_RO(resource),
-	__ATTR_NULL,
+struct attribute *superhyway_dev_attrs[] = {
+	&dev_attr_perr_flags.attr,
+	&dev_attr_merr_flags.attr,
+	&dev_attr_mod_vers.attr,
+	&dev_attr_mod_id.attr,
+	&dev_attr_bot_mb.attr,
+	&dev_attr_top_mb.attr,
+	&dev_attr_resource.attr,
+	NULL,
 };
-
drivers/sh/superhyway/superhyway.c +3 -1
@@ -205,11 +205,13 @@ static int superhyway_bus_match(struct d
 	return -ENODEV;
 }
 
+/* superhyway_dev_attrs is defined in superhyway-sysfs.c */
+ATTRIBUTE_GROUPS(superhyway_dev);
 struct bus_type superhyway_bus_type = {
 	.name		= "superhyway",
 	.match		= superhyway_bus_match,
 #ifdef CONFIG_SYSFS
-	.dev_attrs	= superhyway_dev_attrs,
+	.dev_groups	= superhyway_dev_groups,
 #endif
 	.probe		= superhyway_device_probe,
 	.remove		= superhyway_device_remove,
include/linux/superhyway.h +1 -1
@@ -101,7 +101,7 @@ int superhyway_add_device(unsigned long
 int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices);
 
 /* drivers/sh/superhyway/superhyway-sysfs.c */
-extern struct device_attribute superhyway_dev_attrs[];
+extern struct attribute *superhyway_dev_attrs[];
 
 #endif /* __LINUX_SUPERHYWAY_H */