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

USB: phy: tahvo: 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-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+3 -15
+3 -15
drivers/usb/phy/phy-tahvo.c
··· 312 312 } 313 313 static DEVICE_ATTR_RW(otg_mode); 314 314 315 - static struct attribute *tahvo_attributes[] = { 315 + static struct attribute *tahvo_attrs[] = { 316 316 &dev_attr_vbus.attr, 317 317 &dev_attr_otg_mode.attr, 318 318 NULL 319 319 }; 320 - 321 - static const struct attribute_group tahvo_attr_group = { 322 - .attrs = tahvo_attributes, 323 - }; 320 + ATTRIBUTE_GROUPS(tahvo); 324 321 325 322 static int tahvo_usb_probe(struct platform_device *pdev) 326 323 { ··· 403 406 goto err_remove_phy; 404 407 } 405 408 406 - /* Attributes */ 407 - ret = sysfs_create_group(&pdev->dev.kobj, &tahvo_attr_group); 408 - if (ret) { 409 - dev_err(&pdev->dev, "cannot create sysfs group: %d\n", ret); 410 - goto err_free_irq; 411 - } 412 - 413 409 return 0; 414 410 415 - err_free_irq: 416 - free_irq(tu->irq, tu); 417 411 err_remove_phy: 418 412 usb_remove_phy(&tu->phy); 419 413 err_disable_clk: ··· 418 430 { 419 431 struct tahvo_usb *tu = platform_get_drvdata(pdev); 420 432 421 - sysfs_remove_group(&pdev->dev.kobj, &tahvo_attr_group); 422 433 free_irq(tu->irq, tu); 423 434 usb_remove_phy(&tu->phy); 424 435 if (!IS_ERR(tu->ick)) ··· 431 444 .remove = tahvo_usb_remove, 432 445 .driver = { 433 446 .name = "tahvo-usb", 447 + .dev_groups = tahvo_groups, 434 448 }, 435 449 }; 436 450 module_platform_driver(tahvo_usb_driver);