From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: shuah <shuah@kernel.org>
Cc: linux-usb@vger.kernel.org, Valentina Manea <valentina.manea.m@gmail.com>
Subject: Re: [PATCH] USB: usbip: convert platform driver to use dev_groups
Date: Tue, 6 Aug 2019 09:37:56 +0200 [thread overview]
Message-ID: <20190806073756.GA25825@kroah.com> (raw)
In-Reply-To: <06d3e73f-ac2f-9ba5-047e-e99834b4860b@kernel.org>
On Mon, Aug 05, 2019 at 02:22:18PM -0600, shuah wrote:
> On 8/5/19 1:36 PM, Greg Kroah-Hartman wrote:
> > 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>
> > Cc: Shuah Khan <shuah@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > drivers/usb/usbip/vudc.h | 2 +-
> > drivers/usb/usbip/vudc_dev.c | 9 ---------
> > drivers/usb/usbip/vudc_main.c | 1 +
> > drivers/usb/usbip/vudc_sysfs.c | 7 ++++++-
> > 4 files changed, 8 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/usb/usbip/vudc.h b/drivers/usb/usbip/vudc.h
> > index cf968192e59f..1bd4bc005829 100644
> > --- a/drivers/usb/usbip/vudc.h
> > +++ b/drivers/usb/usbip/vudc.h
> > @@ -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 */
> > diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
> > index a72c17ff1c6a..c8eeabdd9b56 100644
> > --- a/drivers/usb/usbip/vudc_dev.c
> > +++ b/drivers/usb/usbip/vudc_dev.c
> > @@ -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);
> > diff --git a/drivers/usb/usbip/vudc_main.c b/drivers/usb/usbip/vudc_main.c
> > index 390733e6937e..678faa82598c 100644
> > --- a/drivers/usb/usbip/vudc_main.c
> > +++ b/drivers/usb/usbip/vudc_main.c
> > @@ -22,6 +22,7 @@ static struct platform_driver vudc_driver = {
> > .remove = vudc_remove,
> > .driver = {
> > .name = GADGET_NAME,
> > + .dev_groups = vudc_groups,
> > },
> > };
> > diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
> > index 6dcd3ff655c3..100f680c572a 100644
> > --- a/drivers/usb/usbip/vudc_sysfs.c
> > +++ b/drivers/usb/usbip/vudc_sysfs.c
> > @@ -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,
> > +};
> >
>
> Looks good to me.
>
> Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Thanks for the review!
greg k-h
prev parent reply other threads:[~2019-08-06 7:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 19:36 [PATCH] USB: usbip: convert platform driver to use dev_groups Greg Kroah-Hartman
2019-08-05 20:22 ` shuah
2019-08-06 7:37 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190806073756.GA25825@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).