aboutsummaryrefslogtreecommitdiff
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 d32698b02d7..e0e82d849d5 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,
{
struct mmc_card *card = dev_to_mmc_card(dev);
char ccc[13];
- int i = 0;
-
-#define add_env(fmt,val) \
- ({ \
- int len, ret = -ENOMEM; \
- if (i < num_envp) { \
- envp[i++] = buf; \
- len = snprintf(buf, buf_size, fmt, val) + 1; \
- buf_size -= len; \
- buf += len; \
- if (buf_size >= 0) \
- ret = 0; \
- } \
- ret; \
- })
+ int retval = 0, i = 0, length = 0;
+
+#define add_env(fmt,val) do { \
+ retval = add_uevent_var(envp, num_envp, &i, \
+ buf, buf_size, &length, \
+ fmt, val); \
+ if (retval) \
+ return retval; \
+} while (0);
for (i = 0; i < 12; i++)
ccc[i] = card->csd.cmdclass & (1 << i) ? '1' : '0';
ccc[12] = '\0';
- i = 0;
add_env("MMC_CCC=%s", ccc);
add_env("MMC_MANFID=%06x", card->cid.manfid);
add_env("MMC_NAME=%s", mmc_card_name(card));
add_env("MMC_OEMID=%04x", card->cid.oemid);
+#undef add_env
+ envp[i] = NULL;
return 0;
}