Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem

From: Geert Uytterhoeven
Date: Mon Jan 14 2008 - 12:08:28 EST


On Mon, 14 Jan 2008, Jean Delvare wrote:
> On Mon, 14 Jan 2008 11:57:52 +0100 (CET), Geert Uytterhoeven wrote:
> > On Sun, 13 Jan 2008, Jon Smirl wrote:
> > > I don't know exactly what those modules tables are used for. I just
> > > copied what the other subsystems do. Maybe they are used when you make
> > > an initrd to know which drivers to copy into the image.
> >
> > Module-init-tools needs those table to create module aliases in the *.ko
> > files from the MODULE_DEVICE_TABLE(), so udev can load the modules based
> > on the device IDs when the devices appear in sysfs.
>
> I thought that the module aliases were generated by
> scripts/mod/modpost? As a matter of fact, I did not apply Jon's patch

Sorry, you're right. Too early in the morning :-)

> to module-init-tools, and "modinfo" shows me module aliases properly
> for i2c drivers that call MODULE_DEVICE_TABLE():

I've just looked it up again (I had to do a similar thing for Zorro bus
support). Module-init-tools (depmod) also creates the modules.*map files,
which are used to map from device IDs to module names. I think these are used
by udev to load the appropriate module when a device with a specific device ID
pops up in sysfs.

> $ /sbin/modinfo lm90
> filename: /lib/modules/2.6.24-rc7-git4/kernel/drivers/hwmon/lm90.ko
> author: Jean Delvare <khali@xxxxxxxxxxxx>
> description: LM90/ADM1032 driver
> license: GPL
> vermagic: 2.6.24-rc7-git4 mod_unload
> depends: hwmon
> alias: i2c:Nlm90*
> alias: i2c:Nadm1032*
> alias: i2c:Nlm99*
> alias: i2c:Nlm86*
> alias: i2c:Nmax6657*
> alias: i2c:Nadt7461*
> alias: i2c:Nmax6680*
> $
>
> "modprobe i2c:Nadm1032" loads the lm90 driver as expected.

Yes, it's also still not 100% clear to me when `i2c:Nadm1032' is used, and when
modules.i2cmap would be used...

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village  Da Vincilaan 7-D1  B-1935 Zaventem  Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@xxxxxxxxxxx
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7  B-1840 Londerzeel  Belgium
VAT BE 0413.825.160 Â RPR Brussels
Fortis Bank Zaventem  Swift GEBABEBB08A  IBAN BE39001382358619