diff mbox

+ mmc-make-id-freq-configurable-v5.patch added to -mm tree

Message ID 201009072338.o87Ncnk7013457@imap1.linux-foundation.org (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Andrew Morton Sept. 7, 2010, 11:38 p.m. UTC
None
diff mbox

Patch

diff -puN drivers/mmc/core/core.c~mmc-make-id-freq-configurable-v5 drivers/mmc/core/core.c
--- a/drivers/mmc/core/core.c~mmc-make-id-freq-configurable-v5
+++ a/drivers/mmc/core/core.c
@@ -1400,7 +1400,7 @@  void mmc_rescan(struct work_struct *work
 	int err;
 	unsigned long flags;
 	int i;
-	unsigned freqs[] = { 400000, 300000, 200000, 100000 };
+	const unsigned freqs[] = { 400000, 300000, 200000, 100000 };
 
 	spin_lock_irqsave(&host->lock, flags);
 
@@ -1445,12 +1445,15 @@  void mmc_rescan(struct work_struct *work
 
 		if (freqs[i] >= host->f_min)
 			host->f_init = freqs[i];
-		else if (i && freqs[i-1] <= host->f_min)
-			goto out;
-		else
+		else if (!i || freqs[i-1] > host->f_min)
 			host->f_init = host->f_min;
+		else {
+			mmc_release_host(host);
+			goto out;
+		}
+		pr_info("%s: %s: trying to init card at %u Hz\n",
+			mmc_hostname(host), __func__, host->f_init);
 
-		printk ("mmc_rescan: trying %u Hz\n", host->f_init);
 		mmc_power_up(host);
 		sdio_reset(host);
 		mmc_go_idle(host);
@@ -1464,7 +1467,10 @@  void mmc_rescan(struct work_struct *work
 		if (!err) {
 			if (mmc_attach_sdio(host, ocr)) {
 				mmc_claim_host(host);
-				/* try SDMEM (but not MMC) even if SDIO is broken */
+				/*
+				 * Try SDMEM (but not MMC) even if SDIO
+				 * is broken.
+				*/
 				if (mmc_send_app_op_cond(host, 0, &ocr))
 					goto out_fail;