aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-06-17 05:34:23 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 14:53:33 -0400
commitd59b66c7a575cfa8e01f483875d131e42b539bbc (patch)
treeef038f24fff0e91d5d5a33cc99dbe4011b4c3afd
parent9eb3a94d022e6c233c0b22ec54516d35d2e87eb9 (diff)
sdio: add modalias support
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r--drivers/mmc/core/sdio_bus.c21
-rw-r--r--scripts/mod/file2alias.c20
2 files changed, 40 insertions, 1 deletions
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index a3a89e973d94..c834f5150888 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -68,7 +68,26 @@ static int
68sdio_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf, 68sdio_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
69 int buf_size) 69 int buf_size)
70{ 70{
71 envp[0] = NULL; 71 struct sdio_func *func = dev_to_sdio_func(dev);
72 int i = 0, length = 0;
73
74 if (add_uevent_var(envp, num_envp, &i,
75 buf, buf_size, &length,
76 "SDIO_CLASS=%02X", func->class))
77 return -ENOMEM;
78
79 if (add_uevent_var(envp, num_envp, &i,
80 buf, buf_size, &length,
81 "SDIO_ID=%04X:%04X", func->vendor, func->device))
82 return -ENOMEM;
83
84 if (add_uevent_var(envp, num_envp, &i,
85 buf, buf_size, &length,
86 "MODALIAS=sdio:c%02Xv%04Xd%04X",
87 func->class, func->vendor, func->device))
88 return -ENOMEM;
89
90 envp[i] = NULL;
72 91
73 return 0; 92 return 0;
74} 93}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 8a09021d8c59..1e5d4d693195 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -484,6 +484,22 @@ static int do_parisc_entry(const char *filename, struct parisc_device_id *id,
484 return 1; 484 return 1;
485} 485}
486 486
487/* Looks like: sdio:cNvNdN. */
488static int do_sdio_entry(const char *filename,
489 struct sdio_device_id *id, char *alias)
490{
491 id->class = TO_NATIVE(id->class);
492 id->vendor = TO_NATIVE(id->vendor);
493 id->device = TO_NATIVE(id->device);
494
495 strcpy(alias, "sdio:");
496 ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class);
497 ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor);
498 ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device);
499
500 return 1;
501}
502
487/* Ignore any prefix, eg. v850 prepends _ */ 503/* Ignore any prefix, eg. v850 prepends _ */
488static inline int sym_is(const char *symbol, const char *name) 504static inline int sym_is(const char *symbol, const char *name)
489{ 505{
@@ -599,6 +615,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
599 do_table(symval, sym->st_size, 615 do_table(symval, sym->st_size,
600 sizeof(struct parisc_device_id), "parisc", 616 sizeof(struct parisc_device_id), "parisc",
601 do_parisc_entry, mod); 617 do_parisc_entry, mod);
618 else if (sym_is(symname, "__mod_sdio_device_table"))
619 do_table(symval, sym->st_size,
620 sizeof(struct sdio_device_id), "sdio",
621 do_sdio_entry, mod);
602} 622}
603 623
604/* Now add out buffered information to the generated C source */ 624/* Now add out buffered information to the generated C source */