Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: usbip: convert platform driver to use dev_groups

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>

+8 -11
+1 -1
drivers/usb/usbip/vudc.h
··· 115 115 struct list_head dev_entry; 116 116 }; 117 117 118 - extern const struct attribute_group vudc_attr_group; 118 + extern const struct attribute_group *vudc_groups[]; 119 119 120 120 /* visible everywhere */ 121 121
-9
drivers/usb/usbip/vudc_dev.c
··· 616 616 if (ret < 0) 617 617 goto err_add_udc; 618 618 619 - ret = sysfs_create_group(&pdev->dev.kobj, &vudc_attr_group); 620 - if (ret) { 621 - dev_err(&udc->pdev->dev, "create sysfs files\n"); 622 - goto err_sysfs; 623 - } 624 - 625 619 platform_set_drvdata(pdev, udc); 626 620 627 621 return ret; 628 622 629 - err_sysfs: 630 - usb_del_gadget_udc(&udc->gadget); 631 623 err_add_udc: 632 624 cleanup_vudc_hw(udc); 633 625 err_init_vudc_hw: ··· 632 640 { 633 641 struct vudc *udc = platform_get_drvdata(pdev); 634 642 635 - sysfs_remove_group(&pdev->dev.kobj, &vudc_attr_group); 636 643 usb_del_gadget_udc(&udc->gadget); 637 644 cleanup_vudc_hw(udc); 638 645 kfree(udc);
+1
drivers/usb/usbip/vudc_main.c
··· 22 22 .remove = vudc_remove, 23 23 .driver = { 24 24 .name = GADGET_NAME, 25 + .dev_groups = vudc_groups, 25 26 }, 26 27 }; 27 28
+6 -1
drivers/usb/usbip/vudc_sysfs.c
··· 215 215 NULL, 216 216 }; 217 217 218 - const struct attribute_group vudc_attr_group = { 218 + static const struct attribute_group vudc_attr_group = { 219 219 .attrs = dev_attrs, 220 220 .bin_attrs = dev_bin_attrs, 221 + }; 222 + 223 + const struct attribute_group *vudc_groups[] = { 224 + &vudc_attr_group, 225 + NULL, 221 226 };