From patchwork Fri Aug 18 09:30:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357538 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 467E2C001DE for ; Fri, 18 Aug 2023 09:31:18 +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=V5PjGV/+hZQTBpyrPQysaW6ALtMhASTXtJDVcpYLm9c=; b=1UTp0OFFHCshB4 wjgKZ5+fxOcMdlznLhuadHKHtPPa7Pw0WI6wmFFjgP4nTP71mkeO7Xh9h/GFjb/zn+UbvhEg4raW4 yjuLiOYagkc3rHvMW5TiAbOLzINzOeIUaAKV2UuhIcBrWELX1CupKZTP0/X9HtQj7IrXOzxyXabgS XJ/d/7vI0uJmGcG+a5FBfLAykkqiefsbTq7nK7d99QjjL/eJAc/4yg5LpaiZYibhMkMvjK3Bmgw/q 83+3UotsHN7km/YeEL/Ox2AxHN32rQXzpSq3FuceLq3Jr3h2ho2mTWjkvYQyTlUw4Ipj1ydjs2yrv uYn21K6sLiPN8IGn4RJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoh-0085g3-0i; Fri, 18 Aug 2023 09:30:51 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoV-0085aU-1w for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:42 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRxQZ5TzqzkXDM; Fri, 18 Aug 2023 17:29:10 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:33 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 01/11] gpio: cadence: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:08 +0800 Message-ID: <20230818093018.1051434-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023040_129769_94DBF878 X-CRM114-Status: GOOD ( 12.25 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-cadence.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-cadence.c b/drivers/gpio/gpio-cadence.c index 3720b90cad10..a545baed9136 100644 --- a/drivers/gpio/gpio-cadence.c +++ b/drivers/gpio/gpio-cadence.c @@ -203,18 +203,12 @@ static int cdns_gpio_probe(struct platform_device *pdev) cgpio->gc.request = cdns_gpio_request; cgpio->gc.free = cdns_gpio_free; - cgpio->pclk = devm_clk_get(&pdev->dev, NULL); + cgpio->pclk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(cgpio->pclk)) { ret = PTR_ERR(cgpio->pclk); dev_err(&pdev->dev, - "Failed to retrieve peripheral clock, %d\n", ret); - goto err_revert_dir; - } - - ret = clk_prepare_enable(cgpio->pclk); - if (ret) { - dev_err(&pdev->dev, - "Failed to enable the peripheral clock, %d\n", ret); + "Failed to retrieve and enable peripheral clock, %d\n", + ret); goto err_revert_dir; } @@ -234,7 +228,7 @@ static int cdns_gpio_probe(struct platform_device *pdev) GFP_KERNEL); if (!girq->parents) { ret = -ENOMEM; - goto err_disable_clk; + goto err_revert_dir; } girq->parents[0] = irq; girq->default_type = IRQ_TYPE_NONE; @@ -244,7 +238,7 @@ static int cdns_gpio_probe(struct platform_device *pdev) ret = devm_gpiochip_add_data(&pdev->dev, &cgpio->gc, cgpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); - goto err_disable_clk; + goto err_revert_dir; } cgpio->bypass_orig = ioread32(cgpio->regs + CDNS_GPIO_BYPASS_MODE); @@ -259,9 +253,6 @@ static int cdns_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, cgpio); return 0; -err_disable_clk: - clk_disable_unprepare(cgpio->pclk); - err_revert_dir: iowrite32(dir_prev, cgpio->regs + CDNS_GPIO_DIRECTION_MODE); @@ -273,7 +264,6 @@ static int cdns_gpio_remove(struct platform_device *pdev) struct cdns_gpio_chip *cgpio = platform_get_drvdata(pdev); iowrite32(cgpio->bypass_orig, cgpio->regs + CDNS_GPIO_BYPASS_MODE); - clk_disable_unprepare(cgpio->pclk); return 0; } From patchwork Fri Aug 18 09:30:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357543 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 ED0B0C7112B for ; Fri, 18 Aug 2023 09:31:25 +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=eNzJNtwrJE2eQ/yDOuJ3R1e2BSqFkU8GLOf/IDEqDUg=; b=r9Ctp6TMkeS8xB 2n8NQRmWmhgs8A6H2A1HTgtdDyB0zU4f5rrb7uUBa3VpeskoFbpR+LThHk1LjhhZyIacUH6blIXoa EOgk25BjXPteqm9Sx5VLwvPV9UCA+ytzK65jBUmEjpl4GvivqMFN5stYbQ8e/s92KxXD6is1iCe9X HuRg5r1DjTG5tgEdvsbq3zlpIJt6buhfJt1G+Nt7HPX7MjAxDkMia+LQz0Ji+vppGNzkGX1UL0yar G8iRg/6VzKp+0t876jiyJNzuwAT2HAYxzSLelJ/V3loRK2YT/a4arL7e0FIC3Acx+xQwWx3hgrvzK hOm9RaXcld6/qIbWjT4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoj-0085hd-2P; Fri, 18 Aug 2023 09:30:53 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoV-0085aW-2J for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:43 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RRxQc0sgZz1GF9c; Fri, 18 Aug 2023 17:29:12 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:34 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 02/11] gpio: davinci: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:09 +0800 Message-ID: <20230818093018.1051434-3-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023040_144262_A1D710F0 X-CRM114-Status: GOOD ( 12.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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-davinci.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 8db5717bdabe..23b5ae8cf2aa 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -477,7 +477,6 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) { unsigned gpio, bank; int irq; - int ret; struct clk *clk; u32 binten = 0; unsigned ngpio; @@ -502,21 +501,16 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) ngpio = pdata->ngpio; - clk = devm_clk_get(dev, "gpio"); + clk = devm_clk_get_enabled(dev, "gpio"); if (IS_ERR(clk)) { dev_err(dev, "Error %ld getting gpio clock\n", PTR_ERR(clk)); return PTR_ERR(clk); } - ret = clk_prepare_enable(clk); - if (ret) - return ret; - if (!pdata->gpio_unbanked) { irq = devm_irq_alloc_descs(dev, -1, 0, ngpio, 0); if (irq < 0) { dev_err(dev, "Couldn't allocate IRQ numbers\n"); - clk_disable_unprepare(clk); return irq; } @@ -525,7 +519,6 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) chips); if (!irq_domain) { dev_err(dev, "Couldn't register an IRQ domain\n"); - clk_disable_unprepare(clk); return -ENODEV; } } @@ -594,10 +587,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) sizeof(struct davinci_gpio_irq_data), GFP_KERNEL); - if (!irqdata) { - clk_disable_unprepare(clk); + if (!irqdata) return -ENOMEM; - } irqdata->regs = g; irqdata->bank_num = bank; From patchwork Fri Aug 18 09:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357542 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 4F1C0C678DC for ; Fri, 18 Aug 2023 09:31:25 +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=gc0Hnm6ruc10bWZ8vMa7NVyuLg9svqPQgS1nOPxznnE=; b=assrDiR6ZFUA/y xJNVc5llTxCxchg3KvzEBc3VUbOoJ9kxJAGl3pYm3gOhBHxV9IIvVuPY7JkB7nvGXRCcuS7dPoUkr x6Jtrj0qSvvrF6oQA9sXFG0qUXUetKCoeD0k3XqBoipLl+MYNFVjb6kTm8aM06ueOV3V+F/Aq+CkR +w9thXsbgpQq79d5aAzKjua5Zc0eSAyB4t48+YQnfGzJO+zzWiHu53jDO+fo+E8QE1BLv09rec8Ld BrR64dXb0jB3hxscT1Sf/FMbJSRpZRB6sSXp3tBVgcdkuGMfQmy84LJTkZCXQLQFO20p6u+nsl25b rvJwAO6mUSDuxJjEPJsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvom-0085ix-00; Fri, 18 Aug 2023 09:30:56 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoY-0085aY-09 for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:44 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RRxNl6JhJzFqld; Fri, 18 Aug 2023 17:27:35 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:34 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 03/11] gpio: ftgpio010: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:10 +0800 Message-ID: <20230818093018.1051434-4-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023042_367248_9B4E3321 X-CRM114-Status: GOOD ( 12.90 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-ftgpio010.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c index 5ce59dcf02e3..51724adf237a 100644 --- a/drivers/gpio/gpio-ftgpio010.c +++ b/drivers/gpio/gpio-ftgpio010.c @@ -253,18 +253,13 @@ static int ftgpio_gpio_probe(struct platform_device *pdev) if (irq < 0) return irq; - g->clk = devm_clk_get(dev, NULL); - if (!IS_ERR(g->clk)) { - ret = clk_prepare_enable(g->clk); - if (ret) - return ret; - } else if (PTR_ERR(g->clk) == -EPROBE_DEFER) { + g->clk = devm_clk_get_enabled(dev, NULL); + if (PTR_ERR_OR_ZERO(g->clk) == -EPROBE_DEFER) /* * Percolate deferrals, for anything else, * just live without the clocking. */ return PTR_ERR(g->clk); - } ret = bgpio_init(&g->gc, dev, 4, g->base + GPIO_DATA_IN, @@ -275,7 +270,7 @@ static int ftgpio_gpio_probe(struct platform_device *pdev) 0); if (ret) { dev_err(dev, "unable to init generic GPIO\n"); - goto dis_clk; + return ret; } g->gc.label = dev_name(dev); g->gc.base = -1; @@ -293,10 +288,9 @@ static int ftgpio_gpio_probe(struct platform_device *pdev) girq->num_parents = 1; girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), GFP_KERNEL); - if (!girq->parents) { - ret = -ENOMEM; - goto dis_clk; - } + if (!girq->parents) + return -ENOMEM; + girq->default_type = IRQ_TYPE_NONE; girq->handler = handle_bad_irq; girq->parents[0] = irq; @@ -311,25 +305,16 @@ static int ftgpio_gpio_probe(struct platform_device *pdev) ret = devm_gpiochip_add_data(dev, &g->gc, g); if (ret) - goto dis_clk; + return ret; platform_set_drvdata(pdev, g); dev_info(dev, "FTGPIO010 @%p registered\n", g->base); return 0; - -dis_clk: - clk_disable_unprepare(g->clk); - - return ret; } static int ftgpio_gpio_remove(struct platform_device *pdev) { - struct ftgpio_gpio *g = platform_get_drvdata(pdev); - - clk_disable_unprepare(g->clk); - return 0; } From patchwork Fri Aug 18 09:30:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357539 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 E6AB7C678DC for ; Fri, 18 Aug 2023 09:31: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: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=T5fXakRBHhrkC9Yhe1tSnKFADV8ljmmn35q7Cd54zNQ=; b=y8kyhQmbu+swcj br3gnQZpKL2V8O0gyVo/R2iJkhOHzFYx4374D25El4OGflgwMoHzuqDc4GWdQQl3w497cyuQwQh/v MIwryYLHI0Cwb+T/zOzrKVVe55EUwG5yAIdY2ZTGqI+tMNkrhTBCFx0NNVTB9gVANQ66oKu7WWj0K 0HG2HXy6KRh7bxSlC5P8fvs7V7Ifw0n4RzikEwS08LacWv30Ki/Dn5SJleHucQZ3m8UP7swuPSC85 zlQ3J6zMGQNoPbe5DeH2qo8a9i9US+4vUXShN2xMtOI4qKJMHqv8zDFz812RHK44Sqc6gqdza021e hBe+nFx7EST7WI16a87g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoi-0085gk-0f; Fri, 18 Aug 2023 09:30:52 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoV-0085aV-2J for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:42 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RRxQd1tTTz1GF9j; Fri, 18 Aug 2023 17:29:13 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:35 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 04/11] gpio: lpc18xx: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:11 +0800 Message-ID: <20230818093018.1051434-5-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023040_044807_EA24295A X-CRM114-Status: GOOD ( 10.91 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-lpc18xx.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c index ed3f653a1dfc..389f4d8befb0 100644 --- a/drivers/gpio/gpio-lpc18xx.c +++ b/drivers/gpio/gpio-lpc18xx.c @@ -352,18 +352,13 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev) if (IS_ERR(gc->base)) return PTR_ERR(gc->base); - gc->clk = devm_clk_get(dev, NULL); + gc->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(gc->clk)) { - dev_err(dev, "input clock not found\n"); + dev_err(dev, + "input clock not found or unable to enable clock\n"); return PTR_ERR(gc->clk); } - ret = clk_prepare_enable(gc->clk); - if (ret) { - dev_err(dev, "unable to enable clock\n"); - return ret; - } - spin_lock_init(&gc->lock); gc->gpio.parent = dev; @@ -371,7 +366,6 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev) ret = devm_gpiochip_add_data(dev, &gc->gpio, gc); if (ret) { dev_err(dev, "failed to add gpio chip\n"); - clk_disable_unprepare(gc->clk); return ret; } @@ -388,8 +382,6 @@ static int lpc18xx_gpio_remove(struct platform_device *pdev) if (gc->pin_ic) irq_domain_remove(gc->pin_ic->domain); - clk_disable_unprepare(gc->clk); - return 0; } From patchwork Fri Aug 18 09:30:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357537 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 A5270C678DC for ; Fri, 18 Aug 2023 09:31:17 +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=vi95COmrBKIelK8MRYKiH9MhU/jCj91FBPXhuMLEcwc=; b=mvwkD0qVKC7VaJ 2Em5gkcQN0rTkDbRH6alGXwrC973frxtI9SN6NOZ31SPuCLh8nzyPogBdW/wt14UnIDwhiwNF19OB DjGLmID4QrfvBP0QJr9QfEuy8ZiPmhDEChVH5/wq9N0CB6qp2eVlyVTNj7TZSiTdy7tm3HBC2iRvv BtZBkWpA19tQx2loV4ICTx+hYQWRDEzRldbWFpd81v0XbpXmqv1tc6LfFLQHHtHlpu2+OzMEhgm9l hw2U+TUrJ3ELF/40F46uQsajk7BnXjs+f7k/i+n4oLBBfUug5+UBgl17Dgde5+igy1pF3Z8+S+0OZ 1G2gsET3g2BhQDZf7Gfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvog-0085fj-1P; Fri, 18 Aug 2023 09:30:50 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoV-0085aa-1w for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:42 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRxN15pglztSFW; Fri, 18 Aug 2023 17:26:57 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:35 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 05/11] gpio: mb86s7x: Use helper function devm_clk_get_optional_enabled() Date: Fri, 18 Aug 2023 17:30:12 +0800 Message-ID: <20230818093018.1051434-6-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023039_957571_A3D460A3 X-CRM114-Status: GOOD ( 10.81 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get_optional() and clk_prepare_enable() can now be replaced by devm_clk_get_optional_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-mb86s7x.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index ca7eb5e8bfaa..8f2abc914dfa 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -170,14 +170,10 @@ static int mb86s70_gpio_probe(struct platform_device *pdev) if (IS_ERR(gchip->base)) return PTR_ERR(gchip->base); - gchip->clk = devm_clk_get_optional(&pdev->dev, NULL); + gchip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); if (IS_ERR(gchip->clk)) return PTR_ERR(gchip->clk); - ret = clk_prepare_enable(gchip->clk); - if (ret) - return ret; - spin_lock_init(&gchip->lock); gchip->gc.direction_output = mb86s70_gpio_direction_output; @@ -196,7 +192,6 @@ static int mb86s70_gpio_probe(struct platform_device *pdev) ret = gpiochip_add_data(&gchip->gc, gchip); if (ret) { dev_err(&pdev->dev, "couldn't register gpio driver\n"); - clk_disable_unprepare(gchip->clk); return ret; } @@ -211,7 +206,6 @@ static int mb86s70_gpio_remove(struct platform_device *pdev) acpi_gpiochip_free_interrupts(&gchip->gc); gpiochip_remove(&gchip->gc); - clk_disable_unprepare(gchip->clk); return 0; } From patchwork Fri Aug 18 09:30:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357536 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 4DDA6C71136 for ; Fri, 18 Aug 2023 09:31:13 +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=nyQHVkJa8AX+jJSzBkeQ9IxBJWQ3uQXYBZlOY1izGDc=; b=sm4qyuitglFDnw EIWissQgJAqzXafR9i63OwQAbrgUu28YkT+6YWcFbbflQCId6FGiXDTrXvBTCOx8g7qOdvfHU6W/T /BRmL0vmWOyUvLCN6Lk9F6TUKaazmmmlMaJZA55AFsT25+0F0JN18HieGVd6pEXuXMRfZxx3XCC7X CudhbM974C2ywaVDS5/m2+0+c5Z7MthYyl2P2+plad419oVz8Sf31a4p3Qa8aZlJNdWgPZQYAjJIm R1x03zduJ4d2ALBu8+0h+cjtyrVo7Pwm+XobPKEz641RjPA2FEMQFFkTs1EnY/kB/WTg10hjwdhx2 wauypZ8Q8DS4G6ZjjUlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoY-0085dF-3D; Fri, 18 Aug 2023 09:30:43 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoV-0085ac-1w for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:41 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRxN22v5mztSDJ; Fri, 18 Aug 2023 17:26:58 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:36 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 06/11] gpio: mvebu: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:13 +0800 Message-ID: <20230818093018.1051434-7-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023039_957923_049521DE X-CRM114-Status: GOOD ( 10.48 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-mvebu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 67497116ce27..e0c9b2976705 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -1163,10 +1163,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev) return id; } - mvchip->clk = devm_clk_get(&pdev->dev, NULL); /* Not all SoCs require a clock.*/ - if (!IS_ERR(mvchip->clk)) - clk_prepare_enable(mvchip->clk); + mvchip->clk = devm_clk_get_enabled(&pdev->dev, NULL); mvchip->soc_variant = soc_variant; mvchip->chip.label = dev_name(&pdev->dev); From patchwork Fri Aug 18 09:30:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357541 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 80480C001DE for ; Fri, 18 Aug 2023 09:31:22 +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=9lLujeNEO7dPaSaFxcTozup23Qfd6RwPG8RMMQp3zEw=; b=uOo6gfT2TMExm/ UTq7ilXkBiKv8/JnXgEEHBk9C28sqRnK+GoaEergCIf6yYepoMxE27fjzb/1mDU5EQMXEGNtfoqDG aPk5dzcxrpHgIEd79D50kJgEdixEhVFw/EHAPE4vjtka8g9vdsXk6/Pka81ECzEb789fR8SWpfdJd k6B8V/FkKjy4db2tTwPYJa1D2a1VBpwar6/C2hldXsKn/sTJFbmC8iZszPTF2s8o1q+BQN0OLzPvF F5uSzhOr/Kce2QMqBfBppb95Y/vBQbARibq/+8yl7XZXE7wkKx5myAWyFw4p1Crn4clywERH+Cksw ixMAYVRwBZsUxUU8B1XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoi-0085hB-2y; Fri, 18 Aug 2023 09:30:52 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoW-0085ad-06 for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:42 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRxN2722lztSFq; Fri, 18 Aug 2023 17:26:58 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:37 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 07/11] gpio: mxc: Use helper function devm_clk_get_optional_enabled() Date: Fri, 18 Aug 2023 17:30:14 +0800 Message-ID: <20230818093018.1051434-8-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023040_304964_77A03746 X-CRM114-Status: GOOD ( 11.09 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get_optional() and clk_prepare_enable() can now be replaced by devm_clk_get_optional_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao Reviewed-by: Andy Shevchenko --- drivers/gpio/gpio-mxc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 004c6ad7ce52..4cb455b2bdee 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -452,16 +452,10 @@ static int mxc_gpio_probe(struct platform_device *pdev) return port->irq; /* the controller clock is optional */ - port->clk = devm_clk_get_optional(&pdev->dev, NULL); + port->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); if (IS_ERR(port->clk)) return PTR_ERR(port->clk); - err = clk_prepare_enable(port->clk); - if (err) { - dev_err(&pdev->dev, "Unable to enable clock.\n"); - return err; - } - if (of_device_is_compatible(np, "fsl,imx7d-gpio")) port->power_off = true; @@ -535,7 +529,6 @@ static int mxc_gpio_probe(struct platform_device *pdev) out_bgio: pm_runtime_disable(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); - clk_disable_unprepare(port->clk); dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err); return err; } From patchwork Fri Aug 18 09:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357540 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 CA531C7112B for ; Fri, 18 Aug 2023 09:31:21 +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=jKfbbTer8P7QZZq+zKVitvzShXQFefa1KSrh5+IFaLE=; b=FNMARRo0htlfgn R4NLNruVz2C64esF1h5HZ2If9DAFAEAm1beB9Wa2BtXHcbmJqWqSArlW/UC9YmnEnqeGRh/ChEnTQ UnqgYRClnrX/UUvXY5a/xZ1FrSf5AlrZkpDtITK2VOk528FyWEhmosrHlSvBlsQBobaORhdru5hMe kPfOkW5ZgttIu/y1xbHL4HcnXddLd14pYM/OVZZw+FmNuUxE+eERPJKloUmWnKDc9xsHAPQSPnhrc phB9OM64zxr5pddI9v1X4UAw2A4sZyZiVm24Kc650GAbey6FxLUqHhQN0a1+Ei30RzkP/4p8/XZK6 hM8+eWF7/dWkzUPGg07A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvok-0085i0-1K; Fri, 18 Aug 2023 09:30:54 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoW-0085ah-1o for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:43 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRxN33xm2ztS9J; Fri, 18 Aug 2023 17:26:59 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:37 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 08/11] gpio: omap: Use helper function devm_clk_get_prepared() Date: Fri, 18 Aug 2023 17:30:15 +0800 Message-ID: <20230818093018.1051434-9-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023040_869722_EBAE22EC X-CRM114-Status: GOOD ( 10.59 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare() can now be replaced by devm_clk_get_prepared() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao Reviewed-by: Andy Shevchenko --- drivers/gpio/gpio-omap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index a927680c66f8..c0131ee0f90c 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1450,13 +1450,11 @@ static int omap_gpio_probe(struct platform_device *pdev) } if (bank->dbck_flag) { - bank->dbck = devm_clk_get(dev, "dbclk"); + bank->dbck = devm_clk_get_prepared(dev, "dbclk"); if (IS_ERR(bank->dbck)) { dev_err(dev, "Could not get gpio dbck. Disable debounce\n"); bank->dbck_flag = false; - } else { - clk_prepare(bank->dbck); } } @@ -1474,8 +1472,6 @@ static int omap_gpio_probe(struct platform_device *pdev) if (ret) { pm_runtime_put_sync(dev); pm_runtime_disable(dev); - if (bank->dbck_flag) - clk_unprepare(bank->dbck); return ret; } @@ -1496,8 +1492,6 @@ static int omap_gpio_remove(struct platform_device *pdev) cpu_pm_unregister_notifier(&bank->nb); gpiochip_remove(&bank->chip); pm_runtime_disable(&pdev->dev); - if (bank->dbck_flag) - clk_unprepare(bank->dbck); return 0; } From patchwork Fri Aug 18 09:30:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357546 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 11595C001DE for ; Fri, 18 Aug 2023 09:32:12 +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=O1V/ydFMcUaG3oe7AXTSGXTQ1c8GrcNiCSHD589JQAY=; b=us2mDVf4rtLRKH 1WkCp6wm8cMt1DxxEQsYyRQtmCtklxUmmuldHUwjIYVd6i0mX+3YWkCjum1f7EYC1GVzxYNUoZplb xYEAzZdV/PLZQymQWBuz4ZdKZlv4+IlvdjeEZlkLRa7VU1qYqSuY14LC04LKVqcn6NCU8s8dMpoYj lvYid0tLXJ9aXX46b9yCpUXyx16WD5qsjhneQDMvwBdbG2OXMwS1W/AsavPz6fI6is6b3sh2p2gr6 jK0TMgo7toUQmwCSMgpO6wybN8NzGdrWNaUxkNgyu0jlCSnDNwHwz7vTUn2lshdQ1rDCgKnydaEJ0 IrXd540jk5+a0nGIdjyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvpZ-00866D-2g; Fri, 18 Aug 2023 09:31:45 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoh-0085fl-10 for linux-arm-kernel@bombadil.infradead.org; Fri, 18 Aug 2023 09:30:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=reemtYFFQ5donWPe9DtW140I3asEaSwo6HCaowc8fZM=; b=TWJTw2mpCNppArkA6+e2CLnKDj gRNPyl/3HT8p3M1yugj5x7PcMnMmPQvmEWBETCTzANyzuEN8RSwH5y2w5pz+ep9f+h1e/XEjxHbV3 1x93V06lz1BpuT4qEaq52myQzMsv1L7Xb31qmdWOC/nQ36QCBRMgFh3DRw2Jyde18GJnkB15QjzYw DbtMvqduHQR7vgifFsuyUF26rhdjUby1kySTgZgjMiC3ltbdqeWj7hVtXtob9vSdoE1N6PZL4nvN1 uHywL9V7uQygICNkVWWgun3sIrMKhNgpLsTdLyn/MEtX4jqLzSn1oxv7hjWPM57b535NCnh64eQLv V0OV7v0Q==; Received: from szxga01-in.huawei.com ([45.249.212.187]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoc-00FNqo-2C for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:49 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRxQg33gqzkXDb; Fri, 18 Aug 2023 17:29:15 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:38 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 09/11] gpio: stp-xway: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:16 +0800 Message-ID: <20230818093018.1051434-10-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_103047_379384_D388CB62 X-CRM114-Status: GOOD ( 11.11 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-stp-xway.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c index 053d616f2e02..5a6406d1f03a 100644 --- a/drivers/gpio/gpio-stp-xway.c +++ b/drivers/gpio/gpio-stp-xway.c @@ -296,23 +296,17 @@ static int xway_stp_probe(struct platform_device *pdev) if (!of_property_read_bool(pdev->dev.of_node, "lantiq,rising")) chip->edge = XWAY_STP_FALLING; - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) { dev_err(&pdev->dev, "Failed to get clock\n"); return PTR_ERR(clk); } - ret = clk_prepare_enable(clk); - if (ret) - return ret; - xway_stp_hw_init(chip); ret = devm_gpiochip_add_data(&pdev->dev, &chip->gc, chip); - if (ret) { - clk_disable_unprepare(clk); + if (ret) return ret; - } dev_info(&pdev->dev, "Init done\n"); From patchwork Fri Aug 18 09:30:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357547 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 C3742C71136 for ; Fri, 18 Aug 2023 09:32:14 +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=hlsph5zbPeuB4ZRV6cus4DyvCzWZ+DLln/lfM19F7Pk=; b=0AvVrXpb/IqnQR BjBrU5Zb0VIZ+LbD298vxyF7EwyPS/Aqhfb2cFvMZEx1EuFQ26Fk2t2TX/Lx7PiX57CE8STq3fVvs 2GiNCOCMHncNjXjkP8aGxGGgC3f8UXBrChWv0msAkNPydBFkoKWTWV8F2QLSBUT1R/4I3pNpHFPc7 mvyRqrPZAAo0t1i//QtNuUfnPuBvNzlvejV/id4vnO7PBZ8A6RJf5eA5razJU1pIgrpNMX/qXkBtx CCyKbelgf9QhFNZvnAvaLzUBbXKlGNEMYy+2Sei/UNpuJlNHShFU+5wbP6OSaU2szPkPQ404iPfNK RqK5GFFQPtzyDZ9jjpDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvpa-00866f-2F; Fri, 18 Aug 2023 09:31:46 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoh-0085fk-10 for linux-arm-kernel@bombadil.infradead.org; Fri, 18 Aug 2023 09:30:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=8yfDBqcOturArueWHORosyD5eGfywzTJpL5L/4mJtzg=; b=BWFROyG/vioU3oksjIJjA2lwnF fcjT4g0Cmg0bm8wagWiEa4CQtYlxZtZuA6woIMEf16IiEvQFFTe+IdJKUFO1IyRIyqEOPqn/AoUeY pWH/DeylgsHNsKfBlmQsK7bzShBw5NkevgD0PICM/U8S4CMEMziEQsz/XYKDfv9eNI/+eyYNsSu1j Wjdbv04+5CnMG1Ya5EtH07gl4jUHxUzTKjldy3967G+PBcxHtx9WIBKkENDKjVK8p/JlFF+z+VVjD zMdgxebaArIkmZ/n6ZXywQNsuZJVoPbsygjZVA5Poc8/TYh3fZf/eK73AY0PPO1p9g+5mbEWI1oZk 4LghiQ8Q==; Received: from szxga02-in.huawei.com ([45.249.212.188]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoc-00FNqq-2C for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:49 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RRxPq0hvVzVkYK; Fri, 18 Aug 2023 17:28:31 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:38 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 10/11] gpio: xilinx: Use helper function devm_clk_get_optional_enabled() Date: Fri, 18 Aug 2023 17:30:17 +0800 Message-ID: <20230818093018.1051434-11-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_103047_369270_852843CE X-CRM114-Status: GOOD ( 11.04 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get_optional() and clk_prepare_enable() can now be replaced by devm_clk_get_optional_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao --- drivers/gpio/gpio-xilinx.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index a16945e8319e..4e4da07bf8a2 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -334,12 +334,9 @@ static int __maybe_unused xgpio_suspend(struct device *dev) */ static int xgpio_remove(struct platform_device *pdev) { - struct xgpio_instance *gpio = platform_get_drvdata(pdev); - pm_runtime_get_sync(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(gpio->clk); return 0; } @@ -647,15 +644,11 @@ static int xgpio_probe(struct platform_device *pdev) return PTR_ERR(chip->regs); } - chip->clk = devm_clk_get_optional(&pdev->dev, NULL); + chip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); if (IS_ERR(chip->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(chip->clk), "input clock not found.\n"); + return dev_err_probe(&pdev->dev, PTR_ERR(chip->clk), + "input clock not found or failed to prepare clk\n"); - status = clk_prepare_enable(chip->clk); - if (status < 0) { - dev_err(&pdev->dev, "Failed to prepare clk\n"); - return status; - } pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -702,7 +695,6 @@ static int xgpio_probe(struct platform_device *pdev) err_pm_put: pm_runtime_disable(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); - clk_disable_unprepare(chip->clk); return status; } From patchwork Fri Aug 18 09:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357544 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 A4299C001DE for ; Fri, 18 Aug 2023 09:31: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=W9aPWJeODLXUYBTGSaBOGLhx+YShbkNaHj7hK0idniw=; b=NdC7fzGdm/Mmy+ WhUONVft023jwFg/A5P+GMaZMf40Gj8eXJWMQ+qVYBjy6T7oR0vMC1LxLnBrkdxmpWv99OGGQVvpv wZa/YSaRiXgdhI4IezDKWgjjI9AoOcATZPVemJJqU8CMm2zbL01etSfVyD2Q/rhuy0hkfWTZLjOfi hJPLsM/tnBtiATRfGO/IdL2TuZRnZhRAq40Sh9laeUXylWmeSrn/8u11BKqoRnzG7DidzUGbswBDK rufJFGan0VFIJYeNZ16LayVf0MlqKDJxb2MLil3X3fkzIUc/5VQ4pZAGb9A/kNQEkc4Jl+cIP3z66 9QXQ+mFb3GBwAnwoE6Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWvol-0085iS-0h; Fri, 18 Aug 2023 09:30:55 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWvoY-0085cI-0d for linux-arm-kernel@lists.infradead.org; Fri, 18 Aug 2023 09:30:44 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RRxQj2Jnxz1GF9p; Fri, 18 Aug 2023 17:29:17 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 17:30:39 +0800 From: Li Zetao To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH -next 11/11] gpio: zynq: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 17:30:18 +0800 Message-ID: <20230818093018.1051434-12-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818093018.1051434-1-lizetao1@huawei.com> References: <20230818093018.1051434-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_023042_520174_ECB2303A X-CRM114-Status: GOOD ( 10.77 ) 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 Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao Reviewed-by: Andy Shevchenko --- drivers/gpio/gpio-zynq.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index 0a7264aabe48..98cb38c95837 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c @@ -918,15 +918,10 @@ static int zynq_gpio_probe(struct platform_device *pdev) chip->ngpio = gpio->p_data->ngpio; /* Retrieve GPIO clock */ - gpio->clk = devm_clk_get(&pdev->dev, NULL); + gpio->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(gpio->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), "input clock not found.\n"); - - ret = clk_prepare_enable(gpio->clk); - if (ret) { - dev_err(&pdev->dev, "Unable to enable clock.\n"); - return ret; - } + return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), + "input clock not found or unable to enable clock.\n"); spin_lock_init(&gpio->dirlock); @@ -977,7 +972,6 @@ static int zynq_gpio_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); err_pm_dis: pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(gpio->clk); return ret; } @@ -997,7 +991,6 @@ static int zynq_gpio_remove(struct platform_device *pdev) if (ret < 0) dev_warn(&pdev->dev, "pm_runtime_get_sync() Failed\n"); gpiochip_remove(&gpio->chip); - clk_disable_unprepare(gpio->clk); device_set_wakeup_capable(&pdev->dev, 0); pm_runtime_disable(&pdev->dev); return 0;