mmc: msm_sdcc: don't print suspend/resume statistics in case of errors
Currently we print the time taken during SDCC host driver suspend/resume
(both platform and runtime) even if we encountered errors during it.
But sometimes, for example runtime suspend might be aborted because
actual SDCC transfer request is arrived at the same time. So printing
the statistics in such cases will not be helpful and may even cause the
confusion.
This change prints the time taken in suspend/resume only when those
operations are successfully completed.
Change-Id: I7fa5754ccddee0d90f684b05526e9434c068a0ff
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index c8b47b9..00dc5bf 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -6536,19 +6536,19 @@
#if CONFIG_DEBUG_FS
static void msmsdcc_print_pm_stats(struct msmsdcc_host *host, ktime_t start,
- const char *func)
+ const char *func, int err)
{
ktime_t diff;
- if (host->print_pm_stats) {
+ if (host->print_pm_stats && !err) {
diff = ktime_sub(ktime_get(), start);
- pr_info("%s: %s: Completed in %llu usec\n", func,
- mmc_hostname(host->mmc), (u64)ktime_to_us(diff));
+ pr_info("%s: %s: Completed in %llu usec\n",
+ mmc_hostname(host->mmc), func, (u64)ktime_to_us(diff));
}
}
#else
static void msmsdcc_print_pm_stats(struct msmsdcc_host *host, ktime_t start,
- const char *func) {}
+ const char *func, int err) {}
#endif
static int
@@ -6615,7 +6615,7 @@
out:
/* set bus bandwidth to 0 immediately */
msmsdcc_msm_bus_cancel_work_and_set_vote(host, NULL);
- msmsdcc_print_pm_stats(host, start, __func__);
+ msmsdcc_print_pm_stats(host, start, __func__, rc);
return rc;
}
@@ -6664,7 +6664,7 @@
host->pending_resume = false;
pr_debug("%s: %s: end\n", mmc_hostname(mmc), __func__);
out:
- msmsdcc_print_pm_stats(host, start, __func__);
+ msmsdcc_print_pm_stats(host, start, __func__, 0);
return 0;
}
@@ -6701,7 +6701,7 @@
if (!pm_runtime_suspended(dev))
rc = msmsdcc_runtime_suspend(dev);
out:
- msmsdcc_print_pm_stats(host, start, __func__);
+ msmsdcc_print_pm_stats(host, start, __func__, rc);
return rc;
}
@@ -6757,7 +6757,7 @@
enable_irq(host->plat->status_irq);
}
out:
- msmsdcc_print_pm_stats(host, start, __func__);
+ msmsdcc_print_pm_stats(host, start, __func__, rc);
return rc;
}