Re: [char-misc-next 02/11 V2] mei: bus: Implement driver registration

From: Samuel Ortiz
Date: Sat Feb 09 2013 - 22:32:27 EST


Hi Greg,

On Fri, Feb 08, 2013 at 03:55:24PM -0800, Greg KH wrote:
> On Fri, Feb 08, 2013 at 02:28:15PM +0200, Tomas Winkler wrote:
> > From: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
> >
> > Signed-off-by: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
> > Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
> > Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
> > ---
> > drivers/misc/mei/bus.c | 29 +++++++++++++++++++++++++++++
> > include/linux/mei_bus.h | 3 +++
> > 2 files changed, 32 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
> > index bb96423c..0a5e624 100644
> > --- a/drivers/misc/mei/bus.c
> > +++ b/drivers/misc/mei/bus.c
> > @@ -153,3 +153,32 @@ void mei_remove_device(struct mei_bus_client *client)
> > device_unregister(&client->dev);
> > }
> > EXPORT_SYMBOL(mei_remove_device);
> > +
> > +int mei_driver_register(struct mei_bus_driver *driver)
> > +{
> > + int err;
> > +
> > + /* Can't register until after driver model init */
> > + if (unlikely(WARN_ON(!mei_bus_type.p)))
> > + return -EAGAIN;
>
> No, you really don't know what 'p' is, so don't assume you do. You have
> fields you can test to see if your driver model is up and registered,
> use them instead.
Unless I'm missing something, I would actually need to track if the bus type
is registered or not from bus.c. I can't find any field from bus_type that
tells me for sure if my bus is registered or not, except for p.
I actually think I don't need that check anyway. IIRC, this is something I
took from i2c-core.c but in the ME case it's most likely not needed.


> > + driver->driver.owner = THIS_MODULE;
>
> Nope, this should be the module that owns the driver, not this one. It
> needs to be passed in with the call, or as part of the driver structure.
That's right, I'll fix that.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/