[PATCH v2 20/46] scsi: hisi_sas: Switch to attribute groups

Bart Van Assche
2021-10-07T21:19:58Z

drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 15 ++++++++++++---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 15 ++++++++++++---
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 21 +++++++++++++++------
3 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
index 862f4e8b7eb5..95e2a6e3c105 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -1749,8 +1749,17 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba)
return 0;
}

-static struct device_attribute *host_attrs_v1_hw[] = {
- &dev_attr_phy_event_threshold,
+static struct attribute *host_attrs_v1_hw[] = {
+ &dev_attr_phy_event_threshold.attr,
+ NULL
+};
+
+static const struct attribute_group host_attrs_v1_hw_group = {
+ .attrs = host_attrs_v1_hw
+};
+
+static const struct attribute_group *host_attrs_v1_hw_groups[] = {
+ &host_attrs_v1_hw_group,
NULL
};

@@ -1777,7 +1786,7 @@ static struct scsi_host_template sht_v1_hw = {
#ifdef CONFIG_COMPAT
.compat_ioctl = sas_ioctl,
#endif
- .shost_attrs = host_attrs_v1_hw,
+ .shost_groups = host_attrs_v1_hw_groups,
.host_reset = hisi_sas_host_reset,
};

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 236cf65c2f97..26c2fa47b6ac 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -3542,8 +3542,17 @@ static void wait_cmds_complete_timeout_v2_hw(struct hisi_hba *hisi_hba,

}

-static struct device_attribute *host_attrs_v2_hw[] = {
- &dev_attr_phy_event_threshold,
+static struct attribute *host_attrs_v2_hw[] = {
+ &dev_attr_phy_event_threshold.attr,
+ NULL
+};
+
+static const struct attribute_group host_attrs_v2_hw_group = {
+ .attrs = host_attrs_v2_hw
+};
+
+static const struct attribute_group *host_attrs_v2_hw_groups[] = {
+ &host_attrs_v2_hw_group,
NULL
};

@@ -3590,7 +3599,7 @@ static struct scsi_host_template sht_v2_hw = {
#ifdef CONFIG_COMPAT
.compat_ioctl = sas_ioctl,
#endif
- .shost_attrs = host_attrs_v2_hw,
+ .shost_groups = host_attrs_v2_hw_groups,
.host_reset = hisi_sas_host_reset,
.map_queues = map_queues_v2_hw,
.host_tagset = 1,
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index f4517f3eb922..ebd8d10112cd 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2771,11 +2771,20 @@ static int slave_configure_v3_hw(struct scsi_device *sdev)
return 0;
}

-static struct device_attribute *host_attrs_v3_hw[] = {
- &dev_attr_phy_event_threshold,
- &dev_attr_intr_conv_v3_hw,
- &dev_attr_intr_coal_ticks_v3_hw,
- &dev_attr_intr_coal_count_v3_hw,
+static struct attribute *host_attrs_v3_hw[] = {
+ &dev_attr_phy_event_threshold.attr,
+ &dev_attr_intr_conv_v3_hw.attr,
+ &dev_attr_intr_coal_ticks_v3_hw.attr,
+ &dev_attr_intr_coal_count_v3_hw.attr,
+ NULL
+};
+
+static const struct attribute_group host_attrs_v3_hw_group = {
+ .attrs = host_attrs_v3_hw
+};
+
+static const struct attribute_group *host_attrs_v3_hw_groups[] = {
+ &host_attrs_v3_hw_group,
NULL
};

@@ -3163,7 +3172,7 @@ static struct scsi_host_template sht_v3_hw = {
#ifdef CONFIG_COMPAT
.compat_ioctl = sas_ioctl,
#endif
- .shost_attrs = host_attrs_v3_hw,
+ .shost_groups = host_attrs_v3_hw_groups,
.tag_alloc_policy = BLK_TAG_ALLOC_RR,
.host_reset = hisi_sas_host_reset,
.host_tagset = 1,