To support probing of SDIO function driver while the device is powered off, we need to relocate the sdio_set_block_size call from the bus probe to an earlier point where we know the device is still powered. In addition, we want the block size set also when cards are resumed. Signed-off-by: Ohad Ben-Cohen <ohad@xxxxxxxxxx> --- drivers/mmc/core/sdio.c | 14 +++++++++++++- drivers/mmc/core/sdio_bus.c | 9 --------- 2 files changed, 13 insertions(+), 10 deletions(-) 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); } -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html