2020-07-29 08:22:22

by Andy Shevchenko

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

On Wed, Jul 29, 2020 at 10:59:07AM +0300, Maxim Kochetkov wrote:
> To stop conversion ads1015_set_power_state function use unimplemented
> function pm_runtime_put_autosuspend if CONFIG_PM is not set.
> 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.

I'm wondering if you check the real code (assembly) for any difference.

All calls AFAICS are statically defined in !CONFIG_PM case and compiler/linker
should be clever enough to drop this completely. Isn't it the case?

--
With Best Regards,
Andy Shevchenko



2020-07-29 08:28:45

by Maxim Kochetkov

[permalink] [raw]
Subject: Re: [PATCH] iio: adc: ti-ads1015: fix conversion when 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;
}

and ads1015_read_raw failed at:

ret = ads1015_set_power_state(data, false);
if (ret < 0)
goto release_direct;

29.07.2020 11:21, Andy Shevchenko wrote:
> On Wed, Jul 29, 2020 at 10:59:07AM +0300, Maxim Kochetkov wrote:
>> To stop conversion ads1015_set_power_state function use unimplemented
>> function pm_runtime_put_autosuspend if CONFIG_PM is not set.
>> 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.
>
> I'm wondering if you check the real code (assembly) for any difference.
>
> All calls AFAICS are statically defined in !CONFIG_PM case and compiler/linker
> should be clever enough to drop this completely. Isn't it the case?
>

2020-07-29 08:35:26

by Andy Shevchenko

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

On Wed, Jul 29, 2020 at 11:26:51AM +0300, Maxim Kochetkov wrote:
> In case of CONFIG_PM is not set:
>
> static inline int __pm_runtime_suspend(struct device *dev, int rpmflags)
> {
> return -ENOSYS;
> }
>
> and ads1015_read_raw failed at:
>
> ret = ads1015_set_power_state(data, false);
> if (ret < 0)
> goto release_direct;
>

I see. Please, elaborate all this in the commit message for v2.

P.S. Avoid top postings!

> 29.07.2020 11:21, Andy Shevchenko wrote:
> > On Wed, Jul 29, 2020 at 10:59:07AM +0300, Maxim Kochetkov wrote:
> > > To stop conversion ads1015_set_power_state function use unimplemented
> > > function pm_runtime_put_autosuspend if CONFIG_PM is not set.
> > > 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.
> >
> > I'm wondering if you check the real code (assembly) for any difference.
> >
> > All calls AFAICS are statically defined in !CONFIG_PM case and compiler/linker
> > should be clever enough to drop this completely. Isn't it the case?
> >

--
With Best Regards,
Andy Shevchenko