scsi: usb: Switch to attribute groups
authorBart Van Assche <bvanassche@acm.org>
Tue, 12 Oct 2021 23:35:57 +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-46-bvanassche@acm.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/usb/storage/scsiglue.c

index 220aa1cf4b3d4dd891826827a00554facbe30d42..8931df5a85fd9e49de0e8b8f399771405168ed06 100644 (file)
@@ -587,11 +587,13 @@ static ssize_t max_sectors_store(struct device *dev, struct device_attribute *at
 }
 static DEVICE_ATTR_RW(max_sectors);
 
-static struct device_attribute *sysfs_device_attr_list[] = {
-       &dev_attr_max_sectors,
+static struct attribute *usb_sdev_attrs[] = {
+       &dev_attr_max_sectors.attr,
        NULL,
 };
 
+ATTRIBUTE_GROUPS(usb_sdev);
+
 /*
  * this defines our host template, with which we'll allocate hosts
  */
@@ -652,7 +654,7 @@ static const struct scsi_host_template usb_stor_host_template = {
        .skip_settle_delay =            1,
 
        /* sysfs device attributes */
-       .sdev_attrs =                   sysfs_device_attr_list,
+       .sdev_groups =                  usb_sdev_groups,
 
        /* module management */
        .module =                       THIS_MODULE