Received: by 10.192.165.156 with SMTP id m28csp1145085imm; Wed, 11 Apr 2018 13:16:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+NnFT7DDiyWrfWbExvvYiU2riZyGuYuZRgJM+JoOsYK1o6c12CcsAPCB8g09fbIPvwvF/i X-Received: by 10.99.4.3 with SMTP id 3mr4460173pge.147.1523477800663; Wed, 11 Apr 2018 13:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523477800; cv=none; d=google.com; s=arc-20160816; b=jmrDFiFVzHFOyyTISIfH7LGFyNRMRLX3TCU2n4NroOSlrCwmRKhmhzy5JOcF5WVqOk 0/2ynie8eSnVYXC7GwCiN2OXwFxoZFPLYv215doEN+gUoElYWAc/o/oGzhNgQ2C43/0m 0I+LQqLWkGAw4HQvJoHi9TwgoEDt/cH+SkSoYKvdn9ChVIVrxNdz8/d1RqfUruxjq990 zdaWUy2pBrBbvWgGMrdbx+Lt9SJlUiwgEtawFVmNuZzcRXZNCm1rkvzSYB045/su92Xa RmpMy61GHNhUZ0rgJ9s4mWw+EYIlL0voEDSoFKmI2CT+zD5Upbc2BU6NB4rfH8UW90R4 KW4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GkaZCYiRd2aFzuif4Pl0TfNa9+G/4eSQC0w98tNtmhg=; b=uQ3LaNRgKFoIOf837mxijoRtehe8AEzcTyOlDldpv/9aUF4VGVndzM+cUBWthnf3Nr ADFyQMIjZZA5CB0qhH7LfF6hS2mGr7OHkzLQtGlhWgdWw1hwhKThp1Xn1dTZ0njBKYFL 35JtqwPfz8pHWKhAHVYer8ljtx57QXnPu0P26gy2faS6N6d1nz8zpwXe+50zuprVwmrG U9Nll1O7N1Dz6zvZFgZXj7/x1vwJEisRnNIsjtZ6cYuxWzeYjfAjCGJdwlasM4aKT61r keMHXQe+K4mJwh05ikyNewnhXPi5YxkCYtM1R6ortat/aIELi1MYFQxHMTr9t0CYLptJ HRUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38-v6si1795714plf.737.2018.04.11.13.16.03; Wed, 11 Apr 2018 13:16:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933486AbeDKSyZ (ORCPT + 99 others); Wed, 11 Apr 2018 14:54:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34444 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933458AbeDKSyU (ORCPT ); Wed, 11 Apr 2018 14:54:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5840B99F; Wed, 11 Apr 2018 18:54:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Mc Guire , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.9 043/310] iio: pressure: zpa2326: report interrupted case as failure Date: Wed, 11 Apr 2018 20:33:02 +0200 Message-Id: <20180411183624.119278368@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire [ 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 Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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; }