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

USB: phy: mv-usb: 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: Felipe Balbi <balbi@kernel.org>
Link: https://lore.kernel.org/r/20190805193636.25560-3-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+6 -11
+6 -11
drivers/usb/phy/phy-mv-usb.c
··· 641 641 .attrs = inputs_attrs, 642 642 }; 643 643 644 + static const struct attribute_group *mv_otg_groups[] = { 645 + &inputs_attr_group, 646 + NULL, 647 + }; 648 + 644 649 static int mv_otg_remove(struct platform_device *pdev) 645 650 { 646 651 struct mv_otg *mvotg = platform_get_drvdata(pdev); 647 - 648 - sysfs_remove_group(&mvotg->pdev->dev.kobj, &inputs_attr_group); 649 652 650 653 if (mvotg->qwork) { 651 654 flush_workqueue(mvotg->qwork); ··· 812 809 goto err_disable_clk; 813 810 } 814 811 815 - retval = sysfs_create_group(&pdev->dev.kobj, &inputs_attr_group); 816 - if (retval < 0) { 817 - dev_dbg(&pdev->dev, 818 - "Can't register sysfs attr group: %d\n", retval); 819 - goto err_remove_phy; 820 - } 821 - 822 812 spin_lock_init(&mvotg->wq_lock); 823 813 if (spin_trylock(&mvotg->wq_lock)) { 824 814 mv_otg_run_state_machine(mvotg, 2 * HZ); ··· 824 828 825 829 return 0; 826 830 827 - err_remove_phy: 828 - usb_remove_phy(&mvotg->phy); 829 831 err_disable_clk: 830 832 mv_otg_disable_internal(mvotg); 831 833 err_destroy_workqueue: ··· 877 883 .remove = mv_otg_remove, 878 884 .driver = { 879 885 .name = driver_name, 886 + .dev_groups = mv_otg_groups, 880 887 }, 881 888 #ifdef CONFIG_PM 882 889 .suspend = mv_otg_suspend,