LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] update module-init-tools to support the i2c subsystem
@ 2007-12-18  2:39 Jon Smirl
  2008-01-13 14:27 ` [i2c] " Jean Delvare
  0 siblings, 1 reply; 14+ messages in thread
From: Jon Smirl @ 2007-12-18  2:39 UTC (permalink / raw)
  To: i2c, linuxppc-dev, linux-kernel

Follow on to: "Series to add device tree naming to i2c"
Teach module-init-tools about the i2c subsystem.

diff --git a/depmod.c b/depmod.c
index 0281c79..209eb0c 100644
--- a/depmod.c
+++ b/depmod.c
@@ -793,6 +793,7 @@ static struct depfile depfiles[] = {
 	{ "modules.inputmap", output_input_table },
 	{ "modules.ofmap", output_of_table },
 	{ "modules.seriomap", output_serio_table },
+	{ "modules.i2cmap", output_i2c_table },
 	{ "modules.alias", output_aliases },
 	{ "modules.symbols", output_symbols },
 };
diff --git a/depmod.h b/depmod.h
index 6cea36e..1040214 100644
--- a/depmod.h
+++ b/depmod.h
@@ -55,6 +55,8 @@ struct module
 	unsigned int input_table_size;
 	unsigned int serio_size;
 	void *serio_table;
+	unsigned int i2c_size;
+	void *i2c_table;
 	unsigned int of_size;
 	void *of_table;

diff --git a/moduleops_core.c b/moduleops_core.c
index 56c85d3..a7ca350 100644
--- a/moduleops_core.c
+++ b/moduleops_core.c
@@ -230,6 +230,11 @@ static void PERBIT(fetch_tables)(struct module *module)
 					"__mod_serio_device_table",
 					NULL, module->conv);

+	module->i2c_size = PERBIT(I2C_DEVICE_SIZE);
+	module->i2c_table = PERBIT(deref_sym)(module->data,
+					"__mod_i2c_device_table",
+					NULL, module->conv);
+
 	module->of_size = PERBIT(OF_DEVICE_SIZE);
 	module->of_table = PERBIT(deref_sym)(module->data,
 					"__mod_of_device_table",
diff --git a/tables.c b/tables.c
index 6dfd165..82e162d 100644
--- a/tables.c
+++ b/tables.c
@@ -496,6 +496,35 @@ void output_serio_table(struct module *modules, FILE *out)
 }


+static void output_i2c_entry(struct i2c_device_id *i2c, char *name, FILE *out)
+{
+	fprintf(out,
+		"%-20s %-20s\n",
+		name,
+		i2c->name);
+}
+
+
+void output_i2c_table(struct module *modules, FILE *out)
+{
+	struct module *i;
+
+	fprintf(out, "# i2c module         name\n");
+
+	for (i = modules; i; i = i->next) {
+		struct i2c_device_id *e;
+		char shortname[strlen(i->pathname) + 1];
+
+		if (!i->i2c_table)
+			continue;
+
+		make_shortname(shortname, i->pathname);
+		for (e = i->i2c_table; e->name[0]; e = (void *)e + i->i2c_size)
+			output_i2c_entry(e, shortname, out);
+	}
+}
+
+
 static void
 strip_whitespace (char *str, char chr)
 {
diff --git a/tables.h b/tables.h
index e5f6f35..263369d 100644
--- a/tables.h
+++ b/tables.h
@@ -164,6 +164,12 @@ struct serio_device_id {
 #define SERIO_DEVICE_SIZE32 (4 * 1)
 #define SERIO_DEVICE_SIZE64 (4 * 1 + 4)

+struct i2c_device_id {
+	char name[48];
+};
+#define I2C_DEVICE_SIZE32 (48 + 4)
+#define I2C_DEVICE_SIZE64 (48 + 8)
+
 struct of_device_id {
 	char name[32];
 	char type[32];
@@ -182,6 +188,7 @@ void output_ccw_table(struct module *modules, FILE *out);
 void output_isapnp_table(struct module *modules, FILE *out);
 void output_input_table(struct module *modules, FILE *out);
 void output_serio_table(struct module *modules, FILE *out);
+void output_i2c_table(struct module *modules, FILE *out);
 void output_of_table(struct module *modules, FILE *out);

 #endif /* MODINITTOOLS_TABLES_H */

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2007-12-18  2:39 [PATCH] update module-init-tools to support the i2c subsystem Jon Smirl
@ 2008-01-13 14:27 ` Jean Delvare
  2008-01-13 15:14   ` Jon Smirl
  0 siblings, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-01-13 14:27 UTC (permalink / raw)
  To: Jon Smirl; +Cc: i2c, linuxppc-dev, linux-kernel

On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> Follow on to: "Series to add device tree naming to i2c"
> Teach module-init-tools about the i2c subsystem.

Can you please explain what this patch does and why it is needed?

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-13 14:27 ` [i2c] " Jean Delvare
@ 2008-01-13 15:14   ` Jon Smirl
  2008-01-13 15:35     ` Jean Delvare
  0 siblings, 1 reply; 14+ messages in thread
