Hello Wilson,
On Fri, Mar 25, 2011 at 5:58 AM, Wilson Loi <[email protected]> wrote:
> The current power_restore handler only support cut off mode.
> It is better to support keep power mode too.
This doesn't make much sense really;
mmc_power_save_host() and mmc_power_restore_host() are invoked by
runtime PM when it is time to power off/on the card.
If your driver doesn't want the power to go, it should just maintain a
positive runtime PM usage_count (e.g. in case it's an SDIO driver,
don't call pm_runtime_put{_sync} after being probed).
> ?static const struct mmc_bus_ops mmc_sdio_ops = {
> ???? .remove = mmc_sdio_remove,
> ???? .detect = mmc_sdio_detect,
> ???? .suspend = mmc_sdio_suspend,
> ???? .resume = mmc_sdio_resume,
> -??? .power_restore = mmc_sdio_power_restore,
> +??? .power_save = mmc_sdio_suspend,
> +??? .power_restore = mmc_sdio_resume,
This can break SDIO runtime PM.
While -ENOSYS is a valid return value for mmc_sdio_suspend (it tells
mmc_suspend_host to remove the entire MMC card on system suspend), it
will be treated as an error by runtime PM.
In addition, this can really yield unexpected results, since drivers
do not expect their suspend/resume handlers to be called during
runtime PM transitions.