diff mbox series

[v1,04/10] xhci: dbc: Use ATTRIBUTE_GROUPS()

Message ID 20231002161610.2648818-4-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,01/10] xhci: dbc: Drop duplicate checks for dma_free_coherent() | expand

Commit Message

Andy Shevchenko Oct. 2, 2023, 4:16 p.m. UTC
Embrace ATTRIBUTE_GROUPS() to avoid boiler plate code.
This should not introduce any functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/host/xhci-dbgcap.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Mathias Nyman Oct. 11, 2023, 2:18 p.m. UTC | #1
On 2.10.2023 19.16, Andy Shevchenko wrote:
> Embrace ATTRIBUTE_GROUPS() to avoid boiler plate code.
> This should not introduce any functional changes.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/usb/host/xhci-dbgcap.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
> index 92869c67a430..3c90410e9cde 100644
> --- a/drivers/usb/host/xhci-dbgcap.c
> +++ b/drivers/usb/host/xhci-dbgcap.c
> @@ -1124,7 +1124,7 @@ static DEVICE_ATTR_RW(dbc_idProduct);
>   static DEVICE_ATTR_RW(dbc_bcdDevice);
>   static DEVICE_ATTR_RW(dbc_bInterfaceProtocol);
>   
> -static struct attribute *dbc_dev_attributes[] = {
> +static struct attribute *dbc_dev_attrs[] = {
>   	&dev_attr_dbc.attr,
>   	&dev_attr_dbc_idVendor.attr,
>   	&dev_attr_dbc_idProduct.attr,
> @@ -1132,10 +1132,7 @@ static struct attribute *dbc_dev_attributes[] = {
>   	&dev_attr_dbc_bInterfaceProtocol.attr,
>   	NULL
>   };
> -
> -static const struct attribute_group dbc_dev_attrib_grp = {
> -	.attrs = dbc_dev_attributes,
> -};
> +ATTRIBUTE_GROUPS(dbc_dev);
>   
>   struct xhci_dbc *
>   xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver *driver)
> @@ -1161,7 +1158,7 @@ xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver *
>   	INIT_DELAYED_WORK(&dbc->event_work, xhci_dbc_handle_events);
>   	spin_lock_init(&dbc->lock);
>   
> -	ret = sysfs_create_group(&dev->kobj, &dbc_dev_attrib_grp);
> +	ret = sysfs_create_groups(&dev->kobj, &dbc_dev_groups)  
Compiler warns:

drivers/usb/host/xhci-dbgcap.c:1186:40: error: passing argument 2 of ‘sysfs_create_groups’ from incompatible pointer type

should probably be:
sysfs_create_groups(&dev->kobj, dbc_dev_groups)

-Mathias
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 92869c67a430..3c90410e9cde 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -1124,7 +1124,7 @@  static DEVICE_ATTR_RW(dbc_idProduct);
 static DEVICE_ATTR_RW(dbc_bcdDevice);
 static DEVICE_ATTR_RW(dbc_bInterfaceProtocol);
 
-static struct attribute *dbc_dev_attributes[] = {
+static struct attribute *dbc_dev_attrs[] = {
 	&dev_attr_dbc.attr,
 	&dev_attr_dbc_idVendor.attr,
 	&dev_attr_dbc_idProduct.attr,
@@ -1132,10 +1132,7 @@  static struct attribute *dbc_dev_attributes[] = {
 	&dev_attr_dbc_bInterfaceProtocol.attr,
 	NULL
 };
-
-static const struct attribute_group dbc_dev_attrib_grp = {
-	.attrs = dbc_dev_attributes,
-};
+ATTRIBUTE_GROUPS(dbc_dev);
 
 struct xhci_dbc *
 xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver *driver)
@@ -1161,7 +1158,7 @@  xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver *
 	INIT_DELAYED_WORK(&dbc->event_work, xhci_dbc_handle_events);
 	spin_lock_init(&dbc->lock);
 
-	ret = sysfs_create_group(&dev->kobj, &dbc_dev_attrib_grp);
+	ret = sysfs_create_groups(&dev->kobj, &dbc_dev_groups);
 	if (ret)
 		goto err;
 
@@ -1180,7 +1177,7 @@  void xhci_dbc_remove(struct xhci_dbc *dbc)
 	xhci_dbc_stop(dbc);
 
 	/* remove sysfs files */
-	sysfs_remove_group(&dbc->dev->kobj, &dbc_dev_attrib_grp);
+	sysfs_remove_groups(&dbc->dev->kobj, &dbc_dev_groups);
 
 	kfree(dbc);
 }