Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp380134lqb; Tue, 4 Jun 2024 14:23:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvzs9YWGAXIbiqZgHLDYheb38JPopv8P2Pw15mOG/wYJMA23vfeIyDNPL6tuDxn/gtGeh5Kg7aip05BYmvFU7//lHcqnvHJpg5A3+r+g== X-Google-Smtp-Source: AGHT+IERSMWMvlHqnBsEeibh9X0lmUQ76mnzN9swYfxhSrjzVeBVg9ZqSTp/+PG5ri7rAr7Si0wQ X-Received: by 2002:a05:620a:2227:b0:793:116:55f0 with SMTP id af79cd13be357-79523d37debmr60242885a.26.1717536199613; Tue, 04 Jun 2024 14:23:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717536199; cv=pass; d=google.com; s=arc-20160816; b=Zgwx1amTSX/0BfbfcAJj/C6ydiykHanJxByDozWwMayc7xrwiEDAe+9rZE8E9C/IZC 5cJmgnlzmYy1Zs1xVX/Y7T9CsiIklhNgpLRVvbqyKLOUYD+ulO4LBuwNHJxkPSvZy1ZQ HNJKR2tF0TntTmH+h21/H6ChWFU7L+bFJf5ozRgBJnVkIP0IWFcRBUjgYFEsCEbo+S9f IKCnxTaCELDs6KUTZKAnuBN8hK9eCeE1MMf6YfuVL+6D646yLKi21Gtw8Dk92Eq6q4oG MH/CKdjJtnAgoJPMTpCsuFTWn0bK7i8mDqO1gJys3r49ocsNlpCpHKcwz6agY32T2pVX LZ7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zu7xx2eHQSEtaJ5y0DAt4wwj31+TtPnP8i/Xy8v+7Ig=; fh=COqwqTELprouAPLKCVAoafkIJJmFEyhHu6UV83bGswI=; b=MF+/qUYLIPNzNDylmWfbisw2/X5Y/NTwyzUtc03tFNNexR+SwSBPATbX3pDtNxCsgG bbUIrE/ztCEIFQINB8yiH6+/vAAmNaLC7Qo7dGebqon2OlcUgqWIWqunIXSDWbaxj6uN PmPzQVNmgDDOTAidKJdxCL4IQ45aJqs8ZsjBMb/ZR0b61s/8WZKXrML4jAmgY1xUpUX2 3DNNFmZBrCnGujdQVQ92cwQCgqZQ1t1NTBPql1TGo8dYhAlxAS2afNPAK4uGCJj5fhj4 kLv3ZDFn6M3vW0BFf6V4LcnvfhqwGCY/AA3IhbshYaFfl2WPuq8pR7AATLNcz97PLKUX GE2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=SGJeqYyT; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-201391-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201391-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff23adf8asi124100341cf.66.2024.06.04.14.23.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:23:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201391-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=SGJeqYyT; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-201391-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201391-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AD9041C22B40 for ; Tue, 4 Jun 2024 21:23:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BDE114B968; Tue, 4 Jun 2024 21:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="SGJeqYyT" Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD26114291B for ; Tue, 4 Jun 2024 21:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536177; cv=none; b=eo/QsdwRg9Yn7elyG6XBvWDf/lobGIjOqm4GNC2VL/BMfAC/4CVFU4dcJdEkP0ATGREG3tRO3oHI3pn3JmS21neEqr0w/ttrZNFHBu02eC0GmXsw3axrg2jPPMW8t+Y1YGnUrEEmrNQmIlwBGJLuH/E4oPJ9oCxJIE9MBOwAJng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536177; c=relaxed/simple; bh=yi1+PN0Q2KuKxDPrpZS3RSPuvsy4y8L2mEsSu0fR8KE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gCPDZd5VbhBtsh73cy9V0CF+ToWD1G4nfoawrNrWuWICFO18eYxs+d1FduVN9Uoe51n18N4ote4Wfp5b5CT00y6FyWnLYw4Y9fgROiBJSXCAPvt8bHbeA1qdG+JYPf2YtK55LDi6iSPR6fNDY8y3RAABft8PZHnwqozMN/qfxW4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=SGJeqYyT; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=zu7xx2eHQSEtaJ5y0DAt4wwj31+TtPnP8i/Xy8v+7Ig=; b=SGJeqY yThEn9NkcXEnONbyRjyQ1Mm/zLakWb75IfNgpqnVOd6OgBkAQs0pGFawtjP/cYj9 OPt3z5vvW0vVLUOJvfwurCLtwWWcdSGf8CzIgJ4p6nm0XDVSyN0t5vPb4bzHNt4A KMq4PLmMRRXwQpuRSBnTPc86Wqh90TJOyf/tlS8K8vJN8XgKScwayiZ1nsxBA9DE SbPLK976XN/cddVo6iUH5X3is1LH1MZqon939mRpwA6feavo3WCiGCoadTb53lx3 PZc8MSrVv08PGKdwjeW2MQxlHkyRLfL+YN9NuU3+rsnPjtZr7jsA1tcBaBntTGIc WlU97MmOAH62hHqQ== Received: (qmail 2449422 invoked from network); 4 Jun 2024 23:22:51 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 4 Jun 2024 23:22:51 +0200 X-UD-Smtp-Session: l3s3148p1@QHpcDRcaqoFehhtB From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH 1/4] misc: apds990x: use 'time_left' variable with wait_event_interruptible_timeout() Date: Tue, 4 Jun 2024 23:22:36 +0200 Message-ID: <20240604212240.4529-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604212240.4529-1-wsa+renesas@sang-engineering.com> References: <20240604212240.4529-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_event_interruptible_timeout() causing patterns like: timeout = wait_event_interruptible_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Signed-off-by: Wolfram Sang --- drivers/misc/apds990x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c index 92b92be91d60..5fb29ebbb422 100644 --- a/drivers/misc/apds990x.c +++ b/drivers/misc/apds990x.c @@ -625,15 +625,15 @@ static ssize_t apds990x_lux_show(struct device *dev, struct apds990x_chip *chip = dev_get_drvdata(dev); ssize_t ret; u32 result; - long timeout; + long time_left; if (pm_runtime_suspended(dev)) return -EIO; - timeout = wait_event_interruptible_timeout(chip->wait, - !chip->lux_wait_fresh_res, - msecs_to_jiffies(APDS_TIMEOUT)); - if (!timeout) + time_left = wait_event_interruptible_timeout(chip->wait, + !chip->lux_wait_fresh_res, + msecs_to_jiffies(APDS_TIMEOUT)); + if (!time_left) return -EIO; mutex_lock(&chip->mutex); -- 2.43.0