Re: [PATCH v2 2/2] USB: misc: Add onboard_usb_hub driver
From: Greg Kroah-Hartman
Date: Thu Sep 24 2020 - 02:36:28 EST
On Wed, Sep 23, 2020 at 03:25:45PM -0700, Matthias Kaehlcke wrote:
> On Mon, Sep 21, 2020 at 06:18:37PM -0700, Matthias Kaehlcke wrote:
> > On Sun, Sep 20, 2020 at 04:17:20PM +0200, Greg Kroah-Hartman wrote:
> > > On Thu, Sep 17, 2020 at 11:46:22AM -0700, Matthias Kaehlcke wrote:
> > > >
> > > > ...
> > > >
> > > > +static int __init onboard_hub_init(void)
> > > > +{
> > > > + int rc;
> > > > +
> > > > + rc = platform_driver_register(&onboard_hub_driver);
> > > > + if (rc)
> > > > + return rc;
> > > > +
> > > > + return usb_register_device_driver(&onboard_hub_usbdev_driver, THIS_MODULE);
> > >
> > > No unwinding of the platform driver register if this fails?
> >
> > Right, will add unwinding.
> >
> > > And THIS_MODULE should not be needed, did we get the api wrong here?
> >
> > It seems you suggest to use usb_register() instead, SGTM
>
> Actually usb_register() is for registering a struct usb_driver, however
> this is a struct usb_device_driver, there doesn't seem to be a
> registration function/macro that doesn't require THIS_MODULE. Please
> provide a pointer if I'm wrong.
You are correct, I was just making a meta-comment that we got this api
wrong when adding it to the kernel and need to fix it up so that you do
not have to manually pass in the module owner. i.e. make it much like
usb_register() does.
thanks,
greg k-h