From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S264532AbTK0Olk (ORCPT ); Thu, 27 Nov 2003 09:41:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S264536AbTK0Olk (ORCPT ); Thu, 27 Nov 2003 09:41:40 -0500 Received: from ns.suse.de ([195.135.220.2]:29902 "EHLO Cantor.suse.de") by vger.kernel.org with ESMTP id S264532AbTK0Olf (ORCPT ); Thu, 27 Nov 2003 09:41:35 -0500 Date: Thu, 27 Nov 2003 15:41:33 +0100 Message-ID: From: Takashi Iwai To: arvidjaar@mail.ru Cc: rusty@rustcorp.com.au, ambx1@neo.rr.com, linux-kernel@vger.kernel.org Subject: file2alias for pnp (Re: modules.pnpmap output support) In-Reply-To: <20031120212320.GB25417@neo.rr.com> References: <20031120050836.BFA712C2D5@lists.samba.org> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 13) (Rational FORTRAN) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Thu_Nov_27_15:41:33_2003-1" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --Multipart_Thu_Nov_27_15:41:33_2003-1 Content-Type: text/plain; charset=US-ASCII Hi, the attached is the patch to add pnp entries to file2alias.c. i moved the definitions of pnp_device_id and pnp_card_device_id into mod_devicetable.h as other devices do. if you don't like it, i'll try to revert them and put definitions inside file2alias.c to keep the changes minimum. the format of pnp alias is: pnp:dXXXYYYY or pnp:cXXXYYYYdXXXYYYY[dXXXYYYY...] where XXXYYYY is the pnp id with 7 letters (e.g. CTL0031), c shows the card id, and d means the device id. multiple device ids will be listed depending on the driver. for example, alias pnp:dYMH0021* opl3sa2 alias pnp:cALS0001d@@@0001d@X@0001d@H@0001* snd_als100 Andrey, would it be feasible for hotplug stuff? -- Takashi Iwai ALSA Developer - www.alsa-project.org --Multipart_Thu_Nov_27_15:41:33_2003-1 Content-Type: text/plain; charset=US-ASCII --- linux-2.6.0-test10/scripts/file2alias.c-dist 2003-11-26 17:10:34.000000000 +0100 +++ linux-2.6.0-test10/scripts/file2alias.c 2003-11-26 17:33:54.000000000 +0100 @@ -169,6 +169,28 @@ return 1; } +/* looks like: "pnp:dD" */ +static int do_pnp_entry(const char *filename, + struct pnp_device_id *id, char *alias) +{ + sprintf(alias, "pnp:d%s", id->id); + return 1; +} + +/* looks like: "pnp:cCdD..." */ +static int do_pnp_card_entry(const char *filename, + struct pnp_card_device_id *id, char *alias) +{ + int i; + sprintf(alias, "pnp:c%s", id->id); + for (i = 0; i < PNP_MAX_DEVICES; i++) { + if (! *id->devs[i].id) + break; + sprintf(alias + strlen(alias), "d%s", id->devs[i].id); + } + return 1; +} + /* Ignore any prefix, eg. v850 prepends _ */ static inline int sym_is(const char *symbol, const char *name) { @@ -235,6 +257,12 @@ else if (sym_is(symname, "__mod_ccw_device_table")) do_table(symval, sym->st_size, sizeof(struct ccw_device_id), do_ccw_entry, mod); + else if (sym_is(symname, "__mod_pnp_device_table")) + do_table(symval, sym->st_size, sizeof(struct pnp_device_id), + do_pnp_entry, mod); + else if (sym_is(symname, "__mod_pnp_card_device_table")) + do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id), + do_pnp_card_entry, mod); } /* Now add out buffered information to the generated C source */ --- linux-2.6.0-test10/include/linux/pnp.h-dist 2003-11-26 17:23:00.000000000 +0100 +++ linux-2.6.0-test10/include/linux/pnp.h 2003-11-26 17:27:35.000000000 +0100 @@ -12,13 +12,12 @@ #include #include #include +#include #define PNP_MAX_PORT 8 #define PNP_MAX_MEM 4 #define PNP_MAX_IRQ 2 #define PNP_MAX_DMA 2 -#define PNP_MAX_DEVICES 8 -#define PNP_ID_LEN 8 #define PNP_NAME_LEN 50 struct pnp_protocol; @@ -279,19 +278,6 @@ struct pnp_id * next; }; -struct pnp_device_id { - char id[PNP_ID_LEN]; - unsigned long driver_data; /* data private to the driver */ -}; - -struct pnp_card_device_id { - char id[PNP_ID_LEN]; - unsigned long driver_data; /* data private to the driver */ - struct { - char id[PNP_ID_LEN]; - } devs[PNP_MAX_DEVICES]; /* logical devices */ -}; - struct pnp_driver { char * name; const struct pnp_device_id *id_table; --- linux-2.6.0-test10/include/linux/mod_devicetable.h-dist 2003-11-26 17:22:57.000000000 +0100 +++ linux-2.6.0-test10/include/linux/mod_devicetable.h 2003-11-26 17:27:34.000000000 +0100 @@ -148,4 +148,20 @@ #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 +#define PNP_ID_LEN 8 +#define PNP_MAX_DEVICES 8 + +struct pnp_device_id { + __u8 id[PNP_ID_LEN]; + kernel_ulong_t driver_data; /* data private to the driver */ +}; + +struct pnp_card_device_id { + __u8 id[PNP_ID_LEN]; + kernel_ulong_t driver_data; /* data private to the driver */ + struct { + __u8 id[PNP_ID_LEN]; + } devs[PNP_MAX_DEVICES]; /* logical devices */ +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ --Multipart_Thu_Nov_27_15:41:33_2003-1--