Re: [PATCH v2 45/46] scsi: usb: Switch to attribute groups

Greg Kroah-Hartman
2021-10-08T05:39:18Z

On Thu, Oct 07, 2021 at 02:18:51PM -0700, Bart Van Assche wrote:
> struct device supports attribute groups directly but does not support
> struct device_attribute directly. Hence switch to attribute groups.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/usb/storage/scsiglue.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
> index e5a971b83e3f..123273c52fc8 100644
> --- a/drivers/usb/storage/scsiglue.c
> +++ b/drivers/usb/storage/scsiglue.c
> @@ -588,11 +588,20 @@ 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,
> };
>
> +static const struct attribute_group usb_sdev_attr_group = {
> + .attrs = usb_sdev_attrs
> +};
> +
> +static const struct attribute_group *usb_sdev_attr_groups[] = {
> + &usb_sdev_attr_group,
> + NULL
> +};

ATTRIBUTE_GROUPS()?