MLK-14662 mmc: debugfs: add runtime pm when cat ios or clock file node
authorHaibo Chen <haibo.chen@nxp.com>
Mon, 17 Apr 2017 09:43:00 +0000 (17:43 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:22:01 +0000 (15:22 -0500)
MMC core code add 'MMC_CAP_RUNTIME_RESUME', postpone the real card
resume operation from bus_resume to bus_runtime_resume. So after
system resume, for non-removable-card, it still not really resume.
At this point, if user cat the ios or clock node, only get zero
data although the mmc/sd card is still present.

This patch add mmc_get_card() to make sure card really resume back
when user cat ios or clock debugfs file node, then user can get the
correct information.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
drivers/mmc/core/debugfs.c

index c8451ce..01b35c0 100644 (file)
@@ -56,6 +56,9 @@ static int mmc_ios_show(struct seq_file *s, void *data)
        struct mmc_ios  *ios = &host->ios;
        const char *str;
 
+       if (host->card)
+               mmc_get_card(host->card);
+
        seq_printf(s, "clock:\t\t%u Hz\n", ios->clock);
        if (host->actual_clock)
                seq_printf(s, "actual clock:\t%u Hz\n", host->actual_clock);
@@ -192,6 +195,9 @@ static int mmc_ios_show(struct seq_file *s, void *data)
        }
        seq_printf(s, "driver type:\t%u (%s)\n", ios->drv_type, str);
 
+       if (host->card)
+               mmc_put_card(host->card);
+
        return 0;
 }
 
@@ -211,7 +217,11 @@ static int mmc_clock_opt_get(void *data, u64 *val)
 {
        struct mmc_host *host = data;
 
+       if (host->card)
+               mmc_get_card(host->card);
        *val = host->ios.clock;
+       if (host->card)
+               mmc_put_card(host->card);
 
        return 0;
 }