mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
iio: pressure: zpa2326: report interrupted case as failure
If the timeout-case prints a warning message then probably the interrupted
case should also. Further, wait_for_completion_interruptible_timeout()
returns long not int.
Fixes: commit 03b262f2bb
("iio:pressure: initial zpa2326 barometer support")
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
6fb34812c2
commit
e7215fe4d5
1 changed files with 11 additions and 7 deletions
|
@ -867,12 +867,13 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
long timeout;
|
||||||
|
|
||||||
zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt");
|
zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt");
|
||||||
|
|
||||||
ret = wait_for_completion_interruptible_timeout(
|
timeout = wait_for_completion_interruptible_timeout(
|
||||||
&private->data_ready, ZPA2326_CONVERSION_JIFFIES);
|
&private->data_ready, ZPA2326_CONVERSION_JIFFIES);
|
||||||
if (ret > 0)
|
if (timeout > 0)
|
||||||
/*
|
/*
|
||||||
* Interrupt handler completed before timeout: return operation
|
* Interrupt handler completed before timeout: return operation
|
||||||
* status.
|
* status.
|
||||||
|
@ -882,13 +883,16 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev,
|
||||||
/* Clear all interrupts just to be sure. */
|
/* Clear all interrupts just to be sure. */
|
||||||
regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val);
|
regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val);
|
||||||
|
|
||||||
if (!ret)
|
if (!timeout) {
|
||||||
/* Timed out. */
|
/* Timed out. */
|
||||||
|
zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)",
|
||||||
|
timeout);
|
||||||
ret = -ETIME;
|
ret = -ETIME;
|
||||||
|
} else if (timeout < 0) {
|
||||||
if (ret != -ERESTARTSYS)
|
zpa2326_warn(indio_dev,
|
||||||
zpa2326_warn(indio_dev, "no one shot interrupt occurred (%d)",
|
"wait for one shot interrupt cancelled");
|
||||||
ret);
|
ret = -ERESTARTSYS;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue