s390/ccwgroup: use bus->dev_groups for bus-based sysfs attributes
authorJulian Wiedmann <jwi@linux.ibm.com>
Mon, 7 Dec 2020 13:12:29 +0000 (14:12 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Dec 2020 14:55:21 +0000 (06:55 -0800)
Bus drivers have their own way of describing the sysfs attributes that
all devices on a bus should provide.
Switch ccwgroup_attr_groups over to use bus->dev_groups, and thus
free up dev->groups for usage by the ccwgroup device drivers.

While adjusting the attribute naming, use ATTRIBUTE_GROUPS() to get rid
of some boilerplate code.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/cio/ccwgroup.c

index 483a9ecfcbb145dd0ea4d3ffaa7afc6cf9ac8e3a..444385da57925fd026ca1bc1546c1e0a9cbbe1d3 100644 (file)
@@ -210,18 +210,12 @@ out:
 static DEVICE_ATTR(ungroup, 0200, NULL, ccwgroup_ungroup_store);
 static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store);
 
-static struct attribute *ccwgroup_attrs[] = {
+static struct attribute *ccwgroup_dev_attrs[] = {
        &dev_attr_online.attr,
        &dev_attr_ungroup.attr,
        NULL,
 };
-static struct attribute_group ccwgroup_attr_group = {
-       .attrs = ccwgroup_attrs,
-};
-static const struct attribute_group *ccwgroup_attr_groups[] = {
-       &ccwgroup_attr_group,
-       NULL,
-};
+ATTRIBUTE_GROUPS(ccwgroup_dev);
 
 static void ccwgroup_ungroup_workfn(struct work_struct *work)
 {
@@ -384,7 +378,6 @@ int ccwgroup_create_dev(struct device *parent, struct ccwgroup_driver *gdrv,
        }
 
        dev_set_name(&gdev->dev, "%s", dev_name(&gdev->cdev[0]->dev));
-       gdev->dev.groups = ccwgroup_attr_groups;
 
        if (gdrv) {
                gdev->dev.driver = &gdrv->driver;
@@ -487,6 +480,7 @@ static void ccwgroup_shutdown(struct device *dev)
 
 static struct bus_type ccwgroup_bus_type = {
        .name   = "ccwgroup",
+       .dev_groups = ccwgroup_dev_groups,
        .remove = ccwgroup_remove,
        .shutdown = ccwgroup_shutdown,
 };