Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9eb3a94d022e6c233c0b22ec54516d35d2e87eb9
Commit:     9eb3a94d022e6c233c0b22ec54516d35d2e87eb9
Parent:     3b38bea0d976513970f947806b08b9faca418e7a
Author:     Pierre Ossman <[EMAIL PROTECTED]>
AuthorDate: Sun Jun 17 11:18:46 2007 +0200
Committer:  Pierre Ossman <[EMAIL PROTECTED]>
CommitDate: Sun Sep 23 20:52:20 2007 +0200

    mmc: whip bus uevent handler into shape
    
    Make the mmc bus uevent callback look like all other subsystems.
    
    Signed-off-by: Pierre Ossman <[EMAIL PROTECTED]>
---
 drivers/mmc/core/bus.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 9be11ec..1cc1171 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,
                int buf_size)
 {
        struct mmc_card *card = dev_to_mmc_card(dev);
-       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);
+       const char *type;
+       int i = 0, length = 0;
 
        switch (card->type) {
        case MMC_TYPE_MMC:
-               add_env("MMC_TYPE=%s", "MMC");
+               type = "MMC";
                break;
        case MMC_TYPE_SD:
-               add_env("MMC_TYPE=%s", "SD");
+               type = "SD";
                break;
        case MMC_TYPE_SDIO:
-               add_env("MMC_TYPE=%s", "SDIO");
+               type = "SDIO";
                break;
+       default:
+               type = NULL;
        }
 
-       add_env("MMC_NAME=%s", mmc_card_name(card));
+       if (type) {
+               if (add_uevent_var(envp, num_envp, &i,
+                               buf, buf_size, &length,
+                               "MMC_TYPE=%s", type))
+                       return -ENOMEM;
+       }
 
-#undef add_env
+       if (add_uevent_var(envp, num_envp, &i,
+                       buf, buf_size, &length,
+                       "MMC_NAME=%s", mmc_card_name(card)))
+               return -ENOMEM;
 
        envp[i] = NULL;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to