From: Jon Smirl @ 2008-01-13 15:14 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c, linuxppc-dev, linux-kernel

On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > Follow on to: "Series to add device tree naming to i2c"
> > Teach module-init-tools about the i2c subsystem.
>
> Can you please explain what this patch does and why it is needed?

It generates the entries needed for the user space module tools to
work with the aliases. For example modprobe/depmod. It is a standard
part of the kernel module system.

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-13 15:14   ` Jon Smirl
@ 2008-01-13 15:35     ` Jean Delvare
  2008-01-13 16:26       ` Jon Smirl
  0 siblings, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-01-13 15:35 UTC (permalink / raw)
  To: Jon Smirl; +Cc: i2c, linuxppc-dev, linux-kernel

On Sun, 13 Jan 2008 10:14:14 -0500, Jon Smirl wrote:
> On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > > Follow on to: "Series to add device tree naming to i2c"
> > > Teach module-init-tools about the i2c subsystem.
> >
> > Can you please explain what this patch does and why it is needed?
> 
> It generates the entries needed for the user space module tools to
> work with the aliases. For example modprobe/depmod. It is a standard
> part of the kernel module system.

What entries, where? What can you do after applying your patch that you
couldn't do before?

I'm asking because automatic i2c driver loading works just fine for me
without patching user-space. So I don't get why your want to change
anything.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-13 15:35     ` Jean Delvare
@ 2008-01-13 16:26       ` Jon Smirl
  2008-01-13 17:43         ` Jean Delvare
  0 siblings, 1 reply; 14+ messages in thread
From: Jon Smirl @ 2008-01-13 16:26 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c, linuxppc-dev, linux-kernel

On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> On Sun, 13 Jan 2008 10:14:14 -0500, Jon Smirl wrote:
> > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > > > Follow on to: "Series to add device tree naming to i2c"
> > > > Teach module-init-tools about the i2c subsystem.
> > >
> > > Can you please explain what this patch does and why it is needed?
> >
> > It generates the entries needed for the user space module tools to
> > work with the aliases. For example modprobe/depmod. It is a standard
> > part of the kernel module system.
>
> What entries, where? What can you do after applying your patch that you
> couldn't do before?

The drivers you are testing with don't depend on other drivers.

