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: 13136568 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 489FBC636D4 for ; Fri, 10 Feb 2023 22:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=wNFKDvDWcxSeCisbBbQA1ufXGOEshRv07vZLgRJMGGk=; b=u+5l2y6/FhNTiT HT8zSP4ddy0eghkuQ54WhktIyDVqd8/cQul/1LcBnIqKguVV/Y2rLA3An+JNddgROyGylhscoP+i9 763nY//BftcFaYpablz2CFq3kr+neheP3PIByeC7QQAgQhnmq2zfMgh3vHxTWANthgZ7otWlHnGZ+ KVOYe0Zge4EvKk/t7YD7ae6dHTAyQvXQSdUlyhmcG1Js+h2KQ2IC5brBZQ0cHf2X804/8tadPfPJP l9NG7PjvnuWUzStTsZ0oIDaWxEI7FHOleutQfbXaIPk9NNrpJPpcNaOQxCejfX0az2JJ0VlECBkb7 ZQtgbemsozKJwtBmEmhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQc7X-007oal-3b; Fri, 10 Feb 2023 22:43:55 +0000 Received: from pv50p00im-ztbu10021601.me.com ([17.58.6.57]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQc7T-007oZj-EX for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 22:43:52 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230210_144351_529296_64DDE0E8 X-CRM114-Status: GOOD ( 10.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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;