[i2c] [patch 2.6.21-rc3-git +i2c 2/5] i2c stack can remove()
David Brownell
david-b at pacbell.net
Sun Mar 11 05:48:38 CET 2007
On Friday 09 March 2007 12:53 pm, Jean Delvare wrote:
> > +void i2c_unregister_driver(struct i2c_driver *driver)
> > +{
> > + if (!driver->remove) {
> > + printk(KERN_WARNING "i2c-core: legacy driver [%s] "
> > + "can't use i2c_unregister_driver\n",
> > + driver->driver.name);
> > + return;
> > + }
> > + driver_unregister(&driver->driver);
> > +}
> > +EXPORT_SYMBOL(i2c_unregister_driver);
>
> You have a bug here, you forgot to remove the driver from the i2c-core
> internal drivers list. Any subsequent operation on this list will result
> in an oops of some sort.
Looks like I should have reviewed the ramifications of dropping
that one patch of yours ... whoops!
> Additionally, I know we discussed this before and I was in favor of
> this separate function for unregistering new-style drivers but... A
> real world experiment convinced me easily that this wasn't a good idea.
> Nobody checks the return value of i2c_del_driver() which is called by
> all drivers for now, so people won't notice they are doing something
> wrong when porting drivers to the new model.
In that case, it would make sense to change the signature. None of
the standard driver model calls report faults on those code paths
either -- for the same reasons.
> It took me quite some time
> to figure it out. So I suggest to get rid of i2c_unregister_driver as
> follows:
> [ deleted ]
>
> What do you think?
Looks about right. I'll probably roll that into a revised patch.
- Dave
More information about the i2c
mailing list