Re: [PATCH] i2c: Minor fixes to upgrading-clients document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 20 Feb 2011 15:08:38 +0100, Wolfram Sang wrote:
> On Sun, Feb 20, 2011 at 03:04:08PM +0100, Jean Delvare wrote:
> 
> > * Typical legacy drivers implemented method .detach_client, not
> >   .detach_adapter.
> > * Drop all references to __devexit, as i2c drivers shouldn't use it.
> 
> Even not in remove()? 40 out of 84 drivers are doing so.

Well, unless I am seriously mistaken, this isn't always safe.

Consider the case where !CONFIG_HOTPLUG and your i2c device driver is
built into the kernel (not as a module). The __devexit function will be
stripped at link time. If the i2c _bus_ driver is built as a module, it
can be inserted and removed at any time. When the bus driver is
removed, the .remove() method of every I2C device on this bus should be
called, except that your driver won't have any, so the clean-up won't
happen and you end up with a half-registered device.

So __devexit on the remove function on an i2c device driver is only
safe if the i2c bus driver is built into the kernel. Unfortunately,
unless !CONFIG_MODULES, the i2c device drivers have no way to tell if
this will be the case.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux