summaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-10-22 11:03:39 +1000
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 15:49:55 +1000
commitb01d9f2863349b0e041b90c3c86a998ee0fed2b0 (patch)
tree8789a06631a0ee502c58388d12c230eb4a2059b2 /scripts/mod/file2alias.c
parent31610434bc3523c0b01a10917a1185096a03c4c8 (diff)
Module autoprobing support for virtio drivers.
This adds the logic to convert the virtio ids into module aliases, and includes a modalias entry in sysfs and the env var to make probing work. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 91c15da2680..d802b5afae8 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -525,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)
{
@@ -651,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);
}