]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
USB: usbip: convert platform driver to use dev_groups
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Aug 2019 19:36:35 +0000 (21:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Aug 2019 07:40:47 +0000 (09:40 +0200)
Platform drivers now have the option to have the platform core create
and remove any needed sysfs attribute files.  So take advantage of that
and do not register "by hand" any sysfs files.

Cc: Valentina Manea <valentina.manea.m@gmail.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190805193636.25560-5-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/vudc.h
drivers/usb/usbip/vudc_dev.c
drivers/usb/usbip/vudc_main.c
drivers/usb/usbip/vudc_sysfs.c

index cf968192e59fcdd122ecfc00d0fbd1a38b6814ee..1bd4bc005829bdb71f85861d7ef57d27bf709660 100644 (file)
@@ -115,7 +115,7 @@ struct vudc_device {
        struct list_head dev_entry;
 };
 
-extern const struct attribute_group vudc_attr_group;
+extern const struct attribute_group *vudc_groups[];
 
 /* visible everywhere */
 
index a72c17ff1c6a163c8e0b3b9439a188536adb472f..c8eeabdd9b5685a1310748eedc4386b22a74af68 100644 (file)
@@ -616,18 +616,10 @@ int vudc_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_add_udc;
 
-       ret = sysfs_create_group(&pdev->dev.kobj, &vudc_attr_group);
-       if (ret) {
-               dev_err(&udc->pdev->dev, "create sysfs files\n");
-               goto err_sysfs;
-       }
-
        platform_set_drvdata(pdev, udc);
 
        return ret;
 
-err_sysfs:
-       usb_del_gadget_udc(&udc->gadget);
 err_add_udc:
        cleanup_vudc_hw(udc);
 err_init_vudc_hw:
@@ -640,7 +632,6 @@ int vudc_remove(struct platform_device *pdev)
 {
        struct vudc *udc = platform_get_drvdata(pdev);
 
-       sysfs_remove_group(&pdev->dev.kobj, &vudc_attr_group);
        usb_del_gadget_udc(&udc->gadget);
        cleanup_vudc_hw(udc);
        kfree(udc);
index 390733e6937e15f534cf28912e65ba71b0d71a70..678faa82598c7076dd9903cc14c3c296e435da73 100644 (file)
@@ -22,6 +22,7 @@ static struct platform_driver vudc_driver = {
        .remove         = vudc_remove,
        .driver         = {
                .name   = GADGET_NAME,
+               .dev_groups = vudc_groups,
        },
 };
 
index 6dcd3ff655c3367cde86919e024b9cc7d174ecec..100f680c572ae149017d6ff26cd5950533dae8be 100644 (file)
@@ -215,7 +215,12 @@ static struct bin_attribute *dev_bin_attrs[] = {
        NULL,
 };
 
-const struct attribute_group vudc_attr_group = {
+static const struct attribute_group vudc_attr_group = {
        .attrs = dev_attrs,
        .bin_attrs = dev_bin_attrs,
 };
+
+const struct attribute_group *vudc_groups[] = {
+       &vudc_attr_group,
+       NULL,
+};