> I'm asking because automatic i2c driver loading works just fine for me
> without patching user-space. So I don't get why your want to change
> anything.
>
> --
> Jean Delvare
>


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-13 16:26       ` Jon Smirl
@ 2008-01-13 17:43         ` Jean Delvare
  2008-01-13 18:04           ` Jon Smirl
  0 siblings, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-01-13 17:43 UTC (permalink / raw)
  To: Jon Smirl; +Cc: i2c, linuxppc-dev, linux-kernel

On Sun, 13 Jan 2008 11:26:07 -0500, Jon Smirl wrote:
> On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > On Sun, 13 Jan 2008 10:14:14 -0500, Jon Smirl wrote:
> > > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > > On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > > > > Follow on to: "Series to add device tree naming to i2c"
> > > > > Teach module-init-tools about the i2c subsystem.
> > > >
> > > > Can you please explain what this patch does and why it is needed?
> > >
> > > It generates the entries needed for the user space module tools to
> > > work with the aliases. For example modprobe/depmod. It is a standard
> > > part of the kernel module system.
> >
> > What entries, where? What can you do after applying your patch that you
> > couldn't do before?
> 
> The drivers you are testing with don't depend on other drivers.

They do. I'm testing with the lm90 driver, which depends on the hwmon
driver. Both load automatically when the underlying i2c-parport driver
instantiate an "adm1032" i2c device.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-13 17:43         ` Jean Delvare
@ 2008-01-13 18:04           ` Jon Smirl
  2008-01-14 10:57             ` Geert Uytterhoeven
  0 siblings, 1 reply; 14+ messages in thread
From: Jon Smirl @ 2008-01-13 18:04 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c, linuxppc-dev, linux-kernel

On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> On Sun, 13 Jan 2008 11:26:07 -0500, Jon Smirl wrote:
> > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > On Sun, 13 Jan 2008 10:14:14 -0500, Jon Smirl wrote:
> > > > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > > > On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > > > > > Follow on to: "Series to add device tree naming to i2c"
> > > > > > Teach module-init-tools about the i2c subsystem.
> > > > >
> > > > > Can you please explain what this patch does and why it is needed?
> > > >
> > > > It generates the entries needed for the user space module tools to
> > > > work with the aliases. For example modprobe/depmod. It is a standard
> > > > part of the kernel module system.
> > >
> > > What entries, where? What can you do after applying your patch that you
> > > couldn't do before?
> >
> > The drivers you are testing with don't depend on other drivers.
>
> They do. I'm testing with the lm90 driver, which depends on the hwmon
> driver. Both load automatically when the underlying i2c-parport driver
> instantiate an "adm1032" i2c device.

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.

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-13 18:04           ` Jon Smirl
@ 2008-01-14 10:57             ` Geert Uytterhoeven
  2008-01-14 14:25               ` Jon Smirl
  2008-01-14 16:38               ` Jean Delvare
  0 siblings, 2 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2008-01-14 10:57 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Jean Delvare, linuxppc-dev, i2c, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2464 bytes --]

On Sun, 13 Jan 2008, Jon Smirl wrote:
> On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > On Sun, 13 Jan 2008 11:26:07 -0500, Jon Smirl wrote:
> > > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > > On Sun, 13 Jan 2008 10:14:14 -0500, Jon Smirl wrote:
> > > > > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > > > > On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > > > > > > Follow on to: "Series to add device tree naming to i2c"
> > > > > > > Teach module-init-tools about the i2c subsystem.
> > > > > >
> > > > > > Can you please explain what this patch does and why it is needed?
> > > > >
> > > > > It generates the entries needed for the user space module tools to
> > > > > work with the aliases. For example modprobe/depmod. It is a standard
> > > > > part of the kernel module system.
> > > >
> > > > What entries, where? What can you do after applying your patch that you
> > > > couldn't do before?
> > >
> > > The drivers you are testing with don't depend on other drivers.
> >
> > They do. I'm testing with the lm90 driver, which depends on the hwmon
> > driver. Both load automatically when the underlying i2c-parport driver
> > instantiate an "adm1032" i2c device.
> 
> 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.

