Re: [PATCH] I2C: runtime: Fix checks which make legacy suspend to never get called

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

 



On Monday, September 27, 2010, Rajendra Nayak wrote:
> For devices which are not adapted to runtime PM a call to
> pm_runtime_suspended always returns true.
> 
> Hence the pm_runtime_suspended checks below prevent legacy
> suspend from getting called.
> 
> So do a pm_runtime_suspended check only for devices with a
> dev_pm_ops populated (which hence do not rely on the legacy
> suspend)

Makes sense.

> Signed-off-by: Rajendra Nayak <rnayak@xxxxxx>
> Cc: Rafael J. Wysocki <rjw@xxxxxxx>

Acked-by: Rafael J. Wysocki <rjw@xxxxxxx>

> Cc: Ben Dooks <ben-linux@xxxxxxxxx>
> Cc: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> Cc: Jean Delvare <khali@xxxxxxxxxxxx>
> Cc: Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/i2c/i2c-core.c |   44 ++++++++++++++++++++++++--------------------
>  1 files changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 6649176..712086f 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -197,11 +197,12 @@ static int i2c_device_pm_suspend(struct device *dev)
>  {
>  	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
>  
> -	if (pm_runtime_suspended(dev))
> -		return 0;
> -
> -	if (pm)
> -		return pm->suspend ? pm->suspend(dev) : 0;
> +	if (pm) {
> +		if (pm_runtime_suspended(dev))
> +			return 0;
> +		else
> +			return pm->suspend ? pm->suspend(dev) : 0;
> +	}
>  
>  	return i2c_legacy_suspend(dev, PMSG_SUSPEND);
>  }
> @@ -229,11 +230,12 @@ static int i2c_device_pm_freeze(struct device *dev)
>  {
>  	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
>  
> -	if (pm_runtime_suspended(dev))
> -		return 0;
> -
> -	if (pm)
> -		return pm->freeze ? pm->freeze(dev) : 0;
> +	if (pm) {
> +		if (pm_runtime_suspended(dev))
> +			return 0;
> +		else
> +			return pm->freeze ? pm->freeze(dev) : 0;
> +	}
>  
>  	return i2c_legacy_suspend(dev, PMSG_FREEZE);
>  }
> @@ -242,11 +244,12 @@ static int i2c_device_pm_thaw(struct device *dev)
>  {
>  	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
>  
> -	if (pm_runtime_suspended(dev))
> -		return 0;
> -
> -	if (pm)
> -		return pm->thaw ? pm->thaw(dev) : 0;
> +	if (pm) {
> +		if (pm_runtime_suspended(dev))
> +			return 0;
> +		else
> +			return pm->thaw ? pm->thaw(dev) : 0;
> +	}
>  
>  	return i2c_legacy_resume(dev);
>  }
> @@ -255,11 +258,12 @@ static int i2c_device_pm_poweroff(struct device *dev)
>  {
>  	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
>  
> -	if (pm_runtime_suspended(dev))
> -		return 0;
> -
> -	if (pm)
> -		return pm->poweroff ? pm->poweroff(dev) : 0;
> +	if (pm) {
> +		if (pm_runtime_suspended(dev))
> +			return 0;
> +		else
> +			return pm->poweroff ? pm->poweroff(dev) : 0;
> +	}
>  
>  	return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
>  }
> 

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


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux