[PATCH v2 32/46] scsi: myrs: Switch to attribute groups

Bart Van Assche
2021-10-07T21:20:22Z

drivers/scsi/myrs.c | 54 ++++++++++++++++++++++++++++++---------------
1 file changed, 36 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 07f274afd7e5..c4a897939729 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -1286,14 +1286,23 @@ static ssize_t consistency_check_store(struct device *dev,
}
static DEVICE_ATTR_RW(consistency_check);

-static struct device_attribute *myrs_sdev_attrs[] = {
- &dev_attr_consistency_check,
- &dev_attr_rebuild,
- &dev_attr_raid_state,
- &dev_attr_raid_level,
+static struct attribute *myrs_sdev_attrs[] = {
+ &dev_attr_consistency_check.attr,
+ &dev_attr_rebuild.attr,
+ &dev_attr_raid_state.attr,
+ &dev_attr_raid_level.attr,
NULL,
};

+static const struct attribute_group myrs_sdev_attr_group = {
+ .attrs = myrs_sdev_attrs
+};
+
+static const struct attribute_group *myrs_sdev_attr_groups[] = {
+ &myrs_sdev_attr_group,
+ NULL
+};
+
static ssize_t serial_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -1510,20 +1519,29 @@ static ssize_t disable_enclosure_messages_store(struct device *dev,
}
static DEVICE_ATTR_RW(disable_enclosure_messages);

-static struct device_attribute *myrs_shost_attrs[] = {
- &dev_attr_serial,
- &dev_attr_ctlr_num,
- &dev_attr_processor,
- &dev_attr_model,
- &dev_attr_ctlr_type,
- &dev_attr_cache_size,
- &dev_attr_firmware,
- &dev_attr_discovery,
- &dev_attr_flush_cache,
- &dev_attr_disable_enclosure_messages,
+static struct attribute *myrs_shost_attrs[] = {
+ &dev_attr_serial.attr,
+ &dev_attr_ctlr_num.attr,
+ &dev_attr_processor.attr,
+ &dev_attr_model.attr,
+ &dev_attr_ctlr_type.attr,
+ &dev_attr_cache_size.attr,
+ &dev_attr_firmware.attr,
+ &dev_attr_discovery.attr,
+ &dev_attr_flush_cache.attr,
+ &dev_attr_disable_enclosure_messages.attr,
NULL,
};

+static const struct attribute_group myrs_shost_attr_group = {
+ .attrs = myrs_shost_attrs
+};
+
+static const struct attribute_group *myrs_shost_groups[] = {
+ &myrs_shost_attr_group,
+ NULL
+};
+
/*
* SCSI midlayer interface
*/
@@ -1923,8 +1941,8 @@ static struct scsi_host_template myrs_template = {
.slave_configure = myrs_slave_configure,
.slave_destroy = myrs_slave_destroy,
.cmd_size = sizeof(struct myrs_cmdblk),
- .shost_attrs = myrs_shost_attrs,
- .sdev_attrs = myrs_sdev_attrs,
+ .shost_groups = myrs_shost_groups,
+ .sdev_groups = myrs_sdev_attr_groups,
.this_id = -1,
};