From patchwork Thu Aug 29 06:48:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jianzheng X-Patchwork-Id: 13782646 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 35C37C7EE2D for ; Thu, 29 Aug 2024 06:51:02 +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:MIME-Version:Content-Type: Content-Transfer-Encoding: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=96gY8HaT9u3FOkaI36R03vmlpPBjIJ1u3SZNz5T7S7c=; b=kEVB1qO3ZXQWQ++cLgULn+KogV CYX6NjPGOFEyXPsYZ6qrhoaZIEkarsaLvMvmrnA1Na4DxOSo4sdgCli/GHLFApFkm1jzd/HCsTdzA 1ihg+zmpkfxZr3I7p8pZC8+2m54JyLK4JSd9ASodHdYcGqlhk5hhtlM4COfwZuzQXC4+q+8RbzxQv ph3li3rVM896XrKDmfOe2i0scWzZbwfMsYrN5MtO7BMxJlD6udVPr4mLbnXwx5zYqH3H/ABg5aLNV 5GnZzO505obDrYcceazMj6EN5s7zQtTj5aGB+79wslIdXS19F74UJX6/yvxCSKmv6gIaWSSV88WUU c5wqi1/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYzc-00000000qhN-0wNQ; Thu, 29 Aug 2024 06:50:52 +0000 Received: from mail-psaapc01on20600.outbound.protection.outlook.com ([2a01:111:f400:feae::600] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYy7-00000000qHk-3XnS for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:49:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CC1UB+HaYQQo/xeOYpCB00/paQ4H90jbVtwvzHPueR6CpBrEw3xVYC5/dr3O3fOrvfZQocGVtaFCM+eHwWMtYExYtMG6GCeDx0y3w28AP0WOiHBvgemONxYu7OSo9fQjFnShtywskptw76algC6JL4empgO0GwAWBAGZdpuuMwAQ170sYBZIbH2jSTjAiImJMgwOUHwsatoOPxDAklVa0ShnkMETY9uiPRF0XN2yLTeI2RZWxtvwkByDpWarMCWb+T3xTFzcdNF1EXSzddMwrNIEHYZXqjcfbpAKcyRXEXJigxj2sTRSinlkJqUCO1NUFKR2/UkxTP+rYWvOEYZEPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=96gY8HaT9u3FOkaI36R03vmlpPBjIJ1u3SZNz5T7S7c=; b=UBw+41i7al7IyQGmLqNNmEPbBEbooPYgjpE/QuoBLcumhp4sSe6E+qAVpDcd8JYS9H1iAJSUBfHahZRNHMlLpbRI0IWJ+MwzLmpS/GKJbJdggZM4LaniM4Qd2BNyHSepayJyy5QQDCh9ZaRKyDGDpXB8x13AC14E4FNEJixYq52nJkb/hyv5FKpAgUX2F1GCBXZgqjZiyRT0esmOytX1F88IZY4ir4WoHP3Xv6y8R/V+8GRaqttFLuSJMpN5bguGpKdjbXCNa9eR3/fWWLEEp4fkwIzpwXPxDxH6ZIdWSCbd5dRb6UUPjvf6sJ4oed2qCgH5dqn+oet144smKa3rMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=96gY8HaT9u3FOkaI36R03vmlpPBjIJ1u3SZNz5T7S7c=; b=pQjYlZ/dY96FW1mTYb+8odTsRA48h4DdqPbjZw0JpSFxoSfYte7LgCZRVlnX4bFBwOE9gDeHJbHhsSzh8HQtJu+ouRz/IXBo8MhT13Fvk6DSXpAuv4O9Obt5YznO8o0eskUSSFzuIlTMB5GnV6b/TzsubYLsp28m8WNtEqDwOzzwPhU4wsfHRJ1Sj8xGQtYnju0j5CxpvVmc2mBZ2+wvecu6ZayofttmE5AYECthMiYi43cwaJrJp0uVCWi+NPeKDE1THaae/6Z2+ZuXh5JFKkhlHn5Ew24F3l19o0e2ziHq/jM853X/JRCDf+dfbYDi/bxAxqcq5y6wbKfkMHex2Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) by SEYPR06MB6822.apcprd06.prod.outlook.com (2603:1096:101:1b0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Thu, 29 Aug 2024 06:49:13 +0000 Received: from KL1PR0601MB4211.apcprd06.prod.outlook.com ([fe80::29e8:8083:a2b3:bd1a]) by KL1PR0601MB4211.apcprd06.prod.outlook.com ([fe80::29e8:8083:a2b3:bd1a%4]) with mapi id 15.20.7897.027; Thu, 29 Aug 2024 06:49:13 +0000 From: Wang Jianzheng To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Linus Walleij , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Marvell Kirkwood and Armada 370, 375, 38x,...), linux-gpio@vger.kernel.org (open list:PIN CONTROL SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, wangjianzheng@vivo.com Subject: [PATCH 3/5] pinctrl: mvebu: Use devm_clk_get_enabled() helpers Date: Thu, 29 Aug 2024 14:48:59 +0800 Message-Id: <20240829064900.19909-1-wangjianzheng@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR01CA0153.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::33) To KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4211:EE_|SEYPR06MB6822:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a6e390e-ba7f-4b97-1ff4-08dcc7f6b144 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: clrcbGliar+BqH7txuqCTDCw8xVmLgz+MEBZ08/z9Cxe2e7VTCEawACtIiLKlB4EKc3Geo5V3MhKVjAv3hToc+Y8bTQ+qdJ3QpdH8pdtwhLJU4SiB6kBWJulz3tpZnnUMKYDm4r2i51FlKS2tUzXttDbqAPi3zakKGYNWfJPmCQxAaRUyur/fqTzUZyO/oOP67wFQ+eyBEqP8TtqWHB7M6tjwPDhjG8K58uzNv43ZsjUXfxWUMHyx8V7wvFz/5dvPVF4JfB8DWxGX/0kATh5mpRKSGL3fgUkeg2hflO0wrygAywwGZARPYRkyY8v0+IHRg5KwleG/FYonmNY9+6VEDhqxMqWRXytOliF2+YrhmmZMg1RbaaVNLHNocFTgZdXEMFbkoVTSsj7ka9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ispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:KL1PR0601MB4211.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w2XxC8YWIf52yhXeiiE+vf2leOyVabun3+PDu+eRo8yZupxjDaI1FV0dPipX+ibZJPeMIi4KHnMC9L1MXkFOrpdteK5ZNOj6LGsLRbuBAtotAisEwcKZPXo9udSmhiISoDT/2F2aUNa2kGMVCXlEo0o1K4ZcH7A5Gf6xptmr428pZdoi9G+RkFEFr9pyfTrS520zGdDAJ69AxSs++7XZM4OycKVbcDIJqEr3nGqyZflFVsFoKYa3luzDkjuW8dw0DZz+vKay6ooq91zlLsAkm8f2390PkdxbdolpVNNVY4sZUAMyp/ECB/WzgJEm4/KaPnN66xJqwwtNQuD0IWZXjkwI9NGQRFPPrqqaph0P7sYi6r9totTpcuyLYLsiVgaRK4LfDQXwSgjv6BfPsv9rR9kSZQXdSrP8Yu8ZQUjXKEh9wIxrJAw7peGKCSxK6PWUSB/ENCZBG8HEkShVR0S+e1lDdKBwexLJQKd30FnJWdguNsp3WxwpHRLAGwZ63T1Gv7S0l66e5LIdK8jb3OlVejQTkQqJZxuogdyxxhRZmj6/xzdOlqeXQg9cAAhdzZ68ciUqnHSJI17VjiMADL6+LC/eFDHP7mfvx8uW+oXBPtl4q6ycJGESEA1xqDoNL2N2yUbJwwnNCh/cO8qReoSnx5ETZgsf9ch358l5a4v+rI5Qp7mKb2OuC7o4lZ7FrN2bklg2jEWER38jORM8ojpbDawy41UkOgVjsqdo63GFCSOv/Lk9V8eQyP8o9D+/Zdgi7km7BcWS8tBPkeGoun6Bsf7v70TYygbVmenHox0DzbQLKLVSvw6u6/oyO6rwgZBC8PNwHUpKRHRJnGEpeX8nLmKMx1G3att68YwUXBGTvbgy9lPSNXxku9EdekYOZWH+6bn41VpTwVvCLMQDFlediY6koNTlprMy06wcFXHT8kEnOXYUM1fqhjVZ0URJFcgyPgQi98AUajup47sSIaUk/0LLBGuZCuA0h3NNYq4h3/6zZT5mpTBkPbDK6636YjCh4g5WghRfzesLntm7o1o4lSgu6PaanxSVe4Lq9x45eKsW5OxT+DGYKPxhB6aBlsUK2ErUtnq37PqS0gnmDPt9YI0Iyn5o3dFphJ40P3S9bGClbfoGwh22dZTmykqbDNTOv5tOp8wzSmdPIz2zWWct97DqWpNP6FhgWU6JLKl0EwdLUI3s4J84AlLbxKUglKic2iTq5DCcCXNY6aCzMQflQmwaFQuLQS7vRcKURx2UYC4FK6BOrM8gdyBXYubljQ9DR/rE76jmukcEUmYQpFkNNiZ6a0jUWYqYpdQot+zb4q3Fifbow/u6zB3gPVIaGCbM9eUX+kDGeFCG40dyIyjoPzCnsKk3IFQknR0jpEwrVkk2qLwhX+ZnABf769QPedOhjazVQov13P993vuhC+G8oroQI84Nk180/KdFfPeSS9PL94opT4IjARUPy/253pInZBQ3As4riqwzjzS/IvfimPoUkBdPGtUmzCW4JHvAjf+cec5mmuTHzw/cL0isHQ/awM6Owc2YfU4ukipCWVT3IDQjEIV6mN4b+dqyaw4CIpSdO/x0kngn8WYUnaZkQElY X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a6e390e-ba7f-4b97-1ff4-08dcc7f6b144 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4211.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 06:49:13.1101 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +ijgKz2EbttldJU4j36eGYhSRsKYb4U/eTXhEnpCHd5gnGFHN4W8W15sDljaq06FIeoHOpIH+R3RRKdELMNJ9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6822 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_234919_911917_9EB6999E X-CRM114-Status: GOOD ( 14.55 ) 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 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: Wang Jianzheng --- drivers/pinctrl/mvebu/pinctrl-dove.c | 45 +++++++++------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index dce601d99372..1c2a292ebbd9 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -767,7 +767,7 @@ static int dove_pinctrl_probe(struct platform_device *pdev) struct resource fb_res; struct mvebu_mpp_ctrl_data *mpp_data; void __iomem *base; - int i, ret; + int i; pdev->dev.platform_data = (void *)device_get_match_data(&pdev->dev); @@ -775,25 +775,20 @@ static int dove_pinctrl_probe(struct platform_device *pdev) * General MPP Configuration Register is part of pdma registers. * grab clk to make sure it is ticking. */ - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) { dev_err(&pdev->dev, "Unable to get pdma clock"); return PTR_ERR(clk); } - clk_prepare_enable(clk); base = devm_platform_get_and_ioremap_resource(pdev, 0, &mpp_res); - if (IS_ERR(base)) { - ret = PTR_ERR(base); - goto err_probe; - } + if (IS_ERR(base)) + return PTR_ERR(base); mpp_data = devm_kcalloc(&pdev->dev, dove_pinctrl_info.ncontrols, sizeof(*mpp_data), GFP_KERNEL); - if (!mpp_data) { - ret = -ENOMEM; - goto err_probe; - } + if (!mpp_data) + return -ENOMEM; dove_pinctrl_info.control_data = mpp_data; for (i = 0; i < ARRAY_SIZE(dove_mpp_controls); i++) @@ -812,10 +807,8 @@ static int dove_pinctrl_probe(struct platform_device *pdev) } mpp4_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(mpp4_base)) { - ret = PTR_ERR(mpp4_base); - goto err_probe; - } + if (IS_ERR(mpp4_base)) + return PTR_ERR(mpp4_base); res = platform_get_resource(pdev, IORESOURCE_MEM, 2); if (!res) { @@ -826,10 +819,8 @@ static int dove_pinctrl_probe(struct platform_device *pdev) } pmu_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(pmu_base)) { - ret = PTR_ERR(pmu_base); - goto err_probe; - } + if (IS_ERR(pmu_base)) + return PTR_ERR(pmu_base); gconfmap = syscon_regmap_lookup_by_compatible("marvell,dove-global-config"); if (IS_ERR(gconfmap)) { @@ -839,17 +830,12 @@ static int dove_pinctrl_probe(struct platform_device *pdev) adjust_resource(&fb_res, (mpp_res->start & INT_REGS_MASK) + GC_REGS_OFFS, 0x14); gc_base = devm_ioremap_resource(&pdev->dev, &fb_res); - if (IS_ERR(gc_base)) { - ret = PTR_ERR(gc_base); - goto err_probe; - } - + if (IS_ERR(gc_base)) + return PTR_ERR(gc_base); gconfmap = devm_regmap_init_mmio(&pdev->dev, gc_base, &gc_regmap_config); - if (IS_ERR(gconfmap)) { - ret = PTR_ERR(gconfmap); - goto err_probe; - } + if (IS_ERR(gconfmap)) + return PTR_ERR(gconfmap); } /* Warn on any missing DT resource */ @@ -857,9 +843,6 @@ static int dove_pinctrl_probe(struct platform_device *pdev) dev_warn(&pdev->dev, FW_BUG "Missing pinctrl regs in DTB. Please update your firmware.\n"); return mvebu_pinctrl_probe(pdev); -err_probe: - clk_disable_unprepare(clk); - return ret; } static struct platform_driver dove_pinctrl_driver = {