From e62eb96153028c6528658a7915091d065cedf798 Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Mon, 17 Apr 2017 17:43:00 +0800 Subject: [PATCH] MLK-14662 mmc: debugfs: add runtime pm when cat ios or clock file node 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 --- drivers/mmc/core/debugfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index c8451ce557ae..01b35c0d0d36 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -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; } -- 2.17.1