Re: [PATCH] i2c: driver for the Synopsys DesignWare I2C controller

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

 



2009/5/31 Baruch Siach <baruch@xxxxxxxxxx>:
> On Thu, May 28, 2009 at 09:32:37AM +0200, Linus Walleij wrote:
>> 2009/5/28 Baruch Siach <baruch@xxxxxxxxxx>:
>>
>> >> > +static int dw_i2c_probe(struct platform_device *pdev)
>> >>
>> >> Can you tag this with __init?
>> >
>> > OK. __devinit is probably better.
>>
>> I don't think any platform_device tagged with __devinit is
>> correct really, platform_device:s cannot  be hotplugged that's
>> against the definition of a platform_device.
>
> Doesn't this __devinit have something to do with the ability to compile the
> driver as a module (as is the case here)? See for example
> drivers/watchdog/omap_wdt.c and commit
> 0e3912c75f42986c17d955542247bf04c6eef738

In that case I doubt that even module_init() could be __init, as it is.

The linkage handling of these symbols is defined in:
include/asm-generic/vmlinux.lds.h

As you can see:

#ifdef CONFIG_HOTPLUG
#define DEV_KEEP(sec)    *(.dev##sec)
#define DEV_DISCARD(sec)
#else
#define DEV_KEEP(sec)
#define DEV_DISCARD(sec) *(.dev##sec)
#endif

Further down the file you can see how this is handled in different
kinds of symbols. It is kept if CONFIG_HOTPLUG is set, it is moved
into the DATA_DATA section and kept in memory (so that it can be
reused when devices are plugged/unplugged) else it is discarded
after init.

In practice this means that if you device is _NOT_ hot-pluggable, the
kernel will still nevertheless keep all the code in __devinit and
__devexit around which means that __devinit code cannot be
free:ed after init and it increases the footprint of your kernel for no
good reason.

Linus
--
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