]> Pileus Git - ~andy/linux/blobdiff - scripts/mod/file2alias.c
USB: handle idVendor of 0x0000
[~andy/linux] / scripts / mod / file2alias.c
index 7abee0f2d207e37f8d9daf68d128b65816abade5..9ddf944cce290b7d38fc2982b852bc93d4c50001 100644 (file)
@@ -155,7 +155,7 @@ static void do_usb_entry_multi(struct usb_device_id *id, struct module *mod)
         * Some modules (visor) have empty slots as placeholder for
         * run-time specification that results in catch-all alias
         */
-       if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
+       if (!(id->idVendor | id->idProduct | id->bDeviceClass | id->bInterfaceClass))
                return;
 
        /* Convert numeric bcdDevice range into fnmatch-able pattern(s) */
@@ -414,13 +414,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,
@@ -532,6 +525,20 @@ static int do_ssb_entry(const char *filename,
        return 1;
 }
 
+/* Looks like: virtio:dNvN */
+static int do_virtio_entry(const char *filename, struct virtio_device_id *id,
+                          char *alias)
+{
+       id->device = TO_NATIVE(id->device);
+       id->vendor = TO_NATIVE(id->vendor);
+
+       strcpy(alias, "virtio:");
+       ADD(alias, "d", 1, id->device);
+       ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor);
+
+       return 1;
+}
+
 /* Ignore any prefix, eg. v850 prepends _ */
 static inline int sym_is(const char *symbol, const char *name)
 {
@@ -638,10 +645,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",
@@ -662,6 +665,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
                do_table(symval, sym->st_size,
                         sizeof(struct ssb_device_id), "ssb",
                         do_ssb_entry, mod);
+       else if (sym_is(symname, "__mod_virtio_device_table"))
+               do_table(symval, sym->st_size,
+                        sizeof(struct virtio_device_id), "virtio",
+                        do_virtio_entry, mod);
        free(zeros);
 }