[PATCH v2 25/46] scsi: ipr: Switch to attribute groups

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

drivers/scsi/ipr.c | 52 +++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5d78f7e939a3..c872a28b8d5e 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4236,18 +4236,27 @@ static struct bin_attribute ipr_ioa_async_err_log = {
.write = ipr_next_async_err_log
};

-static struct device_attribute *ipr_ioa_attrs[] = {
- &ipr_fw_version_attr,
- &ipr_log_level_attr,
- &ipr_diagnostics_attr,
- &ipr_ioa_state_attr,
- &ipr_ioa_reset_attr,
- &ipr_update_fw_attr,
- &ipr_ioa_fw_type_attr,
- &ipr_iopoll_weight_attr,
+static struct attribute *ipr_ioa_attrs[] = {
+ &ipr_fw_version_attr.attr,
+ &ipr_log_level_attr.attr,
+ &ipr_diagnostics_attr.attr,
+ &ipr_ioa_state_attr.attr,
+ &ipr_ioa_reset_attr.attr,
+ &ipr_update_fw_attr.attr,
+ &ipr_ioa_fw_type_attr.attr,
+ &ipr_iopoll_weight_attr.attr,
NULL,
};

+static const struct attribute_group ipr_ioa_attr_group = {
+ .attrs = ipr_ioa_attrs
+};
+
+static const struct attribute_group *ipr_ioa_attr_groups[] = {
+ &ipr_ioa_attr_group,
+ NULL
+};
+
#ifdef CONFIG_SCSI_IPR_DUMP
/**
* ipr_read_dump - Dump the adapter
@@ -4732,15 +4741,24 @@ static struct device_attribute ipr_raw_mode_attr = {
.store = ipr_store_raw_mode
};

-static struct device_attribute *ipr_dev_attrs[] = {
- &ipr_adapter_handle_attr,
- &ipr_resource_path_attr,
- &ipr_device_id_attr,
- &ipr_resource_type_attr,
- &ipr_raw_mode_attr,
+static struct attribute *ipr_dev_attrs[] = {
+ &ipr_adapter_handle_attr.attr,
+ &ipr_resource_path_attr.attr,
+ &ipr_device_id_attr.attr,
+ &ipr_resource_type_attr.attr,
+ &ipr_raw_mode_attr.attr,
NULL,
};

+static const struct attribute_group ipr_dev_attr_group = {
+ .attrs = ipr_dev_attrs
+};
+
+static const struct attribute_group *ipr_dev_attr_groups[] = {
+ &ipr_dev_attr_group,
+ NULL
+};
+
/**
* ipr_biosparam - Return the HSC mapping
* @sdev: scsi device struct
@@ -6762,8 +6780,8 @@ static struct scsi_host_template driver_template = {
.sg_tablesize = IPR_MAX_SGLIST,
.max_sectors = IPR_IOA_MAX_SECTORS,
.cmd_per_lun = IPR_MAX_CMD_PER_LUN,
- .shost_attrs = ipr_ioa_attrs,
- .sdev_attrs = ipr_dev_attrs,
+ .shost_groups = ipr_ioa_attr_groups,
+ .sdev_groups = ipr_dev_attr_groups,
.proc_name = IPR_NAME,
};