mmc: sdio: enable runtime PM for SDIO cards
authorOhad Ben-Cohen <ohad@wizery.com>
Sat, 2 Oct 2010 11:54:10 +0000 (13:54 +0200)
committerChris Ball <cjb@laptop.org>
Sat, 23 Oct 2010 13:11:18 +0000 (21:11 +0800)
Enable runtime PM for new SDIO cards.

As soon as the card will be added to the device tree, runtime PM core
will release its power, since it doesn't have any users yet.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Tested-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/sdio.c

index f17e0e0bd9d158077562a06f09e2b6665bdac877..0dbd6fe666607acda810d831f80c288a5ca4d7cb 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/err.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
@@ -707,6 +708,18 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
                goto err;
        card = host->card;
 
+       /*
+        * Let runtime PM core know our card is active
+        */
+       err = pm_runtime_set_active(&card->dev);
+       if (err)
+               goto remove;
+
+       /*
+        * Enable runtime PM for this card
+        */
+       pm_runtime_enable(&card->dev);
+
        /*
         * The number of functions on the card is encoded inside
         * the ocr.