From patchwork Wed Dec 15 09:38:29 2021
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 12696220
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 276FAC433EF
for ;
Wed, 15 Dec 2021 09:40:26 +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:References:In-Reply-To:
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:
List-Owner; bh=q43MPfCmq2Mrqi24I/aIxe2PELJNOdMzwWvnoVVoeiE=; b=XwHWz7Esc6GB1L
0tHcnI3uZ9fsrtqqzsOMuAcsbbfQzFKbpq8UvCNKMuE8mM+3yxacCnl775aJKf6IYSCq6nZ65BV65
6QoWkWeCr3DDQPbDGBPHAOaD4o4rUK9b6l1lC6CvhZQGY1YvColP/JC9SrJeJbRpCN6cSzEVVKOTB
Jvrx2OoGAHE4DFQOC1aiT0VjhI7HNwNK6QQ/Lec9DiWnDzogNZ9T3BfkDZNAp67VdS0WnN8oYwLCt
lHx29Bgui1DtjHb29auwsdvwdk3B7xn7j7t91p4nZFYurnlRThKM9UxMmFMHSrcGhWgL2OFt8l3ir
qUx3CW4NTxiI2p3CjWKg==;
Received: from localhost ([::1] helo=bombadil.infradead.org)
by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux))
id 1mxQkg-00HWfl-7k; Wed, 15 Dec 2021 09:39:10 +0000
Received: from metis.ext.pengutronix.de
([2001:67c:670:201:290:27ff:fe1d:cc33])
by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))
id 1mxQkT-00HWd9-02
for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 09:38:58 +0000
Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]
helo=dude02.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.92)
(envelope-from )
id 1mxQkQ-0002Ze-5i; Wed, 15 Dec 2021 10:38:54 +0100
From: Philipp Zabel
To: linux-arm-kernel@lists.infradead.org
Cc: Kunihiko Hayashi ,
Masami Hiramatsu
Subject: [PATCH 2/2] reset: uniphier-glue: Use devm_add_action_or_reset()
Date: Wed, 15 Dec 2021 10:38:29 +0100
Message-Id: <20211215093829.3209416-2-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211215093829.3209416-1-p.zabel@pengutronix.de>
References: <20211215093829.3209416-1-p.zabel@pengutronix.de>
MIME-Version: 1.0
X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.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-20211215_013857_058260_00D43FE9
X-CRM114-Status: GOOD ( 15.39 )
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
Slightly simplify uniphier_glue_reset_probe() and drop
uniphier_glue_reset_remove() by using devm_add_action_or_reset()
for clock and reset cleanup.
Signed-off-by: Philipp Zabel
Reviewed-by: Kunihiko Hayashi
---
drivers/reset/reset-uniphier-glue.c | 50 ++++++++++++++---------------
1 file changed, 24 insertions(+), 26 deletions(-)
diff --git a/drivers/reset/reset-uniphier-glue.c b/drivers/reset/reset-uniphier-glue.c
index 9b22c4a91d77..146fd5d45e99 100644
--- a/drivers/reset/reset-uniphier-glue.c
+++ b/drivers/reset/reset-uniphier-glue.c
@@ -28,6 +28,20 @@ struct uniphier_glue_reset_priv {
const struct uniphier_glue_reset_soc_data *data;
};
+static void uniphier_clk_disable(void *_priv)
+{
+ struct uniphier_glue_reset_priv *priv = _priv;
+
+ clk_bulk_disable_unprepare(priv->data->nclks, priv->clk);
+}
+
+static void uniphier_rst_assert(void *_priv)
+{
+ struct uniphier_glue_reset_priv *priv = _priv;
+
+ reset_control_bulk_assert(priv->data->nrsts, priv->rst);
+}
+
static int uniphier_glue_reset_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -68,9 +82,17 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = devm_add_action_or_reset(dev, uniphier_clk_disable, priv);
+ if (ret)
+ return ret;
+
ret = reset_control_bulk_deassert(priv->data->nrsts, priv->rst);
if (ret)
- goto out_clk_disable;
+ return ret;
+
+ ret = devm_add_action_or_reset(dev, uniphier_rst_assert, priv);
+ if (ret)
+ return ret;
spin_lock_init(&priv->rdata.lock);
priv->rdata.rcdev.owner = THIS_MODULE;
@@ -81,30 +103,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
- ret = devm_reset_controller_register(dev, &priv->rdata.rcdev);
- if (ret)
- goto out_rst_assert;
-
- return 0;
-
-out_rst_assert:
- reset_control_bulk_assert(priv->data->nrsts, priv->rst);
-
-out_clk_disable:
- clk_bulk_disable_unprepare(priv->data->nclks, priv->clk);
-
- return ret;
-}
-
-static int uniphier_glue_reset_remove(struct platform_device *pdev)
-{
- struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev);
-
- reset_control_bulk_assert(priv->data->nrsts, priv->rst);
-
- clk_bulk_disable_unprepare(priv->data->nclks, priv->clk);
-
- return 0;
+ return devm_reset_controller_register(dev, &priv->rdata.rcdev);
}
static const char * const uniphier_pro4_clock_reset_names[] = {
@@ -172,7 +171,6 @@ MODULE_DEVICE_TABLE(of, uniphier_glue_reset_match);
static struct platform_driver uniphier_glue_reset_driver = {
.probe = uniphier_glue_reset_probe,
- .remove = uniphier_glue_reset_remove,
.driver = {
.name = "uniphier-glue-reset",
.of_match_table = uniphier_glue_reset_match,