Commit 91148dba authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarShuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190805193636.25560-5-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c5d16537
......@@ -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 */
......
......@@ -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);
......
......@@ -22,6 +22,7 @@ static struct platform_driver vudc_driver = {
.remove = vudc_remove,
.driver = {
.name = GADGET_NAME,
.dev_groups = vudc_groups,
},
};
......
......@@ -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,
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment