In the current kernel, the poll interval for the broken CD is hard coded to 1 second. This will trigger about 50 mmc interrupts per second on a SoC like fsl p2020 if there is no card in the slot. The overhead for this is not trivial. So add a module parameter to make the poll interval adjustable. At the same time make the default value a bit bigger, and the system which really need the per second poll can tweak this parameter to be compatible with the old kernel. Signed-off-by: Kevin Hao <haokexin@xxxxxxxxx> --- drivers/mmc/core/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0dc64e6e00d4..b95da0719fb0 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -66,6 +66,10 @@ static const unsigned freqs[] = { 400000, 300000, 200000, 100000 }; bool use_spi_crc = 1; module_param(use_spi_crc, bool, 0); +static int rescan_interval = 5; +module_param(rescan_interval, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +MODULE_PARM_DESC(rescan_interval, "Set the poll interval(in seconds) for broken CD(default:5, disable: <=0)"); + /* * Internal function. Schedule delayed work in the MMC work queue. */ @@ -2507,8 +2511,8 @@ void mmc_rescan(struct work_struct *work) mmc_release_host(host); out: - if (host->caps & MMC_CAP_NEEDS_POLL) - mmc_schedule_delayed_work(&host->detect, HZ); + if ((host->caps & MMC_CAP_NEEDS_POLL) && (rescan_interval > 0)) + mmc_schedule_delayed_work(&host->detect, HZ * rescan_interval); } void mmc_start_host(struct mmc_host *host) -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html