Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3014195pxb; Mon, 18 Oct 2021 06:37:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8lo9xDJiOIAvT4Xc8KSA8w2clLO9cPpPs2Nn772uuOUYnW/VUTrQAn4Z4nQ3znMhXE4Z6 X-Received: by 2002:a63:7783:: with SMTP id s125mr24066669pgc.378.1634564261283; Mon, 18 Oct 2021 06:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564261; cv=none; d=google.com; s=arc-20160816; b=sNPXfitcPEZj8L2FVuAwkIqBQDmYxRq6qsGN4XbhUcOQTSiRa+Jhieu6dHXm6AME+L CIf4yETpimgr1pAT8GX3iWUGf+ol4ur6ypPrgOPtxz2Lxy6HmtlyDEw8oiyEJd9g585Y /WsA3JgYdzBjBg0uh8IDBw9+kRz3B7WPMlxyaedoTIP0wopncnFoEuA7StaD2kfkasLa C9C6h8IOOZkqTr+heOoemuj8LD/J6bMYGNMnZ7LqRA2MAAH1OVBMfNn7dOhjH2CiBmmy R+cyde4SwYMnh/YkCQ9qzxKMZkF4fjAC9vEXCKV89kIx0B8g1wO0592Fb3lPIrImI2t4 SOeQ== 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=+AgDSJKvXD9aYSaVWryeA+BgVfhavCEifYG+bJuniBg=; b=rWHT3S9A2JWrFzaqbMCzvQh9yNizYupRRUvpd31FBXzUOxczZ3UjqsJeZ9IIDW+f+i PqanEDoJy8NyrsQa0AaI8vhWjVJGwKTmTvbArMHfTuiISLwPuq3zZVzrBOucDitasHku pN+J81F8HeA+/De8t4Zg6+hkj7XZ/CdY9wsH/yII8o0k6VdB+vvbeB4zBIGdIMRoXwIP PrtPP5VvTNda3r9W3MwEbVZ77HgEF5geQSbLraOSYqiKTCnppaSDJGuWdRSZJ3sZzrDg qC0prg04rzp1Z7m7Gq9hLPfmPLaLk2cjUoUFZR9rZ+b2ikz75KqmQRrMl5h2xeXTGitH Flsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVPDMW8B; 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 mu11si32033579pjb.16.2021.10.18.06.37.27; Mon, 18 Oct 2021 06:37:41 -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=XVPDMW8B; 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 S233015AbhJRNhz (ORCPT + 99 others); Mon, 18 Oct 2021 09:37:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:54416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbhJRNfr (ORCPT ); Mon, 18 Oct 2021 09:35:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6A2D613D2; Mon, 18 Oct 2021 13:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563857; bh=JRqW8D8D8QdZEeN/GjVfhrsbkurNMzio3cjQr8dVSDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVPDMW8BxDAdh+vYKegxyp0nGcOMUsX4QmsZAdL6BRA/ICcXsjm+ZRlXJxVz2B8l3 5SK1EUNvp+p6+ybEhIIZvia2wgZY0xKrr9QeSLQF+7wvIK3ldZVwEFI1B/zx46sApA Ca2FfrD5vI1MdGSLlOecNcm55lOx/v0XCz/mGnAc= 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.4 41/69] iio: light: opt3001: Fixed timeout error when 0 lux Date: Mon, 18 Oct 2021 15:24:39 +0200 Message-Id: <20211018132330.832981044@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@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 @@ -275,6 +275,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) ? @@ -311,9 +313,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) {