Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[deliverable/linux.git] / scripts / mod / file2alias.c
index ed1244dd58d091d72062c94d555ac19e881b6aae..494435ca88fa704ef130ae4d9fd8e8d18456886f 100644 (file)
@@ -290,6 +290,14 @@ static int do_serio_entry(const char *filename,
        return 1;
 }
 
+/* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */
+static int do_acpi_entry(const char *filename,
+                       struct acpi_device_id *id, char *alias)
+{
+       sprintf(alias, "acpi*:%s:", id->id);
+       return 1;
+}
+
 /* looks like: "pnp:dD" */
 static int do_pnp_entry(const char *filename,
                        struct pnp_device_id *id, char *alias)
@@ -353,11 +361,16 @@ static int do_pcmcia_entry(const char *filename,
 
 static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
 {
+    int len;
     char *tmp;
-    sprintf (alias, "of:N%sT%sC%s",
+    len = sprintf (alias, "of:N%sT%s",
                     of->name[0] ? of->name : "*",
-                    of->type[0] ? of->type : "*",
-                    of->compatible[0] ? of->compatible : "*");
+                    of->type[0] ? of->type : "*");
+
+    if (of->compatible[0])
+        sprintf (&alias[len], "%sC%s",
+                     of->type[0] ? "*" : "",
+                     of->compatible);
 
     /* Replace all whitespace with underscores */
     for (tmp = alias; tmp && *tmp; tmp++)
@@ -383,13 +396,6 @@ static int do_vio_entry(const char *filename, struct vio_device_id *vio,
        return 1;
 }
 
-static int do_i2c_entry(const char *filename, struct i2c_device_id *i2c, char *alias)
-{
-       strcpy(alias, "i2c:");
-       ADD(alias, "id", 1, i2c->id);
-       return 1;
-}
-
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 static void do_input(char *alias,
@@ -471,6 +477,36 @@ static int do_parisc_entry(const char *filename, struct parisc_device_id *id,
        return 1;
 }
 
+/* Looks like: sdio:cNvNdN. */
+static int do_sdio_entry(const char *filename,
+                       struct sdio_device_id *id, char *alias)
+{
+       id->class = TO_NATIVE(id->class);
+       id->vendor = TO_NATIVE(id->vendor);
+       id->device = TO_NATIVE(id->device);
+
+       strcpy(alias, "sdio:");
+       ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class);
+       ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor);
+       ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device);
+       return 1;
+}
+
+/* Looks like: ssb:vNidNrevN. */
+static int do_ssb_entry(const char *filename,
+                       struct ssb_device_id *id, char *alias)
+{
+       id->vendor = TO_NATIVE(id->vendor);
+       id->coreid = TO_NATIVE(id->coreid);
+       id->revision = TO_NATIVE(id->revision);
+
+       strcpy(alias, "ssb:");
+       ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor);
+       ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid);
+       ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision);
+       return 1;
+}
+
 /* Ignore any prefix, eg. v850 prepends _ */
 static inline int sym_is(const char *symbol, const char *name)
 {
@@ -546,6 +582,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
                do_table(symval, sym->st_size,
                         sizeof(struct serio_device_id), "serio",
                         do_serio_entry, mod);
+       else if (sym_is(symname, "__mod_acpi_device_table"))
+               do_table(symval, sym->st_size,
+                        sizeof(struct acpi_device_id), "acpi",
+                        do_acpi_entry, mod);
        else if (sym_is(symname, "__mod_pnp_device_table"))
                do_table(symval, sym->st_size,
                         sizeof(struct pnp_device_id), "pnp",
@@ -566,10 +606,6 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
                do_table(symval, sym->st_size,
                         sizeof(struct vio_device_id), "vio",
                         do_vio_entry, mod);
-       else if (sym_is(symname, "__mod_i2c_device_table"))
-               do_table(symval, sym->st_size,
-                        sizeof(struct i2c_device_id), "i2c",
-                        do_i2c_entry, mod);
        else if (sym_is(symname, "__mod_input_device_table"))
                do_table(symval, sym->st_size,
                         sizeof(struct input_device_id), "input",
@@ -582,6 +618,14 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
                do_table(symval, sym->st_size,
                         sizeof(struct parisc_device_id), "parisc",
                         do_parisc_entry, mod);
+       else if (sym_is(symname, "__mod_sdio_device_table"))
+               do_table(symval, sym->st_size,
+                        sizeof(struct sdio_device_id), "sdio",
+                        do_sdio_entry, mod);
+       else if (sym_is(symname, "__mod_ssb_device_table"))
+               do_table(symval, sym->st_size,
+                        sizeof(struct ssb_device_id), "ssb",
+                        do_ssb_entry, mod);
 }
 
 /* Now add out buffered information to the generated C source */
This page took 0.03975 seconds and 5 git commands to generate.