Re: [PATCH 2/2] mmc: core: Use autosuspend when applicable at runtime idle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 10 Oct 2013, Ulf Hansson wrote:

> Typically the runtime idle function is triggered after resume and
> probe. Instead of immediately requesting the device to go into
> in-active state we make use of the autosuspend, if we have enabled
> it earlier.
> 
> Cc: Len Brown <len.brown@xxxxxxxxx>
> Cc: Pavel Machek <pavel@xxxxxx>
> Cc: Rafael J. Wysocki <rjw@xxxxxxxxxxxxx>
> Cc: Kevin Hilman <khilman@xxxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> ---
>  drivers/mmc/core/bus.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index cdca8a7..7f0e900 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -205,6 +205,12 @@ static int mmc_runtime_resume(struct device *dev)
>  
>  static int mmc_runtime_idle(struct device *dev)
>  {
> +	if (pm_runtime_autosuspend_used(dev)) {
> +		pm_runtime_mark_last_busy(dev);
> +		pm_runtime_autosuspend(dev);
> +		return -EBUSY;
> +	}
> +
>  	return 0;
>  }

I would greatly prefer to see the core rpm_idle() routine changed 
instead.  Currently the last line says:

	return retval ? retval : rpm_suspend(dev, rpmflags);

The second argument to rpm_suspend should be rpmflags | RPM_AUTO.  That
way, if the runtime-idle callback returns 0, we will automatically do
either a normal suspend or an autosuspend, whichever is appropriate.

As an added benefit, with this change there's no need to add the 
pm_runtime_autosuspend_used() function.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux