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; };