Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755904AbZKWIkT (ORCPT ); Mon, 23 Nov 2009 03:40:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755572AbZKWIkS (ORCPT ); Mon, 23 Nov 2009 03:40:18 -0500 Received: from cantor.suse.de ([195.135.220.2]:42519 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752992AbZKWIkR (ORCPT ); Mon, 23 Nov 2009 03:40:17 -0500 Date: Mon, 23 Nov 2009 09:40:22 +0100 Message-ID: From: Takashi Iwai To: Rusty Russell Cc: Ondrej Zary , linux-kernel@vger.kernel.org, Jon Masters , Jaroslav Kysela , Greg KH , Kay Sievers Subject: Re: MODULE_DEVICE_TABLE(isapnp, ...) does nothing In-Reply-To: <200911231359.54544.rusty@rustcorp.com.au> References: <200911222201.59471.linux@rainbow-software.org> <200911231359.54544.rusty@rustcorp.com.au> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4423 Lines: 136 At Mon, 23 Nov 2009 13:59:53 +1030, Rusty Russell wrote: > > On Mon, 23 Nov 2009 07:31:57 am Ondrej Zary wrote: > > The problem is that > > scripts/mod/file2alias.c simply ignores isapnp. > > AFAICT it always has, and noone has complained until now. Perhaps something > was still reading /lib/modules/`uname -r`/modules.isapnpmap? I don't think modules.isapnpmap is needed again. The question came from the fact that the isapnp device wasn't loaded automatically. But, I thought Kay already added isapnp support sometime ago, but it didn't seem to get in... Kay? > Two things are required: > 1) Modify file2alias to add aliases for isapnp. This is pretty easy. > 2) Expose the isapnp devices in sysfs where udev will match them up > (/sys/bus/isa/devices//modalias I guess?) There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice. thanks, Takashi > The first patches would look something like these. We could mangle the > PNP names a-la ISAPNP_VENDOR/ISAPNP_DEVICE, but as long as the published > modalias matches the file2alias result, it doesn't matter. > > Jaroslav? Greg? Patches for sysfs welcome... > > Thanks, > Rusty. > PS. Jon, perhaps the new decade is a good time to kill modules.*map? > > isapnp: move definitions to mod_devicetable.h so file2alias can reach them. > > Signed-off-by: Rusty Russell > > diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h > --- a/include/linux/isapnp.h > +++ b/include/linux/isapnp.h > @@ -43,10 +43,10 @@ > */ > > #ifdef __KERNEL__ > +#include > > #define DEVICE_COUNT_COMPATIBLE 4 > > -#define ISAPNP_ANY_ID 0xffff > #define ISAPNP_CARD_DEVS 8 > > #define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \ > @@ -74,12 +74,6 @@ struct isapnp_card_id { > #define ISAPNP_DEVICE_SINGLE_END \ > .card_vendor = 0, .card_device = 0 > > -struct isapnp_device_id { > - unsigned short card_vendor, card_device; > - unsigned short vendor, function; > - unsigned long driver_data; /* data private to the driver */ > -}; > - > #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) > > #define __ISAPNP__ > diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h > --- a/include/linux/mod_devicetable.h > +++ b/include/linux/mod_devicetable.h > @@ -474,4 +474,11 @@ struct platform_device_id { > __attribute__((aligned(sizeof(kernel_ulong_t)))); > }; > > +#define ISAPNP_ANY_ID 0xffff > +struct isapnp_device_id { > + unsigned short card_vendor, card_device; > + unsigned short vendor, function; > + kernel_ulong_t driver_data; /* data private to the driver */ > +}; > + > #endif /* LINUX_MOD_DEVICETABLE_H */ > > > isapnp: put aliases in .modinfo so modinfo can find them. > > Once isa devices publish a modalias field, I think udev should "Just Work". > > Signed-off-by: Rusty Russell > > diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c > --- a/scripts/mod/file2alias.c > +++ b/scripts/mod/file2alias.c > @@ -727,6 +727,19 @@ static int do_platform_entry(const char > return 1; > } > > +/* Format is: isa:cvNcdNvNfN */ > +static int do_isapnp_entry(const char *filename, > + struct isapnp_device_id *id, char *alias) > +{ > + strcpy(alias, "isa:"); > + ADD(alias, "cv", id->card_vendor != ISAPNP_ANY_ID, id->card_vendor); > + ADD(alias, "cd", id->card_device != ISAPNP_ANY_ID, id->card_device); > + ADD(alias, "v", id->vendor != ISAPNP_ANY_ID, id->vendor); > + ADD(alias, "f", id->function, id->function); > + add_wildcard(alias); > + return 1; > +} > + > /* Ignore any prefix, eg. some architectures prepend _ */ > static inline int sym_is(const char *symbol, const char *name) > { > @@ -874,6 +887,10 @@ void handle_moddevtable(struct module *m > do_table(symval, sym->st_size, > sizeof(struct platform_device_id), "platform", > do_platform_entry, mod); > + else if (sym_is(symname, "__mod_isapnp_device_table")) > + do_table(symval, sym->st_size, > + sizeof(struct isapnp_device_id), "isa", > + do_isapnp_entry, mod); > free(zeros); > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/