scsi: zfcp: Switch to attribute groups

struct device supports attribute groups directly but does not support
struct device_attribute directly. Hence switch to attribute groups.

Link: https://lore.kernel.org/r/20211012233558.4066756-7-bvanassche@acm.org
Acked-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Bart Van Assche 2021-10-12 16:35:18 -07:00 committed by Martin K. Petersen
parent 2899836f94
commit d8d7cf3f7d
3 changed files with 39 additions and 21 deletions

View File

@ -184,8 +184,8 @@ extern const struct attribute_group *zfcp_sysfs_adapter_attr_groups[];
extern const struct attribute_group *zfcp_unit_attr_groups[];
extern const struct attribute_group *zfcp_port_attr_groups[];
extern struct mutex zfcp_sysfs_port_units_mutex;
extern struct device_attribute *zfcp_sysfs_sdev_attrs[];
extern struct device_attribute *zfcp_sysfs_shost_attrs[];
extern const struct attribute_group *zfcp_sysfs_sdev_attr_groups[];
extern const struct attribute_group *zfcp_sysfs_shost_attr_groups[];
bool zfcp_sysfs_port_is_removing(const struct zfcp_port *const port);
/* zfcp_unit.c */

View File

@ -444,8 +444,8 @@ static struct scsi_host_template zfcp_scsi_host_template = {
/* report size limit per scatter-gather segment */
.max_segment_size = ZFCP_QDIO_SBALE_LEN,
.dma_boundary = ZFCP_QDIO_SBALE_LEN - 1,
.shost_attrs = zfcp_sysfs_shost_attrs,
.sdev_attrs = zfcp_sysfs_sdev_attrs,
.shost_groups = zfcp_sysfs_shost_attr_groups,
.sdev_groups = zfcp_sysfs_sdev_attr_groups,
.track_queue_depth = 1,
.supported_mode = MODE_INITIATOR,
};

View File

@ -672,17 +672,26 @@ ZFCP_DEFINE_SCSI_ATTR(zfcp_in_recovery, "%d\n",
ZFCP_DEFINE_SCSI_ATTR(zfcp_status, "0x%08x\n",
atomic_read(&zfcp_sdev->status));
struct device_attribute *zfcp_sysfs_sdev_attrs[] = {
&dev_attr_fcp_lun,
&dev_attr_wwpn,
&dev_attr_hba_id,
&dev_attr_read_latency,
&dev_attr_write_latency,
&dev_attr_cmd_latency,
&dev_attr_zfcp_access_denied,
&dev_attr_zfcp_failed,
&dev_attr_zfcp_in_recovery,
&dev_attr_zfcp_status,
struct attribute *zfcp_sdev_attrs[] = {
&dev_attr_fcp_lun.attr,
&dev_attr_wwpn.attr,
&dev_attr_hba_id.attr,
&dev_attr_read_latency.attr,
&dev_attr_write_latency.attr,
&dev_attr_cmd_latency.attr,
&dev_attr_zfcp_access_denied.attr,
&dev_attr_zfcp_failed.attr,
&dev_attr_zfcp_in_recovery.attr,
&dev_attr_zfcp_status.attr,
NULL
};
static const struct attribute_group zfcp_sysfs_sdev_attr_group = {
.attrs = zfcp_sdev_attrs
};
const struct attribute_group *zfcp_sysfs_sdev_attr_groups[] = {
&zfcp_sysfs_sdev_attr_group,
NULL
};
@ -783,12 +792,21 @@ static ssize_t zfcp_sysfs_adapter_q_full_show(struct device *dev,
}
static DEVICE_ATTR(queue_full, S_IRUGO, zfcp_sysfs_adapter_q_full_show, NULL);
struct device_attribute *zfcp_sysfs_shost_attrs[] = {
&dev_attr_utilization,
&dev_attr_requests,
&dev_attr_megabytes,
&dev_attr_seconds_active,
&dev_attr_queue_full,
static struct attribute *zfcp_sysfs_shost_attrs[] = {
&dev_attr_utilization.attr,
&dev_attr_requests.attr,
&dev_attr_megabytes.attr,
&dev_attr_seconds_active.attr,
&dev_attr_queue_full.attr,
NULL
};
static const struct attribute_group zfcp_sysfs_shost_attr_group = {
.attrs = zfcp_sysfs_shost_attrs
};
const struct attribute_group *zfcp_sysfs_shost_attr_groups[] = {
&zfcp_sysfs_shost_attr_group,
NULL
};