That's the generic part. How this applies to i2c devices on platforms
without Open Firmware device trees is another question. I guess that's
where Jean gets confused (i2c_device_id got _removed_ last year,
because it didn't make sense (at the time?)).

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@sonycom.com
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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-14 10:57             ` Geert Uytterhoeven
@ 2008-01-14 14:25               ` Jon Smirl
  2008-01-14 16:38               ` Jean Delvare
  1 sibling, 0 replies; 14+ messages in thread
From: Jon Smirl @ 2008-01-14 14:25 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Jean Delvare, linuxppc-dev, i2c, linux-kernel

On 1/14/08, Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> On Sun, 13 Jan 2008, Jon Smirl wrote:
> > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > On Sun, 13 Jan 2008 11:26:07 -0500, Jon Smirl wrote:
> > > > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > > > On Sun, 13 Jan 2008 10:14:14 -0500, Jon Smirl wrote:
> > > > > > On 1/13/08, Jean Delvare <khali@linux-fr.org> wrote:
> > > > > > > On Mon, 17 Dec 2007 21:39:37 -0500, Jon Smirl wrote:
> > > > > > > > Follow on to: "Series to add device tree naming to i2c"
> > > > > > > > Teach module-init-tools about the i2c subsystem.
> > > > > > >
> > > > > > > Can you please explain what this patch does and why it is needed?
> > > > > >
> > > > > > It generates the entries needed for the user space module tools to
> > > > > > work with the aliases. For example modprobe/depmod. It is a standard
> > > > > > part of the kernel module system.
> > > > >
> > > > > What entries, where? What can you do after applying your patch that you
> > > > > couldn't do before?
> > > >
> > > > The drivers you are testing with don't depend on other drivers.
> > >
> > > They do. I'm testing with the lm90 driver, which depends on the hwmon
> > > driver. Both load automatically when the underlying i2c-parport driver
> > > instantiate an "adm1032" i2c device.
> >
> > 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.
>
> That's the generic part. How this applies to i2c devices on platforms
> without Open Firmware device trees is another question. I guess that's
> where Jean gets confused (i2c_device_id got _removed_ last year,
> because it didn't make sense (at the time?)).

Last year i2c modules weren't dynamically loadable so it wasn't needed.

>
> 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@sonycom.com
> 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


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c  subsystem
  2008-01-14 10:57             ` Geert Uytterhoeven
  2008-01-14 14:25               ` Jon Smirl
@ 2008-01-14 16:38               ` Jean Delvare
  2008-01-14 17:08                 ` Geert Uytterhoeven
  1 sibling, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-01-14 16:38 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Jon Smirl, linuxppc-dev, i2c, linux-kernel

Hi Geert,

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
to module-init-tools, and "modinfo" shows me module aliases properly
for i2c drivers that call MODULE_DEVICE_TABLE():

$ /sbin/modinfo lm90
filename:       /lib/modules/2.6.24-rc7-git4/kernel/drivers/hwmon/lm90.ko
author:         Jean Delvare <khali@linux-fr.org>
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.

> That's the generic part. How this applies to i2c devices on platforms
> without Open Firmware device trees is another question. I guess that's
> where Jean gets confused (i2c_device_id got _removed_ last year,
> because it didn't make sense (at the time?)).

The way it was implemented back then did not make sense. As it was not
clear whether we would implement something different or nothing at all,
I decided to plain remove it. Now that it seems that we want to
implement it differently, I'm looking into it again.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c  subsystem
  2008-01-14 16:38               ` Jean Delvare
@ 2008-01-14 17:08                 ` Geert Uytterhoeven
  2008-01-14 17:50                   ` Jean Delvare
  0 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2008-01-14 17:08 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linuxppc-dev, linux-kernel, i2c

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2475 bytes --]

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@linux-fr.org>
> 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@sonycom.com
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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c   subsystem
  2008-01-14 17:08                 ` Geert Uytterhoeven
@ 2008-01-14 17:50                   ` Jean Delvare
  2008-01-14 19:38                     ` Kay Sievers
  0 siblings, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-01-14 17:50 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linuxppc-dev, linux-kernel, i2c

On Mon, 14 Jan 2008 18:08:16 +0100 (CET), Geert Uytterhoeven wrote:
> On Mon, 14 Jan 2008, Jean Delvare wrote:
> > 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.

Ah, right. I see it now, there's modules.isapnpmap,
modules.ieee1394map, modules.pcimap etc. but no modules.i2cmap.
However, there is modules.alias which contains the i2c aliases for all
device types (including one ieee1394 and many pci aliases) which seems
somewhat redundant with the modules.*map files.

> > $ /sbin/modinfo lm90
> > filename:       /lib/modules/2.6.24-rc7-git4/kernel/drivers/hwmon/lm90.ko
> > author:         Jean Delvare <khali@linux-fr.org>
> > 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...

I am under the impression that modules.*map are the old way to get
automatic driver loading and aliases are the new way to do the same.
But maybe that's just me.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-14 17:50                   ` Jean Delvare
@ 2008-01-14 19:38                     ` Kay Sievers
  2008-01-14 19:46                       ` Jean Delvare
  0 siblings, 1 reply; 14+ messages in thread
