Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3010861pxb; Mon, 18 Oct 2021 06:33:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGPAEbeXDhOxSVs7Dv7Rws5Iw7nvRmuJeYE0hPcoOuYrAoB1GdLEr0AuXb/vyvWwt75c+g X-Received: by 2002:a17:903:18d:b0:13e:f1ef:d80c with SMTP id z13-20020a170903018d00b0013ef1efd80cmr27105322plg.63.1634564017382; Mon, 18 Oct 2021 06:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564017; cv=none; d=google.com; s=arc-20160816; b=0ZXBUswS01Zs7COmVr+yhUsjbFoZAvuT3ZT8hNi92dcpZd+Lh69r19e1KiNT7DH0gq /7wg8MI0NeAPh+1hLZisyYxWMGnm2nITH5zRNbZaWv0rTwlhxAbX7bPC+/ub/O/00Hif G6nAtC2ba+b93mH90gLF6rRuKVAnn5AVEU4XaEw0S9L9ZSNWcfFuxlzXe/PTbQP1XCoX rNdj/xzNgxL+zRyhSPMq4dWlghS/89l5sj0CiSyuZ2hTptAr1ib9LNvYIbacTG811z3a eHzuqxRc3jyK/raOOHO7yhhy7QHL5tq9q/4z0nr3qIx0YSGOnBxiT+s3SYY6llczruFl mQ4w== 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=wpwg7oH9vHWsQrTeSfwy6tyOPBRg5P7Gfg4FoMOQXDE=; b=J7B08mMmFVraiGon0Ozb0GU4nIEZqhZSYb0xUh4hfYJfktQKrGAoPRbpLAshNYY/vw 0NCL+LXM7FI8KUgox8w4KuJgQEwv78MBy4pu64Bp4o9ryhXWRxOKBVhs1RzgYvpUFHOa XK+HEyUtg72o75310a4F+br0e7W6MMWnyAw3IgXuUiJpVXR/yYvkOntjp3hqQlCM6fWr ytNoWALKkLjGlLvzRa58dswnGxe6IQ6wsQbxyBTCPJ1Ei59wuZFgCdzTniTli/tN818H CCVs6EPjYbUYtTXDtFnutlMvR6Zn/Faw2ih24qVPLQiBUik+fuaSELVMcIGeITW7iHXN ZTCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uUb6DAW4; 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 g12si18306578pjl.69.2021.10.18.06.33.20; Mon, 18 Oct 2021 06:33:37 -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=uUb6DAW4; 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 S232619AbhJRNei (ORCPT + 99 others); Mon, 18 Oct 2021 09:34:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:43210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231818AbhJRNci (ORCPT ); Mon, 18 Oct 2021 09:32:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CA82A61381; Mon, 18 Oct 2021 13:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563764; bh=UrQb19vn92t+wlWhi0MJjKgCXzBQqaBIrbL0uQajCP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUb6DAW4Ck2kbUukpNPisk91aNXBdcZoDuvRFC0U/ehXcCITWhmFSA0EwciZYPdux +qEJP9vjTtHol5eQHHOpULAAxaPhGP6UAckKqRvyohsbSbDNC/qMVkJQopsocXNqvy cDd0nO5NYoJyis1xuZ2JQ2nANltLbz9TbupyRDT4= 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 4.19 29/50] iio: light: opt3001: Fixed timeout error when 0 lux Date: Mon, 18 Oct 2021 15:24:36 +0200 Message-Id: <20211018132327.502221865@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132326.529486647@linuxfoundation.org> References: <20211018132326.529486647@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 @@ -283,6 +283,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) ? @@ -319,9 +321,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) {