scsi: snic: Switch to attribute groups
authorBart Van Assche <bvanassche@acm.org>
Tue, 12 Oct 2021 23:35:55 +0000 (16:35 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 17 Oct 2021 01:45:59 +0000 (21:45 -0400)
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-44-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/snic/snic.h
drivers/scsi/snic/snic_attrs.c
drivers/scsi/snic/snic_main.c

index f4c666285bba52ddc2ff1ee0bda1821eefd97c71..4ec7e30678e175b80ec98fc2bc55c8b610666326 100644 (file)
@@ -374,7 +374,7 @@ int snic_glob_init(void);
 void snic_glob_cleanup(void);
 
 extern struct workqueue_struct *snic_event_queue;
-extern struct device_attribute *snic_attrs[];
+extern const struct attribute_group *snic_host_groups[];
 
 int snic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
 int snic_abort_cmd(struct scsi_cmnd *);
index 32d5d556b6f87ac18be9c1fd61355ff2b808e5c3..dc03ce1ec90984e1279f0c7dbd00eaf921c4906e 100644 (file)
@@ -68,10 +68,19 @@ static DEVICE_ATTR(snic_state, S_IRUGO, snic_show_state, NULL);
 static DEVICE_ATTR(drv_version, S_IRUGO, snic_show_drv_version, NULL);
 static DEVICE_ATTR(link_state, S_IRUGO, snic_show_link_state, NULL);
 
-struct device_attribute *snic_attrs[] = {
-       &dev_attr_snic_sym_name,
-       &dev_attr_snic_state,
-       &dev_attr_drv_version,
-       &dev_attr_link_state,
+static struct attribute *snic_host_attrs[] = {
+       &dev_attr_snic_sym_name.attr,
+       &dev_attr_snic_state.attr,
+       &dev_attr_drv_version.attr,
+       &dev_attr_link_state.attr,
        NULL,
 };
+
+static const struct attribute_group snic_host_attr_group = {
+       .attrs = snic_host_attrs
+};
+
+const struct attribute_group *snic_host_groups[] = {
+       &snic_host_attr_group,
+       NULL
+};
index 14f4ce665e584291c0df154201b357bbf7a1ca78..29d56396058c9c5255d0270f0e2d9657067f3c30 100644 (file)
@@ -129,7 +129,7 @@ static struct scsi_host_template snic_host_template = {
        .can_queue = SNIC_MAX_IO_REQ,
        .sg_tablesize = SNIC_MAX_SG_DESC_CNT,
        .max_sectors = 0x800,
-       .shost_attrs = snic_attrs,
+       .shost_groups = snic_host_groups,
        .track_queue_depth = 1,
        .cmd_size = sizeof(struct snic_internal_io_state),
        .proc_name = "snic_scsi",