From d8d7cf3f7d073cea8c3e4c3a740d5d24744280d0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 12 Oct 2021 16:35:18 -0700 Subject: [PATCH] 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 Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/s390/scsi/zfcp_ext.h | 4 +-- drivers/s390/scsi/zfcp_scsi.c | 4 +-- drivers/s390/scsi/zfcp_sysfs.c | 52 +++++++++++++++++++++++----------- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 6bc96d70254d..c302cbb18a55 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h @@ -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 */ diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index e0a6d8c1f198..526ac240d9fe 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c @@ -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, }; diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c index b8cd75a872ee..dbf3e50444e6 100644 --- a/drivers/s390/scsi/zfcp_sysfs.c +++ b/drivers/s390/scsi/zfcp_sysfs.c @@ -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 };