From 7c957dec83c3c39a76193bf51e67fef3c9b7edf3 Mon Sep 17 00:00:00 2001 From: Sahitya Tummala Date: Fri, 31 Oct 2014 14:00:12 +0530 Subject: [PATCH] mmc: sdhci: rate limit sdhci_dumpregs() prints Rate limit sdhci_dumpregs() prints to avoid unnecessary and exessive logging which can sometimes lead to watchdog timeouts (especially due to bad cards). Change-Id: Ib6be6d563e47c2d2e9e1b6b0410c2c45712a9b17 Signed-off-by: Sahitya Tummala --- drivers/mmc/host/sdhci.c | 7 ++++++- drivers/mmc/host/sdhci.h | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 116e6083032f..a47105ae1554 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -48,6 +48,9 @@ #define MAX_TUNING_LOOP 40 +#define SDHCI_DBG_DUMP_RS_INTERVAL (10 * HZ) +#define SDHCI_DBG_DUMP_RS_BURST 2 + static unsigned int debug_quirks = 0; static unsigned int debug_quirks2; @@ -2804,7 +2807,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) } else { pr_msg = true; } - if (pr_msg) { + if (pr_msg && __ratelimit(&host->dbg_dump_rs)) { pr_err("%s: data txfr (0x%08x) error: %d after %lld ms\n", mmc_hostname(host->mmc), intmask, host->data->error, ktime_to_ms(ktime_sub( @@ -3209,6 +3212,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->mmc = mmc; spin_lock_init(&host->lock); + ratelimit_state_init(&host->dbg_dump_rs, SDHCI_DBG_DUMP_RS_INTERVAL, + SDHCI_DBG_DUMP_RS_BURST); return host; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 95487cd95147..c98cd2f29182 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -18,7 +18,7 @@ #include #include #include - +#include #include /* @@ -597,7 +597,7 @@ struct sdhci_host { enum sdhci_power_policy power_policy; u32 auto_cmd_err_sts; - + struct ratelimit_state dbg_dump_rs; unsigned long private[0] ____cacheline_aligned; };