Skip to content

Commit e71e6db

Browse files
fidomaxjic23
authored andcommitted
iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
To stop conversion ads1015_set_power_state() function call unimplemented function __pm_runtime_suspend() from pm_runtime_put_autosuspend() if CONFIG_PM is not set. In case of CONFIG_PM is not set: __pm_runtime_suspend() returns -ENOSYS, 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 <[email protected]> Fixes: ecc24e7 ("iio: adc: Add TI ADS1015 ADC driver support") Tested-by: Maxim Kiselev <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent ab3300d commit e71e6db

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/iio/adc/ti-ads1015.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ static const struct iio_chan_spec ads1115_channels[] = {
316316
IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
317317
};
318318

319+
#ifdef CONFIG_PM
319320
static int ads1015_set_power_state(struct ads1015_data *data, bool on)
320321
{
321322
int ret;
@@ -333,6 +334,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
333334
return ret < 0 ? ret : 0;
334335
}
335336

337+
#else /* !CONFIG_PM */
338+
339+
static int ads1015_set_power_state(struct ads1015_data *data, bool on)
340+
{
341+
return 0;
342+
}
343+
344+
#endif /* !CONFIG_PM */
345+
336346
static
337347
int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
338348
{

0 commit comments

Comments
 (0)