From patchwork Fri Nov 17 15:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp619253vqn; Fri, 17 Nov 2023 07:42:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHJ2UUWncUT82IXzer9QkSLSF6hY0bRGTVyvloIoNLLDscF+H0Oa/LhIvGOtDo5gYLDwgC X-Received: by 2002:a05:6808:2208:b0:3ae:3d0:d74a with SMTP id bd8-20020a056808220800b003ae03d0d74amr29281490oib.52.1700235757727; Fri, 17 Nov 2023 07:42:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700235757; cv=none; d=google.com; s=arc-20160816; b=mBD0xSxfydK9DXlmsZmoYuvhf/FNzgRUt1M1DG8t6LiCVIKiPSfNvZxvNWKu4EH3qh UQvyJbbzpON/KwseaNDkS2cXdYOzq+/hWWlLQ2v28ful788E9Nw5X6GiyZPl6tBsMp/6 OAdWWWXrV1y0Wpa0bUQwteuzbpf+pZEan9VV9dTg0nS1R2VTXorXMjh+HXpFCEoCrZbc +rklxO/lwBkMW0Q7t3UHZVemXHECObr0Io6iaH4f1B53u2s/fMwx/hYLzS5Z5cEP+jQM Ph4ugvAEHP1TYm+1xnQg2ByWp3NRSrhSIsy5zO9AeHgzZ5eF14A/RaeBf5b5yGy16fW8 iy8w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=jMxjx8uYfygMEBvu13m8vNG/QwpnvhsuVDVBW53JuLQ=; fh=LYuJYGf9YNBY7QtU4l6y1MQLI+egsdpqtFlsxQi1uB8=; b=s0OIpeSZkjdTJll5sqLFFuANg8pjPu7hD2RnfY4UIl3ED4GkHrCRCTBI2MN/+JMH/q /zgcVlw7XGPu0b7pjctg8L6zMFkGeJu8wtwn9CkT8UDGLIfpIjDCWgZXhNGQfNDfUrWV 09bQ/r0vURkXXWIiCs1rCnJHGjhE2vnvutqS1mwWiCqhD+49HUERAQl/knRVnxOxyHuK lNIZA4jVLxRARZ1FmwfJBL9/oAzJGqOEhzM7ww3a21wii1ogD9/SxealO+AWRloTBRvY DrcXYvEQLMOgpHIG6v/nxvAwHebVNgRT+jArPZQrOwt99GFvhPNeN1Y3KbDwrlVempdx iGag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=NFND+pwk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id 199-20020a6300d0000000b0059f0cebd046si2055136pga.729.2023.11.17.07.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 07:42:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=NFND+pwk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B87DE8086819; Fri, 17 Nov 2023 07:42:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346064AbjKQPlO (ORCPT + 30 others); Fri, 17 Nov 2023 10:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346152AbjKQPk6 (ORCPT ); Fri, 17 Nov 2023 10:40:58 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1088819A9 for ; Fri, 17 Nov 2023 07:40:43 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8U57Q031440; Fri, 17 Nov 2023 09:40:41 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PODMain02222019; bh=j Mxjx8uYfygMEBvu13m8vNG/QwpnvhsuVDVBW53JuLQ=; b=NFND+pwkfQaGCHEDg hEL3kuAwf0maHl/alm6givWDqRrHHsC+8tsASAjAL3frbGHu8/dqTj5JDp5vJCtk ucWawa/gUoNS+oTrWWF27Io6Kjn3s8AeNcZ12jf9IfDSo36FKlJyiH94OY0j7neZ 2GiENXm/O7YnWPtQXernuM8e9GDEzH470hI/76gFH8pZRIgfqbfvVAfDRLnig++l vzpfEBwSd/jbrRL5iXTbzfjWnZZODTUX0JMiWCFX5GbmVEGo/CduHbRtqPH3Jq0f TdNpgNHvj6eELiSx127YbnEEpohbbQCU/6rs6JpYthbvDTZfnhScSFX34Iwq5Tbo TjdSA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qnn9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 09:40:41 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 15:40:39 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 15:40:39 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 690F815B9; Fri, 17 Nov 2023 15:40:39 +0000 (UTC) From: Maciej Strozek To: Lee Jones CC: , , "Maciej Strozek" Subject: [PATCH] mfd: wm831x: Remove redundant forever while loop Date: Fri, 17 Nov 2023 15:40:37 +0000 Message-ID: <20231117154037.67676-1-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Zz1A7v9YFHpkHZtSVefFpphCyF_5_8Hp X-Proofpoint-GUID: Zz1A7v9YFHpkHZtSVefFpphCyF_5_8Hp X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 07:42:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782826409926075595 X-GMAIL-MSGID: 1782826409926075595 Current code excutes only once despite the while loop, so remove the loop. Also msleep(1) will likely result in a larger sleep, so increase its value for clarity while keeping the same behaviour. Signed-off-by: Maciej Strozek Acked-by: Charles Keepax --- drivers/mfd/wm831x-auxadc.c | 46 +++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/drivers/mfd/wm831x-auxadc.c b/drivers/mfd/wm831x-auxadc.c index 65b98f3fbd92..49f0ffd68d47 100644 --- a/drivers/mfd/wm831x-auxadc.c +++ b/drivers/mfd/wm831x-auxadc.c @@ -179,32 +179,28 @@ static int wm831x_auxadc_read_polled(struct wm831x *wm831x, goto disable; } - /* If we're not using interrupts then poll the - * interrupt status register */ - timeout = 5; - while (timeout) { - msleep(1); - - ret = wm831x_reg_read(wm831x, - WM831X_INTERRUPT_STATUS_1); - if (ret < 0) { - dev_err(wm831x->dev, - "ISR 1 read failed: %d\n", ret); - goto disable; - } + /* If we're not using interrupts then read the + * interrupt status register + */ + msleep(20); + ret = wm831x_reg_read(wm831x, + WM831X_INTERRUPT_STATUS_1); + if (ret < 0) { + dev_err(wm831x->dev, + "ISR 1 read failed: %d\n", ret); + goto disable; + } - /* Did it complete? */ - if (ret & WM831X_AUXADC_DATA_EINT) { - wm831x_reg_write(wm831x, - WM831X_INTERRUPT_STATUS_1, - WM831X_AUXADC_DATA_EINT); - break; - } else { - dev_err(wm831x->dev, - "AUXADC conversion timeout\n"); - ret = -EBUSY; - goto disable; - } + /* Did it complete? */ + if (ret & WM831X_AUXADC_DATA_EINT) { + wm831x_reg_write(wm831x, + WM831X_INTERRUPT_STATUS_1, + WM831X_AUXADC_DATA_EINT); + } else { + dev_err(wm831x->dev, + "AUXADC conversion timeout\n"); + ret = -EBUSY; + goto disable; } ret = wm831x_reg_read(wm831x, WM831X_AUXADC_DATA);