Skip to contentSkip to conversation

mmc: core: make the poll interval for the broken CD adjustable

PATCH New Kevin Hao 1 participant 1 message Feb 4, 2015 MMC, SD and SDIO

lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH 1/1 mmc: core: make the poll interval for the broken CD adjustable

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.

---
 drivers/mmc/core/core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +6 -2
index 0dc64e6e00d4..b95da0719fb0 100644
@@ -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)
Signature · 1 line
1.9.3