From patchwork Fri Feb 10 22:43:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 55625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1217761wrn; Fri, 10 Feb 2023 14:57:08 -0800 (PST) X-Google-Smtp-Source: AK7set8MgksdCltOt0atLtZvJD+15o47d0i46blZNbSHDlqVh07gFZUTzGStflb/pGrgsfKLzfWS X-Received: by 2002:a50:baea:0:b0:4ab:16a8:bc60 with SMTP id x97-20020a50baea000000b004ab16a8bc60mr10510189ede.25.1676069827956; Fri, 10 Feb 2023 14:57:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676069827; cv=none; d=google.com; s=arc-20160816; b=qEsH1S4whrQ17GDvmG3a46otXXhENBZxQXecrsvdPur+5iPfpi+mJcjS15zXCgnfCL 56SMcxErjMoQD7C92Sf6HEuTA1dRcY+PQOHnEY7DqDrRvTgJF8uwK6vqcQ7118hW3P/L IPGm4pOiYTkqxzxzR76Z06x751SoGYAr7ONXBF2bOAuNmqkzcKpo6kAAOt5nHibRxxmT 01ndhNOKi3WS2DFMoe++CUBy6pjdZ7h/ifPlCV7iUn4dJQh5HPwnBdjUhUyOr/UXrJ2u bSRl2bax/O4OzZ0hl2lLGjQEJg47VNg43Hv+mblqX8NxjDrckMtCZRCVq5OlQEI78cJm Q+pw== 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=QK0Io72eZJ66J+02kMiKHYwnQlKba5/GeUdWMRli1RI=; b=kBtmUVvvyR0LsQBtrvqMGQ0Gh0d+be7J9kByHvP9ZjEYACDagVMdZy0jmV7yFoMpRB 9Zqm2jtF0odaYs0vAWfYXFU/2XElOQ2c4kDp7CUaLLxuVmE7+350TLAwdEM4OuKioloW OnearoOX+PrigdM3reFn4eUXD69cIajPaViFHSraMlXumbqWYgT5o+LvVySj3qaepMK5 hh2StfhBVmA+MMkl4Soyi4olorHyOkJ+AK0p2cnJ5CqiBg91Li7EswME3qe4GuGE5tvT GQ9JWVlxKiAFim0B/XIhztg6MoiwsdCrR+U7BdV9T62Kuf89/y8r1QRMk0gNINyXNd/l pETg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=zCIgN9dD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020a056402345700b004ab4569274esi3339920edc.88.2023.02.10.14.56.44; Fri, 10 Feb 2023 14:57:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=zCIgN9dD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233983AbjBJWoM (ORCPT + 99 others); Fri, 10 Feb 2023 17:44:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233880AbjBJWoI (ORCPT ); Fri, 10 Feb 2023 17:44:08 -0500 Received: from pv50p00im-ztbu10021601.me.com (pv50p00im-ztbu10021601.me.com [17.58.6.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDB175359 for ; Fri, 10 Feb 2023 14:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1676069029; bh=QK0Io72eZJ66J+02kMiKHYwnQlKba5/GeUdWMRli1RI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=zCIgN9dD+uwMmfP7fS4n5i4txVl0XKsINt3JEeHz2Uazee/6QFLttPfa3lWppF18A t1FW3Jk/4EDz/BkyFMu9+Q+1GYOUhMJv23nErlP0qKfMUIxIlAXByIOLGJxFdOterK m0Np1HftVKoLfH1KjD+wvaTW6wzFBy0beXc5KzjK6Of6EONJiqQ1siBWFQ+jrleli0 Q067yuQaHnvdPy+OW5bBB3ZYrbmxf1QUzRqbF7pweJqNI6I7z2PUmUWs3xb+aXc2Az 3w0SMrs2Pwsyfdua7N/0rAd4RkDiEAdFOVchPG3axASwVGL/e/OiQAmCHgaDuXbEez 8Zmy+MR2M9ktQ== Received: from localhost (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztbu10021601.me.com (Postfix) with ESMTPSA id EF069800AC; Fri, 10 Feb 2023 22:43:47 +0000 (UTC) From: Alain Volmat To: Patrice Chotard , Philipp Zabel Cc: Alain Volmat , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] reset: sti: rely on regmap_field_read_poll_timeout for ack wait Date: Fri, 10 Feb 2023 23:43:31 +0100 Message-Id: <20230210224332.98482-1-avolmat@me.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: olJztAjsOxrn0yEeB-9ncMCf4c3kGzxd X-Proofpoint-GUID: olJztAjsOxrn0yEeB-9ncMCf4c3kGzxd X-Proofpoint-Virus-Version: =?utf-8?q?vendor=3Dfsecure_engine=3D1=2E1=2E170-?= =?utf-8?q?22c6f66c430a71ce266a39bfe25bc2903e8d5c8f=3A6=2E0=2E138=2C18=2E0?= =?utf-8?q?=2E572=2C17=2E11=2E64=2E514=2E0000000_definitions=3D2020-02-14=5F?= =?utf-8?q?11=3A2020-02-14=5F02=2C2020-02-14=5F11=2C2022-02-23=5F01_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 clxscore=1015 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=862 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2302100195 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757486596064773745?= X-GMAIL-MSGID: =?utf-8?q?1757486596064773745?= Use regmap_field_read_poll_timeout function when waiting for the ack bit upon performing the reset control. Signed-off-by: Alain Volmat Reviewed-by: Patrice Chotard --- drivers/reset/sti/reset-syscfg.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c index b4b46e0f207e..c1ba04f6f155 100644 --- a/drivers/reset/sti/reset-syscfg.c +++ b/drivers/reset/sti/reset-syscfg.c @@ -64,22 +64,12 @@ static int syscfg_reset_program_hw(struct reset_controller_dev *rcdev, return err; if (ch->ack) { - unsigned long timeout = jiffies + msecs_to_jiffies(1000); u32 ack_val; - while (true) { - err = regmap_field_read(ch->ack, &ack_val); - if (err) - return err; - - if (ack_val == ctrl_val) - break; - - if (time_after(jiffies, timeout)) - return -ETIME; - - cpu_relax(); - } + err = regmap_field_read_poll_timeout(ch->ack, ack_val, (ack_val == ctrl_val), + 100, USEC_PER_SEC); + if (err) + return err; } return 0;