From patchwork Thu Aug 29 06:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jianzheng X-Patchwork-Id: 13782644 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 B95BDC7EE2A for ; Thu, 29 Aug 2024 06:49: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: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=dVwAX4Aemk9Y+b84TBb+XP/wjmeUC22ujyb7rdt9x68=; b=eLXjoki4OS+wRcgwJKDMWgua98 44ET/L+mtPp9KQMLw2Xm5w5ulN4XxpCEz0Jq9ze2JbRRoF9kHF7+KotLljGyjp45LPGuiF0ZE8yEq RwkiYtVfmyqW4IJ8ZgCU7JeA3wQ7MEYglBfOUdnACL2tRkAWPEeOWzKiQAv2mVzHj2EJ/ImuuL0/o oh1RdFK9ao7SStIfSMYTT7zksLnHpKUlKUufDn/NaK4CI90s+4TJpa4JEElo0JbFTgeEcSbeI07rI 2+u9Tyy1mrDZiBAqHHORe9JO/QNBkTz9xSLxV+LJwIp3RTKcPiovR4Zs0NXp1kV9ovN2ThUhj+3ik fdcIS2KA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYy0-00000000qFQ-0DRv; Thu, 29 Aug 2024 06:49:12 +0000 Received: from mail-psaapc01on20608.outbound.protection.outlook.com ([2a01:111:f400:feae::608] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYx8-00000000q1i-37yr for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:48:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G67dtSesRM3GSKiInlKxbHtVObQyFGaGI7ONf4/1awJMWI7lroQNmileSp1CYA5N11tchjjnhxa9SM/FFhh5o04AjaTJY/7w0BFyzcXMqRfV45bzly7OLozHJKQQ4l+TWW+LRaXJRrTyUSNXnL6QQkvPubshvSdTNeLZvz1j8Pq+/mSnyTUpIGBCa0D41pHeuv+6lze94PdTKxaghreoMC5ZieMnMLZFH3cwsMU9oUkoUb7z49F3U3KhP+DGZVTCy+1lsEQPMJN2PPwXWb05OlzuKqIDTWsBd0NOxXxYtlVvPD4Bf6DxA2cZmaHaMH2he/ubqL4/msESwo4L5X5ctQ== 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=dVwAX4Aemk9Y+b84TBb+XP/wjmeUC22ujyb7rdt9x68=; b=PnH6cO4jtmW2cp42RNyMNUEjpqDQOxAZ4BlQfMPmtGZB5SixLb9iOOdjV0M8X5tjZJW/oS9+4GQDnWZFs+yMJaJHfTD2T6WxmWueWCKuAglcArCon1pZ05Hfr/O4wWpH3EKOfvUyoBc/1gLrnaqeje9iXYEu9TuzP5xOb8rPjQqEsSZ/aLT8fEbEd3unoE217WHLzgRV4SAMxF2S6bTP1Fw8qxXIF7nTkHK9lixrvz2oBItXsodTkaGQt61W1e2TUaHWZKGgf4JK4shcQ440/ykuiia0fLiw8Q/yGT3xNNgjWDr/AhB2BQNyTHm8KqJjr0TAscZ9RZvQdOgCP3diBA== 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=dVwAX4Aemk9Y+b84TBb+XP/wjmeUC22ujyb7rdt9x68=; b=bLlypdfWRGvsLZVGnB0NGVMvuxxGL89aTwYINabH4R2qMocEFj1dMPsVFdWx5UZDNOriwSIlj5XvtRYVstLbJ/bzLdNYwTrNN//eQ0H5xuDDiYEQpebAK8VXqtpi+3ddts7aJIwnSkRfI1rVTlpr68EPGZtytC3v2qTI3MYAf1ppsVzIm81Pxp5ZbopcVdufVlTzyLdhfr0eN6Uur7MtP0KImcEFkJB7IX3AokDubWLLqmVQFRgZYg8dv+lBTFz93IJXogBYKPS9rynsKcG0ENOSH8wUpm2NTngvf+FG0RHbQc1vAMJ6XEo2Rz8D37Jw4/zeAbFTUrEC74CiumCa4w== 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 TYSPR06MB7047.apcprd06.prod.outlook.com (2603:1096:400:46d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Thu, 29 Aug 2024 06:47:58 +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:47:57 +0000 From: Wang Jianzheng To: Linus Walleij , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-gpio@vger.kernel.org (open list:PIN CONTROL SUBSYSTEM), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, wangjianzheng@vivo.com Subject: [PATCH 1/5] pinctrl: sunxi: Use devm_clk_get_enabled() helpers Date: Thu, 29 Aug 2024 14:47:37 +0800 Message-Id: <20240829064737.16169-1-wangjianzheng@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYAPR01CA0174.jpnprd01.prod.outlook.com (2603:1096:404:ba::18) To KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4211:EE_|TYSPR06MB7047:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fcd4967-1789-450a-03a1-08dcc7f683e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: ssajJbdMA6fjlt9SwHq8Exp4wZ+UcYUC7Xmpm3B0hFbfX0beoSGGJ1YFw09cTo3KzKB9ex5qe5OZyE6H3Iq4O+1jUV+ZRpb1X6RfwJPqta7zGud/FGBofBph4Om4mbCi2mIByFlEWTOsl+ej0KoP015gaXTUvu8zOK2JcKmQAmkxAbodlJM+tjzGmMcrYQpSKwj/d1DAbpbdg6uco0o0JqtKTiQSDaOyy0PahjB1evmazVK9t0AwbKqtpMbPT49CfhbrgzYD5coEo4pdQ2GhZxqew9ROuJFtsK6BtFw5ZHRVpBEbL+j1xfFxOXXm0YZSsEjtxVMjY5OGLdyqlA9uH6Ku1AC9hdmZMQKXH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Forefront-Antispam-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)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lDPP/t/skaNCN1yYaSZYbiiOtQgaSlc/zEFu+MXjK1/BDAlAbpkJ9lPexHLeq4/twW7UL2Wh7YjUbXgXOHw6aMn8uMt4SGQ1MdJ+sWLfe+adxJAMVBt3duzbXrTEQgWFxys4Ovtu8yLz421ttvizzV+IXt0PFHxbjpnhpy2Q/u8H8r0ix89LUhMSKvDweOMrO/PTGRRdys5xtYbiy2UdlT6o323KaDtLZ5Gd1x6nbqUUrdjsOLvB23eGHA+OwpZ9aDVqW3QPTgLwU2UB8+fgEWYCJUbYCRWkQkFruAP9Ixi75ASclwA8lN606Qb6Ong85jIHh2NpD4DzY5s2NCnpznf4N6p1g8692BHqirA9Foro4OkwhY7QEWO1Wng1buA4QORpQB7X4BG8y/BL/pTUGxJ737GuAPMMbzvQreYcGwvNAdiEWoTwT8avCCvFEGyNELDqLSs2hIDEbAIXx/tnbwz8QCy/6Z+iA9/R7ACwyV8GwttEUrh1IH+DyISBoPEMzTCIjUp9XAGSy0AgGrtsao5jTqG/9aiPPxEqfq4KnydcxHBvHWZKM90JCu8a5L4KJTfYIm0vDExuO+nBrofGvLRj24aJKCu9IoxnkdSrqG+f/aEdifFboRPw+a7jR6MBPIkf5RSwGOTpin2f54USKs07BNYAiUmXGL28vcQeSRasm1UbhrQW34oDKiKg6izXleSYj+Jv46JliR1fVNroOeE3NLqrL31+4AwLLpaV+7+CkZ7oR6SG6BlyWG357APNkrN0PE+/Q52loYE9NZ0nr5UcmiEkHJVw08k9dOYgeY+V+1uUyAMWmUkcGh+C8cfe6P+0sWWwDAL4yxFiZ3V5f/oGT5rCUZYeQ8z1Jf1cm83K8kqdxiqxcQwC4kIQTJPck689pqsobKh54DKeib/ZRj8y8rHSrhhEPz5CiBqt82yczHY67dtd4AlSjd8JfwKlMp3NN/OKh5059hVgH5Ap7RrKGiy6DWQVe3XyXXmIH+YbG74jqX1ax/DkGZCOrmNpgIO4g9ExZAiXsQ4900n+5RnyaW01w4bURSD3ZW/4o2N2BL+OUtqiVd/3vmommFCNX6aoQ0s9QYkp32TfpZVWkhL54yVKmwLDWEpMgziKVLjDnP/Ghz9v4J30j7nahLski2Wb1OuCEpwaVuDzckO62LMS+KngTB24+0KekfTDjk4L2Og/sKOQA3ULtFSTtuRQ9vFXTQVdf3I7Zf9rtLCmVKCGiY3QCLbaD+izNTw00hSa8EeeCHoL6zWTyEWUQcfLom5F/2AWXD0vWfFmhRWneOm3bP7pnO5hE/30FudorprcbxGRd6/l0W6oB0m6cANKN+4SHTTwwYB7Q9acyLCbhmpM459+HInjOjNZf614TDIfTFYBOb5z2wUwmfp9MsNalXxBC1nSmaFEOO8mJvxuU58u+XDdDYnzGawyz08SsqXLPR0jqXORhN8sfzVDA/KDt54vcANKjVwmO+SInk8Z+eZHbwj+TTIHYaU/nLpzzgbmhnzRqwW9PQqFzamMSNRpnFWPCdP+eLZ/yid6vcquyJBgfdZNamsZvXKNyL1kUiiKMojGiAoq379EggYRB9l2 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fcd4967-1789-450a-03a1-08dcc7f683e9 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:47:57.0969 (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: XNQqBgGKpcx8hKRH8IVpvknog9X8SL3ZegsbXR2un1vvdVnPsJ04YmsVuSTpziuTCfnsYDG81Hzo7J+HCjco5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7047 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_234818_815828_A3544AB1 X-CRM114-Status: GOOD ( 11.28 ) 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 sunxi sunxi_pinctrl_init_with_variant get, enable clk and deinit_device disable and unprepare it. This simplifes the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: Wang Jianzheng --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 73bcf806af0e..bde67ee31417 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -1603,30 +1603,26 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, } ret = of_clk_get_parent_count(node); - clk = devm_clk_get(&pdev->dev, ret == 1 ? NULL : "apb"); + clk = devm_clk_get_enabled(&pdev->dev, ret == 1 ? NULL : "apb"); if (IS_ERR(clk)) { ret = PTR_ERR(clk); goto gpiochip_error; } - ret = clk_prepare_enable(clk); - if (ret) - goto gpiochip_error; - pctl->irq = devm_kcalloc(&pdev->dev, pctl->desc->irq_banks, sizeof(*pctl->irq), GFP_KERNEL); if (!pctl->irq) { ret = -ENOMEM; - goto clk_error; + goto gpiochip_error; } for (i = 0; i < pctl->desc->irq_banks; i++) { pctl->irq[i] = platform_get_irq(pdev, i); if (pctl->irq[i] < 0) { ret = pctl->irq[i]; - goto clk_error; + goto gpiochip_error; } } @@ -1637,7 +1633,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, if (!pctl->domain) { dev_err(&pdev->dev, "Couldn't register IRQ domain\n"); ret = -ENOMEM; - goto clk_error; + goto gpiochip_error; } for (i = 0; i < (pctl->desc->irq_banks * IRQ_PER_BANK); i++) { @@ -1669,8 +1665,6 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, return 0; -clk_error: - clk_disable_unprepare(clk); gpiochip_error: gpiochip_remove(pctl->chip); return ret; From patchwork Thu Aug 29 06:48:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jianzheng X-Patchwork-Id: 13782645 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 E4EFCC7EE2C for ; Thu, 29 Aug 2024 06:50: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: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=jzQ8NcFNTrNHokkGkI1JW3pZUHqP5+ZNDRLysl8XwR4=; b=0LqYvdzzVnCdh5FK2Z3Qol3uur +DhZPbVLclPOS1Mg1G3HGCAm138AM6z3bWCiQXmC2nUOi8LUmqkfKQh71SiWmWMiWenCsbGUe2XJP 9CEA5rJXqgbhax1OA4by+bJtfj+WYsPdBrF1tM3TvyKcE4ag1mduqY/KOBzOdjb37Ir2sezvyfPIc DLNP3o3ghczB/ZxhrN+mxvKTRhzo1A+m8IY1jqIIYezQq36sLMce5xxtNpAlEqfaRin2j8rEeTUO3 OGrwg/vnw8+aqq0jUdyg/2+nfAw2dvUce5hFgGu+5aMgt0Sn1kVmhWrlo5njyLC6SGeCPJ4TsTiRJ y0kHU/1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYyn-00000000qST-0dzx; Thu, 29 Aug 2024 06:50:01 +0000 Received: from mail-sgaapc01on2060c.outbound.protection.outlook.com ([2a01:111:f400:feab::60c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYxg-00000000qBG-307o for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:48:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cawSLVcrKRu7ev0bDZ6wl57cxauMV2zoLSROmT05RElrfYfeosbydWYdoybeCrNtv63Em0OtTi4bYD1bKUEmsxLhRgd9xPK8jxMSjdquLGAUEudoadopTo0lCua3yp16lmd66FXWlLOoxBAR+1FbCaeuBRAE71nErP5CKAGvM480wqdCZhhtgRn+hV7UiwfJBnqVoe8PuJjkLvBsTyZW74a2RNOsaCtVr6Lnx+CSB1KUb3QUPfIxkRCDQssJSBNmJHOwI+aDxFzsexSgMEunVj//h/+u8N+0hRNjCQJL6f/kgkUn+xm4tpLgGTfOYUd4yfAn39YU1dA7Eoum5hsqCg== 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=jzQ8NcFNTrNHokkGkI1JW3pZUHqP5+ZNDRLysl8XwR4=; b=gn9XNRu6dNkUEsG3l8WTVAV47x/4YcrjnquZMHW6wlhWD1nWSzLIoh62QYDx30GDaCLsE5rCMaJIVqMvdm9rVcJDDQQCkplIcz61AVF9batjpO1MU7E7/R4MDuHaf6neDCYC4v2WeZe2b20yUq2dr99yDPcZnVSpxeRQ4LI9Y1cx8Ztala2auxuFGMmj8ggtFyZM4w5/ieukVRPy1Jpt/7KV2G2lswulDbSCjs5gAfH3lUi5pzzgYcBxdAoDQoEHNPW/eyZYaA3U3IXQXRnir+g5k8CF7CPPEoyvgETrdXifvxN+cseCWfi2EG2l2TVoSKzLTUprmp2PFZjP4oq3tA== 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=jzQ8NcFNTrNHokkGkI1JW3pZUHqP5+ZNDRLysl8XwR4=; b=T/XSYSJe+Be8LduBgmkTO9Oj1P7CV84JeDd7Ba8saGIQQX50WWsGko2ar4HmPwEtB6oGxRX5wjhGaLEKEl7DS/UK44cTFb2aDpRwibHyZwJgI7k8rFVOP0e/lNLjXa9AbwAvxiF0EBdunBKuSJ73b0U/PVoDu1DJWIvZCnsUbRmFFnJVtcZ+Ae1yULuv4fuLylO304fKymNsrk3axVbG2dONx++tmqcV+o4IknhFee71wSmTcrbdIgfbRCCQIBN9p6fyWUvfjySXDGc2VuTuqbUKJfwMfe1BsKEG9vsgsuj4l/Y6pyK6OzfQkR4IF+HXwKrY+Ga5wMtUwYS3fdRuEg== 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:48:37 +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:48:37 +0000 From: Wang Jianzheng To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Linus Walleij , Jason Cooper , 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 2/5] pinctrl: mvebu: Fix devinit_dove_pinctrl_probe function Date: Thu, 29 Aug 2024 14:48:23 +0800 Message-Id: <20240829064823.19808-1-wangjianzheng@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR06CA0237.apcprd06.prod.outlook.com (2603:1096:4:ac::21) 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: 3456e627-0282-4363-a47d-08dcc7f69c22 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: 56WJ1+pLKOI2aDbmer1F+625RG3Yv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Gi70Z9ORJOu6A5U5eeYA74Gza44j2XgIXWatB6bAqsEhJ5fPO3NiXdLIONnVTCucT5a01cvVyy61cI1ZOBJbLwKnvt5iphPLOKAqHOSsBDh38gGX+sULjzBAX/UmcoCURL6UuBWsaEjLLSvxjiIv+D+kPusekmcriG+XA7CrZIYgCtuNBFhHf4seJkqXd7aMUZ9+ukUDtWLZwQL3s0yhkPK5kyMQvvuGJUDjSdUsGDjsZ72LOgQJhOgrKosbp0MAM1CO9eTtRrTtvm8QlH3/XApOiM7tV7BPsiJ9j/zZ9eF9teJcqzq0TJFboXOiittpSYq9SX0= X-Forefront-Antispam-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: UtEGfo10kdZl9YTSu0DZjoyO9hpA74R0CijESRS7Wh6dGRqI5uux/sINJcT9aTP6LVX3p9ggnGTzbV9kj1AWc6QSXswjxxfAv6OTg1LSsjKGgqvY4coSslqd+dTDL0GqCWEkO7W/erh56kUriOff2N72VMBTHfS21hIQ/8aQjW0E0houxsM+E3Np05QL9sDK9Ixnu1eUdocRPJRDhvkOiSEmYEjqBrE6XbeYKHDJQgZbfmnYQLYl4o8SA6Vbp0p4jxuSWFI0QPXd5mEdzcqZGk5oUpOmdfI2dLfdhG/A4lIqNgMuBTj6NPV3jrVxc9tZT/MACGGav2V4wTOw/QLZrm8xqujyuGFhMIqVaHZ001NS6BGv/lt1KhdDZUuE2oNEcAaJocz7bBn1Fuj6nrbHvCBK/+t7Vz+l6Gb8HkoIM5SoWCPSbvJFhH1NK+sRYjHIVk3Q29DWtjWGYONzHyNokLpYqJByQOU3WorOPJoU878qw516aSvOBz3r39OIDPhoZLJS8P30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u X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3456e627-0282-4363-a47d-08dcc7f69c22 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:48:37.6554 (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: ET8ynPCwQeUO0VRZte9Y5xWNiUK9yP13lri9E5dYtvdx76SjmiR0UF2SuoSryoRuvxYqXL/0QizNP+XVC04e+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6822 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_234852_782249_18C91C77 X-CRM114-Status: GOOD ( 13.79 ) 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 When an eroor occurs during the execution of the function __devinit_dove_pinctrl_probe, the clk is not properly disabled. Fix this by calling clk_disable_unprepare before return. Fixes: ba607b6238a1 ("pinctrl: mvebu: make pdma clock on dove mandatory") Signed-off-by: Wang Jianzheng --- drivers/pinctrl/mvebu/pinctrl-dove.c | 42 +++++++++++++++++++--------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 1947da73e512..dce601d99372 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; + int i, ret; pdev->dev.platform_data = (void *)device_get_match_data(&pdev->dev); @@ -783,13 +783,17 @@ static int dove_pinctrl_probe(struct platform_device *pdev) clk_prepare_enable(clk); base = devm_platform_get_and_ioremap_resource(pdev, 0, &mpp_res); - if (IS_ERR(base)) - return PTR_ERR(base); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + goto err_probe; + } mpp_data = devm_kcalloc(&pdev->dev, dove_pinctrl_info.ncontrols, sizeof(*mpp_data), GFP_KERNEL); - if (!mpp_data) - return -ENOMEM; + if (!mpp_data) { + ret = -ENOMEM; + goto err_probe; + } dove_pinctrl_info.control_data = mpp_data; for (i = 0; i < ARRAY_SIZE(dove_mpp_controls); i++) @@ -808,8 +812,10 @@ static int dove_pinctrl_probe(struct platform_device *pdev) } mpp4_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(mpp4_base)) - return PTR_ERR(mpp4_base); + if (IS_ERR(mpp4_base)) { + ret = PTR_ERR(mpp4_base); + goto err_probe; + } res = platform_get_resource(pdev, IORESOURCE_MEM, 2); if (!res) { @@ -820,8 +826,10 @@ static int dove_pinctrl_probe(struct platform_device *pdev) } pmu_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(pmu_base)) - return PTR_ERR(pmu_base); + if (IS_ERR(pmu_base)) { + ret = PTR_ERR(pmu_base); + goto err_probe; + } gconfmap = syscon_regmap_lookup_by_compatible("marvell,dove-global-config"); if (IS_ERR(gconfmap)) { @@ -831,12 +839,17 @@ 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)) - return PTR_ERR(gc_base); + if (IS_ERR(gc_base)) { + ret = PTR_ERR(gc_base); + goto err_probe; + } + gconfmap = devm_regmap_init_mmio(&pdev->dev, gc_base, &gc_regmap_config); - if (IS_ERR(gconfmap)) - return PTR_ERR(gconfmap); + if (IS_ERR(gconfmap)) { + ret = PTR_ERR(gconfmap); + goto err_probe; + } } /* Warn on any missing DT resource */ @@ -844,6 +857,9 @@ 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 = { 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/z9Cxe2e7VTCEawACtIiLKlB4EKc3Geo5V3MhKVj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vuh2D6Ynx2N8lWaEX0GsfLNNHVmJgG5hiuxqgtQ6goQLipenzuKppIuyjoQEdd/QeHxp1bAm1lbDVTdvmBn4qA1XLXO8asa1tv4ca9OuMxVT/Dnd57+NSsf5RtXFXMA0/Tq41RERtR1y2eBSMLiFO/fgxXT2hDo08ZLy/9+TdWGVw1HPNk2YiYFpIWtxYQCqDQGA9k+TjDFdSYEqjBHCIaMVyxAvAuhDBvyVH4pzj5KzjesppdhOi+H6Nyq+2vRCw+a0yiaj85p+MvFWb9Ac+UM+ukAaj89HlW5p8tFPNZ9oLo= X-Forefront-Antispam-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 = {