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

index 2943cdd83614bea3567c4232b23aee2846c509d2..e7be95ee7d64473c9f957b41bc3a956ef71f2683 100644 (file)
@@ -3103,33 +3103,37 @@ static DEVICE_ATTR_RW(irqpoll_weight);
 static DEVICE_ATTR_RW(num_hwqs);
 static DEVICE_ATTR_RW(hwq_mode);
 
-static struct device_attribute *cxlflash_host_attrs[] = {
-       &dev_attr_port0,
-       &dev_attr_port1,
-       &dev_attr_port2,
-       &dev_attr_port3,
-       &dev_attr_lun_mode,
-       &dev_attr_ioctl_version,
-       &dev_attr_port0_lun_table,
-       &dev_attr_port1_lun_table,
-       &dev_attr_port2_lun_table,
-       &dev_attr_port3_lun_table,
-       &dev_attr_irqpoll_weight,
-       &dev_attr_num_hwqs,
-       &dev_attr_hwq_mode,
+static struct attribute *cxlflash_host_attrs[] = {
+       &dev_attr_port0.attr,
+       &dev_attr_port1.attr,
+       &dev_attr_port2.attr,
+       &dev_attr_port3.attr,
+       &dev_attr_lun_mode.attr,
+       &dev_attr_ioctl_version.attr,
+       &dev_attr_port0_lun_table.attr,
+       &dev_attr_port1_lun_table.attr,
+       &dev_attr_port2_lun_table.attr,
+       &dev_attr_port3_lun_table.attr,
+       &dev_attr_irqpoll_weight.attr,
+       &dev_attr_num_hwqs.attr,
+       &dev_attr_hwq_mode.attr,
        NULL
 };
 
+ATTRIBUTE_GROUPS(cxlflash_host);
+
 /*
  * Device attributes
  */
 static DEVICE_ATTR_RO(mode);
 
-static struct device_attribute *cxlflash_dev_attrs[] = {
-       &dev_attr_mode,
+static struct attribute *cxlflash_dev_attrs[] = {
+       &dev_attr_mode.attr,
        NULL
 };
 
+ATTRIBUTE_GROUPS(cxlflash_dev);
+
 /*
  * Host template
  */
@@ -3150,8 +3154,8 @@ static struct scsi_host_template driver_template = {
        .this_id = -1,
        .sg_tablesize = 1,      /* No scatter gather support */
        .max_sectors = CXLFLASH_MAX_SECTORS,
-       .shost_attrs = cxlflash_host_attrs,
-       .sdev_attrs = cxlflash_dev_attrs,
+       .shost_groups = cxlflash_host_groups,
+       .sdev_groups = cxlflash_dev_groups,
 };
 
 /*