From patchwork Wed Sep 25 16:40:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 13812333 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 697EECCF9E7 for ; Wed, 25 Sep 2024 16:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: 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=5P4y7QaAYTj+bpiK8o4AIhXtaTCInZkDpuI5X/uaaHA=; b=ChA7F2ZhAAkhnW kuFlF5LRBCdCmSRQTqOzAYfz+t7GkMulsZNsglZpXmg0sCjK3suSjrG8cHin4z8DBVFC3L+PInAeG CQo1sieXjWx6PPqRiOUy0BJyyIUMuuCjuYl35JLtp622aKYTovCjJnY4urPUyShVX2k24PHEZs0W6 k4sU1nn9+WMSgK8OMMzLS1EzcXWgKbNt3ShgEBlMLuwnjRRHtwaIYzlkqraIHHKM+sG+/866vHJ2p Gg53rOkEeMDDLL8RAHrSyhPGg1YEP5FDI/8U/2ECvd7zC9Sn5xWqgnIUpOmVd7aSIoRXjIHdJTgwY oEknYcMM3HhjWV9Z1eNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stV6O-000000065mi-4BZd; Wed, 25 Sep 2024 16:42:57 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stV3w-00000006563-3IXV for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2024 16:40:26 +0000 Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1stV3r-00046t-IE; Wed, 25 Sep 2024 18:40:19 +0200 From: Philipp Zabel Subject: [PATCH v2 0/3] reset: Requesting pre-deasserted, auto-reasserting reset controls via devres Date: Wed, 25 Sep 2024 18:40:08 +0200 Message-Id: <20240925-reset-get-deasserted-v2-0-b3601bbd0458@pengutronix.de> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAOg89GYC/4WNQQ6DIBREr2L+ujRAVGxXvUfjAsuof4MGKLEx3 r3UC3QxizfJm9kpIjAi3audAjJHXnwBfanoNVs/QbArTFrqWrZaiYCIJKYSBxuLneBEo7rGdqi tkS0VdQ0YeTtnn33hmWNawud8yerX/hnMSkhxqwHTjoMZjHus8NM7hcXzdnWg/jiOL5QDzYu9A AAA To: Kunihiko Hayashi , Masami Hiramatsu , Lad Prabhakar , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6?= =?utf-8?q?nig?= Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, Philipp Zabel X-Mailer: b4 0.15-dev-13183 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::54 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240925_094024_859838_146EDA18 X-CRM114-Status: UNSURE ( 8.20 ) X-CRM114-Notice: Please train this message. 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 There is a recurring pattern of drivers requesting a reset control and deasserting the reset during probe, followed by registering a reset assertion via devm_add_action_or_reset(). We can simplify this by providing devm_reset_control_get_*_deasserted() helpers that return an already deasserted reset control, similarly to devm_clk_get_enabled(). This doesn't remove a lot of boilerplate at each instance, but there are quite a few of them now. regards Philipp Signed-off-by: Philipp Zabel Acked-by: Uwe Kleine-König --- Changes in v2: - Clear RESET_CONTROL_FLAGS_BIT_OPTIONAL out of flags. - Check flags in __of_reset_control_get(). - Fix devm_reset_control_array_get() documentation. - Clear RESET_CONTROL_FLAGS_BIT_DEASSERTED out of flags. - Link to v1: https://lore.kernel.org/r/20240621-reset-get-deasserted-v1-0-94ee76fb7b7d@pengutronix.de --- Philipp Zabel (3): reset: replace boolean parameters with flags parameter reset: Add devres helpers to request pre-deasserted reset controls reset: uniphier-glue: Use devm_reset_control_bulk_get_shared_deasserted() drivers/reset/core.c | 119 +++++++++++----- drivers/reset/reset-uniphier-glue.c | 24 +--- include/linux/reset.h | 274 ++++++++++++++++++++++++++++-------- 3 files changed, 303 insertions(+), 114 deletions(-) --- base-commit: 487b1b32e317b85c2948eb4013f3e089a0433d49 change-id: 20240621-reset-get-deasserted-5185a8e4a706 Best regards,