aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/mmc_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/mmc_sysfs.c')
-rw-r--r--drivers/mmc/mmc_sysfs.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c
index d32698b02d7f..e0e82d849d5f 100644
--- a/drivers/mmc/mmc_sysfs.c
+++ b/drivers/mmc/mmc_sysfs.c
@@ -86,31 +86,26 @@ mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
86{ 86{
87 struct mmc_card *card = dev_to_mmc_card(dev); 87 struct mmc_card *card = dev_to_mmc_card(dev);
88 char ccc[13]; 88 char ccc[13];
89 int i = 0; 89 int retval = 0, i = 0, length = 0;
90 90
91#define add_env(fmt,val) \ 91#define add_env(fmt,val) do { \
92 ({ \ 92 retval = add_uevent_var(envp, num_envp, &i, \
93 int len, ret = -ENOMEM; \ 93 buf, buf_size, &length, \
94 if (i < num_envp) { \ 94 fmt, val); \
95 envp[i++] = buf; \ 95 if (retval) \
96 len = snprintf(buf, buf_size, fmt, val) + 1; \ 96 return retval; \
97 buf_size -= len; \ 97} while (0);
98 buf += len; \
99 if (buf_size >= 0) \
100 ret = 0; \
101 } \
102 ret; \
103 })
104 98
105 for (i = 0; i < 12; i++) 99 for (i = 0; i < 12; i++)
106 ccc[i] = card->csd.cmdclass & (1 << i) ? '1' : '0'; 100 ccc[i] = card->csd.cmdclass & (1 << i) ? '1' : '0';
107 ccc[12] = '\0'; 101 ccc[12] = '\0';
108 102
109 i = 0;
110 add_env("MMC_CCC=%s", ccc); 103 add_env("MMC_CCC=%s", ccc);
111 add_env("MMC_MANFID=%06x", card->cid.manfid); 104 add_env("MMC_MANFID=%06x", card->cid.manfid);
112 add_env("MMC_NAME=%s", mmc_card_name(card)); 105 add_env("MMC_NAME=%s", mmc_card_name(card));
113 add_env("MMC_OEMID=%04x", card->cid.oemid); 106 add_env("MMC_OEMID=%04x", card->cid.oemid);
107#undef add_env
108 envp[i] = NULL;
114 109
115 return 0; 110 return 0;
116} 111}