aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/bus.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-06-17 05:18:46 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 14:52:20 -0400
commit9eb3a94d022e6c233c0b22ec54516d35d2e87eb9 (patch)
tree9fbef79c6d0440597bc43443de310df166c6de46 /drivers/mmc/core/bus.c
parent3b38bea0d976513970f947806b08b9faca418e7a (diff)
mmc: whip bus uevent handler into shape
Make the mmc bus uevent callback look like all other subsystems. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/bus.c')
-rw-r--r--drivers/mmc/core/bus.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 9be11ec05d8..1cc11714916 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -62,31 +62,34 @@ mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
62 int buf_size) 62 int buf_size)
63{ 63{
64 struct mmc_card *card = dev_to_mmc_card(dev); 64 struct mmc_card *card = dev_to_mmc_card(dev);
65 int retval = 0, i = 0, length = 0; 65 const char *type;
66 66 int i = 0, length = 0;
67#define add_env(fmt,val) do { \
68 retval = add_uevent_var(envp, num_envp, &i, \
69 buf, buf_size, &length, \
70 fmt, val); \
71 if (retval) \
72 return retval; \
73} while (0);
74 67
75 switch (card->type) { 68 switch (card->type) {
76 case MMC_TYPE_MMC: 69 case MMC_TYPE_MMC:
77 add_env("MMC_TYPE=%s", "MMC"); 70 type = "MMC";
78 break; 71 break;
79 case MMC_TYPE_SD: 72 case MMC_TYPE_SD:
80 add_env("MMC_TYPE=%s", "SD"); 73 type = "SD";
81 break; 74 break;
82 case MMC_TYPE_SDIO: 75 case MMC_TYPE_SDIO:
83 add_env("MMC_TYPE=%s", "SDIO"); 76 type = "SDIO";
84 break; 77 break;
78 default:
79 type = NULL;
85 } 80 }
86 81
87 add_env("MMC_NAME=%s", mmc_card_name(card)); 82 if (type) {
83 if (add_uevent_var(envp, num_envp, &i,
84 buf, buf_size, &length,
85 "MMC_TYPE=%s", type))
86 return -ENOMEM;
87 }
88 88
89#undef add_env 89 if (add_uevent_var(envp, num_envp, &i,
90 buf, buf_size, &length,
91 "MMC_NAME=%s", mmc_card_name(card)))
92 return -ENOMEM;
90 93
91 envp[i] = NULL; 94 envp[i] = NULL;
92 95