lkml.org 
[lkml]   [2018]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 043/310] iio: pressure: zpa2326: report interrupted case as failure
    Date
    4.9-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Nicholas Mc Guire <der.herr@hofr.at>


    [ Upstream commit e7215fe4d51e69c9d2608ad0c409d48e844d0adc ]

    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 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support")
    Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/iio/pressure/zpa2326.c | 18 +++++++++++-------
    1 file changed, 11 insertions(+), 7 deletions(-)

    --- a/drivers/iio/pressure/zpa2326.c
    +++ b/drivers/iio/pressure/zpa2326.c
    @@ -871,12 +871,13 @@ static int zpa2326_wait_oneshot_completi
    {
    int ret;
    unsigned int val;
    + long timeout;

    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);
    - if (ret > 0)
    + if (timeout > 0)
    /*
    * Interrupt handler completed before timeout: return operation
    * status.
    @@ -886,13 +887,16 @@ static int zpa2326_wait_oneshot_completi
    /* Clear all interrupts just to be sure. */
    regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val);

    - if (!ret)
    + if (!timeout) {
    /* Timed out. */
    + zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)",
    + timeout);
    ret = -ETIME;
    -
    - if (ret != -ERESTARTSYS)
    - zpa2326_warn(indio_dev, "no one shot interrupt occurred (%d)",
    - ret);
    + } else if (timeout < 0) {
    + zpa2326_warn(indio_dev,
    + "wait for one shot interrupt cancelled");
    + ret = -ERESTARTSYS;
    + }

    return ret;
    }

    \
     
     \ /
      Last update: 2018-04-11 22:12    [W:4.115 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site