From: Takashi Iwai <tiwai@suse.de>
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)
Date: Thu, 27 Nov 2003 15:41:33 +0100 [thread overview]
Message-ID: <s5hn0ahdgbm.wl@alsa2.suse.de> (raw)
In-Reply-To: <s5h65hf1iou.wl@alsa2.suse.de> <20031120212320.GB25417@neo.rr.com>
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
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 <tiwai@suse.de> ALSA Developer - www.alsa-project.org
[-- Attachment #2: Type: text/plain, Size: 2983 bytes --]
--- 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 <linux/device.h>
#include <linux/list.h>
#include <linux/errno.h>
+#include <linux/mod_devicetable.h>
#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 */
next prev parent reply other threads:[~2003-11-27 14:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-17 12:37 modules.pnpmap output support "Andrey Borzenkov"
2003-11-17 13:34 ` Takashi Iwai
2003-11-17 14:05 ` Takashi Iwai
2003-11-20 4:35 ` Rusty Russell
2003-11-20 9:40 ` Takashi Iwai
2003-11-17 15:07 ` "Andrey Borzenkov"
2003-11-17 15:37 ` Takashi Iwai
2003-11-20 21:23 ` Adam Belay
2003-11-21 11:44 ` Takashi Iwai
2003-11-23 22:07 ` Adam Belay
2003-11-25 10:29 ` Takashi Iwai
2003-11-27 14:41 ` Takashi Iwai [this message]
2003-11-27 18:58 ` file2alias for pnp (Re: modules.pnpmap output support) Andrey Borzenkov
2003-11-28 12:11 ` Takashi Iwai
2003-12-02 22:31 ` Adam Belay
2003-12-03 11:31 ` Takashi Iwai
2003-11-18 3:07 ` modules.pnpmap output support Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hn0ahdgbm.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=ambx1@neo.rr.com \
--cc=arvidjaar@mail.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.