diff mbox

[v2,17/20] mmc: sdio: relocate sdio_set_block_size call

Message ID 1279733634-21974-18-git-send-email-ohad@wizery.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ohad Ben Cohen July 21, 2010, 5:33 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 79e6fa1..5c0fbfa 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -73,6 +73,12 @@  static int sdio_init_func(struct mmc_card *card, unsigned int fn)
 
 	card->sdio_func[fn - 1] = func;
 
+	/* Set the default block size so the driver is sure it's something
+	 * sensible. */
+	ret = sdio_set_block_size(func, 0);
+	if (ret)
+		return ret;
+
 	/* For each SDIO function initialized, increase the power claim
 	 * reference count of the card */
 	atomic_inc(&card->power_claims);
@@ -510,7 +516,13 @@  static int mmc_sdio_resume(struct mmc_host *host)
 		if (func && sdio_func_present(func) && func->dev.driver) {
 			const struct dev_pm_ops *pmops = func->dev.driver->pm;
 
-			if (pmops && pmops->resume)
+			/* Set the default block size so the driver is sure
+			 * it's something sensible. */
+			mmc_claim_host(host);
+			err = sdio_set_block_size(func, 0);
+			mmc_release_host(host);
+
+			if (!err && pmops && pmops->resume)
 				err = pmops->resume(&func->dev);
 		}
 	}
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 4a890dc..87269f6 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -119,20 +119,11 @@  static int sdio_bus_probe(struct device *dev)
 	struct sdio_driver *drv = to_sdio_driver(dev->driver);
 	struct sdio_func *func = dev_to_sdio_func(dev);
 	const struct sdio_device_id *id;
-	int ret;
 
 	id = sdio_match_device(func, drv);
 	if (!id)
 		return -ENODEV;
 
-	/* Set the default block size so the driver is sure it's something
-	 * sensible. */
-	sdio_claim_host(func);
-	ret = sdio_set_block_size(func, 0);
-	sdio_release_host(func);
-	if (ret)
-		return ret;
-
 	return drv->probe(func, id);
 }