From: Kay Sievers @ 2008-01-14 19:38 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Geert Uytterhoeven, linuxppc-dev, linux-kernel, i2c

On Jan 14, 2008 6:50 PM, Jean Delvare <khali@linux-fr.org> wrote:
> On Mon, 14 Jan 2008 18:08:16 +0100 (CET), Geert Uytterhoeven wrote:
> > On Mon, 14 Jan 2008, Jean Delvare wrote:
> > > 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.
>
> Ah, right. I see it now, there's modules.isapnpmap,
> modules.ieee1394map, modules.pcimap etc. but no modules.i2cmap.
> However, there is modules.alias which contains the i2c aliases for all
> device types (including one ieee1394 and many pci aliases) which seems
> somewhat redundant with the modules.*map files.
>
> > > $ /sbin/modinfo lm90
> > > filename:       /lib/modules/2.6.24-rc7-git4/kernel/drivers/hwmon/lm90.ko
> > > author:         Jean Delvare <khali@linux-fr.org>
> > > 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...
>
> I am under the impression that modules.*map are the old way to get
> automatic driver loading and aliases are the new way to do the same.
> But maybe that's just me.

Right, nothing on recent systems is using the map files. This patch
should not be needed.
The plan is to deprecate the creation of these files in depmod.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [i2c] [PATCH] update module-init-tools to support the i2c subsystem
  2008-01-14 19:38                     ` Kay Sievers
@ 2008-01-14 19:46                       ` Jean Delvare
  0 siblings, 0 replies; 14+ messages in thread
From: Jean Delvare @ 2008-01-14 19:46 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Geert Uytterhoeven, linuxppc-dev, linux-kernel, i2c

On Mon, 14 Jan 2008 20:38:28 +0100, Kay Sievers wrote:
> On Jan 14, 2008 6:50 PM, Jean Delvare <khali@linux-fr.org> wrote:
> > I am under the impression that modules.*map are the old way to get
> > automatic driver loading and aliases are the new way to do the same.
> > But maybe that's just me.
> 
> Right, nothing on recent systems is using the map files. This patch
> should not be needed.
> The plan is to deprecate the creation of these files in depmod.

OK, great. Thanks for the info, Kay!

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-01-14 19:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-18  2:39 [PATCH] update module-init-tools to support the i2c subsystem Jon Smirl
2008-01-13 14:27 ` [i2c] " Jean Delvare
2008-01-13 15:14   ` Jon Smirl
2008-01-13 15:35     ` Jean Delvare
2008-01-13 16:26       ` Jon Smirl
2008-01-13 17:43         ` Jean Delvare
2008-01-13 18:04           ` Jon Smirl
2008-01-14 10:57             ` Geert Uytterhoeven
2008-01-14 14:25               ` Jon Smirl
2008-01-14 16:38               ` Jean Delvare
2008-01-14 17:08                 ` Geert Uytterhoeven
2008-01-14 17:50                   ` Jean Delvare
2008-01-14 19:38                     ` Kay Sievers
2008-01-14 19:46                       ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).