Re: [PATCH v2] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set

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

 



On Wed, Jul 29, 2020 at 12:06:31PM +0300, Maxim Kochetkov wrote:

Thank you!
A bit of massage of commit message (see below) and we are fine to go
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> To stop conversion ads1015_set_power_state function call unimplemented

All function references should be like func().

> function __pm_runtime_suspend from pm_runtime_put_autosuspend
> if CONFIG_PM is not set.

> In case of CONFIG_PM is not set:
> 
> static inline int __pm_runtime_suspend(struct device *dev, int rpmflags)
> {
> 	return -ENOSYS;
> }

It's enough to say

In case of CONFIG_PM is not set: __pm_runtime_suspend() returns -ENOSYS,

> so ads1015_read_raw failed at:
> 		ret = ads1015_set_power_state(data, false);
> 		if (ret < 0)
> 			goto release_direct;

so ads1015_read_raw() failed because ads1015_set_power_state() returns an error.

> If CONFIG_PM is disabled, there is no need to start/stop conversion.
> Fix it by adding return 0 function variant if CONFIG_PM is not set.
> 
> Signed-off-by: Maxim Kochetkov <fido_max@xxxxxxxx>
> Tested-by: Maxim Kiselev <bigunclemax@xxxxxxxxx>
> ---
>  drivers/iio/adc/ti-ads1015.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 5ea4f45d6bad..64fe3b2a6ec6 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -316,6 +316,7 @@ static const struct iio_chan_spec ads1115_channels[] = {
>  	IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
>  };
>  
> +#ifdef CONFIG_PM
>  static int ads1015_set_power_state(struct ads1015_data *data, bool on)
>  {
>  	int ret;
> @@ -333,6 +334,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
>  	return ret < 0 ? ret : 0;
>  }
>  
> +#else /* !CONFIG_PM */
> +
> +static int ads1015_set_power_state(struct ads1015_data *data, bool on)
> +{
> +	return 0;
> +}
> +
> +#endif /* !CONFIG_PM */
> +
>  static
>  int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
>  {
> -- 
> 2.27.0
> 

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux