* [PATCH] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
@ 2020-07-29 7:59 Maxim Kochetkov
2020-07-29 8:21 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Maxim Kochetkov @ 2020-07-29 7:59 UTC (permalink / raw)
Cc: bigunclemax, Maxim Kochetkov, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Andy Shevchenko,
linux-iio, linux-kernel
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.
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
2020-07-29 7:59 [PATCH] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set Maxim Kochetkov
@ 2020-07-29 8:21 ` Andy Shevchenko
2020-07-29 8:26 ` Maxim Kochetkov
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-07-29 8:21 UTC (permalink / raw)
To: Maxim Kochetkov
Cc: bigunclemax, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
2020-07-29 8:21 ` Andy Shevchenko
@ 2020-07-29 8:26 ` Maxim Kochetkov
2020-07-29 8:34 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Maxim Kochetkov @ 2020-07-29 8:26 UTC (permalink / raw)
To: Andy Shevchenko
Cc: bigunclemax, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
linux-kernel
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?
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
2020-07-29 8:26 ` Maxim Kochetkov
@ 2020-07-29 8:34 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-07-29 8:34 UTC (permalink / raw)
To: Maxim Kochetkov
Cc: bigunclemax, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-29 8:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 7:59 [PATCH] iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set Maxim Kochetkov
2020-07-29 8:21 ` Andy Shevchenko
2020-07-29 8:26 ` Maxim Kochetkov
2020-07-29 8:34 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).