[MMC] Cleanup 385e3227d4d83ab13d7767c4bb3593b0256bf246

Rather than having two places which independently calculate the
timeout for data transfers, make it a library function instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 515fb22..d6fcc46 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -179,40 +179,7 @@
 		brq.stop.arg = 0;
 		brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
 
-		brq.data.timeout_ns = card->csd.tacc_ns * 10;
-		brq.data.timeout_clks = card->csd.tacc_clks * 10;
-
-		/*
-		 * Scale up the timeout by the r2w factor
-		 */
-		if (rq_data_dir(req) == WRITE) {
-			brq.data.timeout_ns <<= card->csd.r2w_factor;
-			brq.data.timeout_clks <<= card->csd.r2w_factor;
-		}
-
-		/*
-		 * SD cards use a 100 multiplier and has a upper limit
-		 */
-		if (mmc_card_sd(card)) {
-			unsigned int limit_us, timeout_us;
-
-			brq.data.timeout_ns *= 10;
-			brq.data.timeout_clks *= 10;
-
-			if (rq_data_dir(req) == READ)
-				limit_us = 100000;
-			else
-				limit_us = 250000;
-
-			timeout_us = brq.data.timeout_ns / 1000;
-			timeout_us += brq.data.timeout_clks * 1000 /
-				(card->host->ios.clock / 1000);
-
-			if (timeout_us > limit_us) {
-				brq.data.timeout_ns = limit_us * 1000;
-				brq.data.timeout_clks = 0;
-			}
-		}
+		mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ);
 
 		if (rq_data_dir(req) == READ) {
 			brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK;