Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3020182pxb; Mon, 18 Oct 2021 06:44:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybi5foApsik+9SOpRFq/VAn43WhjQezmS+bzwRVr9qoyqyY6xKBGG4ls7ZtAMjPbwBtk2t X-Received: by 2002:a17:90a:39c5:: with SMTP id k5mr48365063pjf.211.1634564687055; Mon, 18 Oct 2021 06:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564687; cv=none; d=google.com; s=arc-20160816; b=DyTqsHEVbU+p8DxTZfhKnDUzLLjS97AX41SaB01BhQm3e8OmoacGOvnzWH4S2kB7k1 sVvET5MEW4StKbzvGQnGxQPICdgkgZZ9dxDsmHgkLEjHLVtmtcrVZe5s4jwzCNWqRLKn w1j8/LS6Jaeo/8SUPMvtRyg+e+3SIZxa7RC2ES04GKmkrkEomCZ84Jud6be/n7bIGICC pwQi3MD6qy5WkOJguD2pP9VIcFge6T+KLrnQZsMS8HfGUG5Wn/gHD/Al7CXOsFzSnaP3 6uI34one6Vd5w7CqlGVZ9E97pt7GJ6+K61GNQ/3tfO+uNELntdoFL7D4bMIhPux9Rppb Y7Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eGjoSTPkp+jmiquR04LhqUQmNYTdMhSkZNrJne/JIz0=; b=cToLSVhDMZib3H+mtwxpfqwqkWza9OObCIXC2kLBnM9A7Y+GQij4yJvKz8/W5vKLYG qA2JW0Cj+bnguZVrznatRYa0//01C+sw22LYazcTqSa7ATtMiFLH22lvfKc4EsgsDZ5n KjgHkp+HtdM9ZfOMsEsQ9vs7xp5bJUW2n7le0K+HGyTazsAGhdyZUlV6ZwBjxizlK1DE giRT1f7THOj2t9nf99G5J95P6AQrTpDkqnPRQJMLADrrOItSU5kgehAl2+s5aFMuJ12a bkgIdTJzK++nlL8MFGjlBnfxi24dMRUdLFyOWjTmXtAq73vYJ2pgReqghg3T8tmyuSUr k/9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eu++V8Cv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si35131133pjd.87.2021.10.18.06.44.34; Mon, 18 Oct 2021 06:44:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eu++V8Cv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232721AbhJRNp0 (ORCPT + 99 others); Mon, 18 Oct 2021 09:45:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbhJRNn1 (ORCPT ); Mon, 18 Oct 2021 09:43:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F3D261528; Mon, 18 Oct 2021 13:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564077; bh=eTnfVWKlsW/i6qDvROrWWj7teRSCUAukI+LYIxwu9zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eu++V8Cv/lEPyHsgie5VC4Cm3Akn1/xmHJ/lcjH7MmmGlwFZKJPrtiPmjukTkPrFU qoMZyqZGXo34HBiD1zCJGpSz8GJRt5CjeqsGVWbbh8BMMesIbxxtxorrj6yiojvoe5 87WXb/yH78qYB5lpI2To9uKnmzr5FUtwsT9toZJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Valek - 2N , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 057/103] iio: light: opt3001: Fixed timeout error when 0 lux Date: Mon, 18 Oct 2021 15:24:33 +0200 Message-Id: <20211018132336.676176310@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132334.702559133@linuxfoundation.org> References: <20211018132334.702559133@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Valek - 2N commit 26d90b5590579def54382a2fc34cfbe8518a9851 upstream. Reading from sensor returned timeout error under zero light conditions. Signed-off-by: Jiri Valek - 2N Fixes: ac663db3678a ("iio: light: opt3001: enable operation w/o IRQ") Link: https://lore.kernel.org/r/20210920125351.6569-1-valek@2n.cz Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/light/opt3001.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt300 ret = wait_event_timeout(opt->result_ready_queue, opt->result_ready, msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); + if (ret == 0) + return -ETIMEDOUT; } else { /* Sleep for result ready time */ timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ? @@ -312,9 +314,7 @@ err: /* Disallow IRQ to access the device while lock is active */ opt->ok_to_ignore_lock = false; - if (ret == 0) - return -ETIMEDOUT; - else if (ret < 0) + if (ret < 0) return ret; if (opt->use_irq) {