From patchwork Wed Dec 15 09:38:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 12696219 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 6A099C433EF for ; Wed, 15 Dec 2021 09:40:20 +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=0kIRw8fjBAs5yYI67Rgiv9gTew1VrjSrRrUTt+iIxlw=; b=ykLg2zXuXqnGjD yMC3rohKD6MCCsB4t5Uh2bOtNUvQws5+3Fm+/3inE2buU6dWGo/3m+WfToXxjFLukqkWgfqNv5rCA 5npgQwJH6syf6FmvvNlsH1496A75BjuZvyiHKiBlWaEplJGB+ZSPleC8qcQ+v0sbA1D/qKUCZK+uw 1WE7lWThRgs6JzzVoZe2E/OmVuQNTfUfQpQHyaGBx3/H6mzbcB7ORGRW6Pah4FLxxGQpy/WzgXtc1 1sP00124iLTpyMjKUQooAKi6JT3TdRkq1pXECyd/b13BcsWqCsg/siXtMR9ubFeWf7DbNS+d4xUSg s5RxipCXEvXVDaWtGAnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxQkW-00HWdv-7i; Wed, 15 Dec 2021 09:39:00 +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 1mxQkS-00HWd5-Dv for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 09:38:57 +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 1mxQkP-0002Ze-7c; Wed, 15 Dec 2021 10:38:53 +0100 From: Philipp Zabel To: linux-arm-kernel@lists.infradead.org Cc: Kunihiko Hayashi , Masami Hiramatsu Subject: [PATCH 1/2] reset: uniphier-glue: Use reset_control_bulk API Date: Wed, 15 Dec 2021 10:38:28 +0100 Message-Id: <20211215093829.3209416-1-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.30.2 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_013856_487078_C22AE1A4 X-CRM114-Status: GOOD ( 15.14 ) 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 This driver already uses the clk_bulk API. Simplify the driver by using the reset_control_bulk API as well. Signed-off-by: Philipp Zabel Reviewed-by: Kunihiko Hayashi --- drivers/reset/reset-uniphier-glue.c | 33 ++++++++++++----------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/reset/reset-uniphier-glue.c b/drivers/reset/reset-uniphier-glue.c index 908c1d5bc41e..9b22c4a91d77 100644 --- a/drivers/reset/reset-uniphier-glue.c +++ b/drivers/reset/reset-uniphier-glue.c @@ -23,7 +23,7 @@ struct uniphier_glue_reset_soc_data { struct uniphier_glue_reset_priv { struct clk_bulk_data clk[MAX_CLKS]; - struct reset_control *rst[MAX_RSTS]; + struct reset_control_bulk_data rst[MAX_RSTS]; struct reset_simple_data rdata; const struct uniphier_glue_reset_soc_data *data; }; @@ -34,8 +34,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) struct uniphier_glue_reset_priv *priv; struct resource *res; resource_size_t size; - const char *name; - int i, ret, nr; + int i, ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -58,22 +57,20 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) if (ret) return ret; - for (i = 0; i < priv->data->nrsts; i++) { - name = priv->data->reset_names[i]; - priv->rst[i] = devm_reset_control_get_shared(dev, name); - if (IS_ERR(priv->rst[i])) - return PTR_ERR(priv->rst[i]); - } + for (i = 0; i < priv->data->nrsts; i++) + priv->rst[i].id = priv->data->reset_names[i]; + ret = devm_reset_control_bulk_get_shared(dev, priv->data->nrsts, + priv->rst); + if (ret) + return ret; ret = clk_bulk_prepare_enable(priv->data->nclks, priv->clk); if (ret) return ret; - for (nr = 0; nr < priv->data->nrsts; nr++) { - ret = reset_control_deassert(priv->rst[nr]); - if (ret) - goto out_rst_assert; - } + ret = reset_control_bulk_deassert(priv->data->nrsts, priv->rst); + if (ret) + goto out_clk_disable; spin_lock_init(&priv->rdata.lock); priv->rdata.rcdev.owner = THIS_MODULE; @@ -91,9 +88,9 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) return 0; out_rst_assert: - while (nr--) - reset_control_assert(priv->rst[nr]); + reset_control_bulk_assert(priv->data->nrsts, priv->rst); +out_clk_disable: clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); return ret; @@ -102,10 +99,8 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) static int uniphier_glue_reset_remove(struct platform_device *pdev) { struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev); - int i; - for (i = 0; i < priv->data->nrsts; i++) - reset_control_assert(priv->rst[i]); + reset_control_bulk_assert(priv->data->nrsts, priv->rst); clk_bulk_disable_unprepare(priv->data->nclks, priv->clk);