[PATCH v2 31/46] scsi: myrb: Switch to attribute groups

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

drivers/scsi/myrb.c | 42 ++++++++++++++++++++++++++++++------------
1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index a4a88323e020..0b9bd540db3b 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -2182,22 +2182,40 @@ static ssize_t flush_cache_store(struct device *dev,
}
static DEVICE_ATTR_WO(flush_cache);

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

-static struct device_attribute *myrb_shost_attrs[] = {
- &dev_attr_ctlr_num,
- &dev_attr_model,
- &dev_attr_firmware,
- &dev_attr_flush_cache,
+static const struct attribute_group myrb_sdev_attr_group = {
+ .attrs = myrb_sdev_attrs
+};
+
+static const struct attribute_group *myrb_sdev_attr_groups[] = {
+ &myrb_sdev_attr_group,
+ NULL
+};
+
+static struct attribute *myrb_shost_attrs[] = {
+ &dev_attr_ctlr_num.attr,
+ &dev_attr_model.attr,
+ &dev_attr_firmware.attr,
+ &dev_attr_flush_cache.attr,
NULL,
};

+static const struct attribute_group myrb_shost_attr_group = {
+ .attrs = myrb_shost_attrs
+};
+
+static const struct attribute_group *myrb_shost_groups[] = {
+ &myrb_shost_attr_group,
+ NULL
+};
+
static struct scsi_host_template myrb_template = {
.module = THIS_MODULE,
.name = "DAC960",
@@ -2209,8 +2227,8 @@ static struct scsi_host_template myrb_template = {
.slave_destroy = myrb_slave_destroy,
.bios_param = myrb_biosparam,
.cmd_size = sizeof(struct myrb_cmdblk),
- .shost_attrs = myrb_shost_attrs,
- .sdev_attrs = myrb_sdev_attrs,
+ .shost_groups = myrb_shost_groups,
+ .sdev_groups = myrb_sdev_attr_groups,
.this_id = -1,
};