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: 824459 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2061.outbound.protection.outlook.com [40.107.117.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AF6A15C13B; Thu, 29 Aug 2024 06:48:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914084; cv=fail; b=lJ1MkYCkd2shCsZ+M2PGeEZjnjtJXUlO/aMbt6KskDxwtaZNXoXdc3HvwixMBwc4CfmWaDJRBj5QBGsXiooIGoVrZgBgu9uOFLBbrkF5QCGuzlCE5XLYBkCiTKEWqZKPxMKFJ/87iO/kZ4lJzbSS2HDO02+HYk1l0y+zpAtPDHw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914084; c=relaxed/simple; bh=vDKpHv88WWa/JKUBSCbeCuP8tvkgE7NjET2v7nwN4Os=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=RMTnN84eUL+2uQNIT9I6Mw8+TfS6yvCjt6EVQawDxuqpvCZha4U3oMMhwX/07tvdotmbSIZfc6/p3T1a4xs+DzZU3SJ9ONpFN1HvxgWR0HXv3ES9muEz7rY5sCc6Gvwbo3KExAJljtiJO5D2WJTdLL2kHBxc8+ovJSupLnLVGkA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=bLlypdfW; arc=fail smtp.client-ip=40.107.117.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="bLlypdfW" 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) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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+j1xfFxOXXm0YZSsEjtxVMjY5OGLdyqlA9uH6Ku1AC9hdmZMQKXHk5ZoQ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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 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: 823663 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2051.outbound.protection.outlook.com [40.107.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85C2A16BE3C; Thu, 29 Aug 2024 06:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914128; cv=fail; b=Tz7vhQOCQ9rGmmGJRzzM260XSD1pxU9NlF7ahilH7m6aFHxJypmZioyCtF0blPkZxGfU+gZ+VF/9GuyM88mZIiVVdHBqKJuTsjuoss40VVc69RL5FnIXC3pI2Qd75+9gjXVPVkm5IIDyCx71g57Hg87kiXz4YtdCw0wLSvV4KVw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914128; c=relaxed/simple; bh=W6S+d9LZaSyD3IH8EyPw7dH66MXf2OvUVf6736qPtbk=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=qoj3VpXZX9swZXqzgwE+v9Clwpv3M1Rp2NHlc+gkI8fRJH+XU9UgYW/oM+17nxnS1krNlTJl+ETEPRKaASpTjn1e03aeIKfItT9KlQ7N/pB6TdpshcFp5L2H5AqAknh/LzGTDuj2ar6CIV4vPiOhBVRSgY2hF9WY+8yvdb92MrA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=T/XSYSJe; arc=fail smtp.client-ip=40.107.215.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="T/XSYSJe" 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) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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+625RG3YvMg37TSBxA/OvxNEcXW2eJPZFhSpbI7jLQzGEQLXWekCKiQd2j8taHOmoud3g1aa26Vh74Rh3BPESewi83KYHsd2/lxNgvlV1asIcJGrlGmBrYwWXVxBgQ5jQbotbFLuRC9HckxtSFBBScDwlNPXNMPGn6burmCPbmLm0VcpFnrS1z2EmaplXlDh8moFXVS3eawXC46gUPgKrdXpWzQcMPwNo28EOv1sv0kGebmYkbJB6IVO6MBTSJYEI9YTSNpdWAG4Zxt3XU/8VmpDzIt08NZDWu+v2feSnGxi1EXOIejM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9j/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+VI3C3ctF7qZbqEKD2LcCamundqzdv10lyp/jcKUWBWxs7eapLZw8ePKchwevZj3/QBVqlHNd0niNP3mr33rBCI8+It3PWsV9FJWAEJrIPNno6iLy/EBS/d6Y2g3GSTj3qIvEmewyb0q+vBy2klQpHwf8DTCrgoTueVnuMwPkVf9ppOk5eyFRVcQUK6jPpv5257xdVr5y+o8Nh4Dkg4ACQSZ5UrwopmEJUapjkkoMLP83hXr5me8lGLGjHFLG8ykyrLWC1fp5UleNF7kA670wmo0WCdCi34IaFW3/qtGKrWNEgyN6c/MIlzgAs5ov/+K+IHd9IE+GJXqTB7yoPLPFRwcS5YhqPRzQzR4MmuhDQsEc8OuX1g30F/NlVhK8MQIa6RC0ER8Tsvhf7rKBSXTFqVulWxuW3m2sqrFsKgofvMn8644Lx3f+541CrVhk8hDtBf+Np93m5cStIvywK1UoASJTj/mWehn6Nef8AS3t4BbWTua6Fk9NsRth2RlJamk2Blf7/1Gw5ArzfupMakZtXke9Dv7U3Wtl3rhFpntTiMk/haR9ceidhYRz6YPYa3/b7AJ/gxpRYbVVFJe/lHMiYNtu/rOoj2wah+IT7N39ACroV7PvPhMqlymoWpbQ95Gt2yqYULb2be+yJgpu0/kkr6sBD7iB29pi6c8+Hz0rbCRIXhFGSiEnFSOAWTVJvh/io59vB2zeYqC+gO0xgQg1LcxIiceX9d8V9LkCay6ARE/dioOcZA2xyyX3+U8XNlR3iKRB/BvLZ1IIGy8VXqsFaqPmH6WYglDz8cY7Ilpv2tumJvIJxRcD0GluKR6CV2H1BWUyxx4ZDn5idxKq7cVvOsFQ+uom54hec3nJIvM3Kp5SghG3DUGH0qmyHoIlm/OiP93FBvVmkKi2FQlESfSd0fWh6WAxKcPAK8f1FCeFI/ueA90XI7f10aKCLyw5reXX93kuzfs77V2I+jvHsHlAR31AfEH8nF9Uub0Jp8bcgR8RsLEwMXKoEt0xvp0NN2pxQPX/sNrQmPQV6l9/FUdSEAVXGcVEWtB7KSyR6RIQZeYFaCr5LS26v1u 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 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: 824458 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2077.outbound.protection.outlook.com [40.107.117.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80ECD145FE5; Thu, 29 Aug 2024 06:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914158; cv=fail; b=p9O0O0od26SewkE/TimimarhOr9T/+EWkRhXK2IbF0npA45Pn9R7Y6vSRUpIBtTbYTVaNHiJfUDwQE57q2IZkJR5Bj6IKJF1pjuyUBmU6b/MN+CdFcPREBBKmN2e94C/pE76Bjt/AnJVh8CEWp0xWOegI85PEDgLfJaZxZMst4E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914158; c=relaxed/simple; bh=7623bXi+BHVhuonlzNuDXUD2v0Eyym5D+2hAJPbs/58=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=Xql1bwDc8Xda36gA1A8krqh+fMBMJNU3rjTJhn1Wr0FDULOqguTN1uU40BOQmckEZ49dLbXV33xHmLcGnCJ4gRNRJEluvD0hvYN2zgT2RjUzG7iX6eio+x8z6/+DkMd0XYGPe6ZXsjA4BvBIo8I6BB26IZ7pPapLYz5a+5StMU0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=pQjYlZ/d; arc=fail smtp.client-ip=40.107.117.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="pQjYlZ/d" 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) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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+YrhmmZMg1RbaaVNLHNocFTgZdXEMFbkoVTSsj7ka9vkUUNxLKyqpTrRRNl3IvVFh/y/p4CKnBlTW5Jko4oWxgQhyngP+t5wVaR+C1R+8p2I+5umcitxmYmRJqKXPUOqQEJtgU9KTYyWG0AW4ojzSm8lVH/35V3eR3nhuOeyUcaI/r/M3CUwxZYMOYIeBZ9VdhHwdWwmcz+QmV8GTEE2N+Ottj9p8llq8ZHKtK71OwFtgEOhd8yUanH9Q8Y6b9O/+lj1ug7ElhBi7K98B+oZqp1EDbNbQ1MgBYt0OATpdImsNbwBhTcWEcAPkiC/Zy3QJLws2zUKqfb2jHNbHPs+Xrx50iBz5mxGFizmxnmiLlrDYOrKjeMc63NVLbdDMw/celk7y5divmB/Z0XAMJdSMDm/Xszunv8RBp7TcAFc8sRP34EzoiEBMTo3FJiQzQQCMhY/+Qq5x+cjwPMgN0g/RezizxinauuOA16T9rzxWVj83J42aUNp4PBA97XjKeer2AAD9ArURhjO2ZX9Abp0LuZ0XDc13sEtgjfFqRj/arJLxl5sya+rTrH2fgRU4pVu+6adiY0lOEaCwMaEgPfjmkCuYRGKgdt0ay6AItK55eTgre8FO2FxQlc67mzP2DXe7iJRq5UJznTrxTxReHnUw+gto2GQE3YOYu3vMyYkBGQGHhb2h/hI/XaMLk+BrQG223Z7Y4XUgWvKUVskuZOwqEnoVN5kPHHGJAHH/6gworJUV0oID2OhGNQLpeL+JjIzWLiKy2IvQNbiUhvhHgcWD8Z1vuh2D6Ynx2N8lWaEX0GsfLNNHVmJgG5hiuxqgtQ6goQLipenzuKppIuyjoQEdd/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+vf2leO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5o3dFphJ40P3S9bGClbfoGwh22dZTmykqbDNTOv5tOp8wzSmdPIz2zWWct97DqWpNP6FhgWU6JLKl0EwdLUI3s4J84AlLbxKUglKic2iTq5DCcCXNY6aCzMQflQmwaFQuLQS7vRcKURx2UYC4FK6BOrM8gdyBXYubljQ9DR/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 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 = { From patchwork Thu Aug 29 06:49:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jianzheng X-Patchwork-Id: 823662 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2077.outbound.protection.outlook.com [40.107.215.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BA5415AD9B; Thu, 29 Aug 2024 06:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914198; cv=fail; b=gfv19XhydnwyF+cQU3bjg8zwEP1pObY+wXyXOWeYCz9C+tS1JlE35tXG88qiAY4kCEYAq6J+BHUxJfXCNoT0BQijm3W6FO94AjKn73rq/iynna0zCx8ToJX18HVGOKCZzrnbdY5KLCxjdWToMZb0uAeoPDLU9Eq10gnw0sBD34c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914198; c=relaxed/simple; bh=I9Qy9u+CEvhEOLgLDJAatowLcxt5ow2wKmqXUUFu8DE=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=H5kSWEOMVgM1y11T39vEze+kROFAN+jAhSY5KXMXNfnyPqvgk10Zv+k58ZpEwfcx5cm12val/gklN5Rsp0i+eFVpC0tB2onDCYEhAVzFvuy75mVQz4/VBJKdcraetTINAqrlu8i6CyHFQiFl9P6G//medAcu8Ogl/RTelxcZrI8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=TLyovVo0; arc=fail smtp.client-ip=40.107.215.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="TLyovVo0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Px6ArrXrS0xViRr8xBI3A58wRHQFE5pHLINCUE8m++UDvEx7KIzQ+lVNVoNek9xGN33KDrQNEXyhRpkdm7vG8KHjxep3rsPtJxnixHFrncUvB24fLwK1mD2BmbFDNQz/SL+bQ2Qjoe7zS6QVO++LfGWEr54scKmb7SC+mpiUBAZK+rs2AmxoIPF+cyVbR9V6KXIFje2IikiQ3zAbkWICULuY19nK/MlTjaup8l7E4/5XObr0+BzPBdvwhAUXVSDLbzWcHh3FPwIMhP+JoaaYPVjc39jSrY7biDdvCw7uvgB1LXArtN582SqzMJBKCX8J5gP0rIe6WZBAYwJV1Fkjew== 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=7ERW67835KJU82Kiry6wBE9lAwUEgX1142JZ2NSdtbE=; b=DnPsEFDut7MffD93l25/3Bn8Z3XjaBiHVQjSubrm7ec/NPpWA/cjRRl8v2dgRkwUX39pahc99klVuw7H23ay0V6DrAiSZ+uWNIi9DbWqmg0lnov/XNZZi8YI+FJdvSNdwjWkW580Xy6HYVVQU9n2fuawPh8Gd5yH4ZpueKkW2HHsmqptDqvKugqu3FZoGDB3KEJMGsg7RKedsIPMP6RS7XDcrYoZ07POqpLXb8lYsyPUTBf1moDC9S9zWHVOw6uWyld/pk34N68mMlGUxg0JKCjnt0IJ/LZHxvpl56YERlxYyKqUotD59eoHTuR9nqwNOQiY4/5Go0Ad3u28A8D8VQ== 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=7ERW67835KJU82Kiry6wBE9lAwUEgX1142JZ2NSdtbE=; b=TLyovVo0ZMTewBlsJ4Lh8T7opJ9xbj7eweVQkE/aaWIHvkOAZjyjxfWS2GRH6+nVP9T2PA9kE5wotK0H5CRjA/8kiEm6aJrsnuI+I5gdOOENn1y1jkUR3N+0+qxZLNjbXXwVcoSKyoadiy5NX2MCDqXHHLFs/nTgw3qkiq6fKQNAtgDFvHyKFMfdOUlWERMO8yBQxeWLmtIVJBBCKOfL1iQPdpPUgBtzO65RKFZfnmrrs/D50g1pa4DgiLic+CRqexBKb8/mzJ0F2swzj46509re+isEOunsRLPXAOORmtrZ5Ba26sDx0Q7Rofth5tXqxfL9Tv127MZ8h9slo0TMyA== 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:53 +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:53 +0000 From: Wang Jianzheng To: Damien Le Moal , Linus Walleij , linux-riscv@lists.infradead.org (open list:CANAAN/KENDRYTE K210 SOC FPIOA DRIVER), linux-gpio@vger.kernel.org (open list:CANAAN/KENDRYTE K210 SOC FPIOA DRIVER), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, wangjianzheng@vivo.com Subject: [PATCH 4/5] pinctrl: k210: Use devm_clk_get_enabled() helpers Date: Thu, 29 Aug 2024 14:49:38 +0800 Message-Id: <20240829064938.20114-1-wangjianzheng@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0310.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38b::7) To KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4211:EE_|SEYPR06MB6822:EE_ X-MS-Office365-Filtering-Correlation-Id: aeb346c0-f52e-4f7c-ab51-08dcc7f6c91d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: h4y7tzYiSVtysS00k+r8cKh5ZHqDRZlAlOAqiYgYa2sbQwlgpe6Qp2/tMY7na4hgtYlvo0DONCjxe61+aZj0gb7sumkWn7rDbYvuYVCqEDaLNigtBNkxw3OBRIOITL/LrjnwdjsJAebsqybzu/xtuAKEoo1VHE8BfhJZMychxaHqg59m4ZeuQm7zm7dk9JLyGWApkWBV+k0n9NglYt9nr2aTctu/R0x8pqrEiff233BE78uhBT/iDzi4X7pqZE8W6MzCJk35ElIWqCqc0u9l1kZOsoogdW11wZaix12+6K75Tk/mGY746KN6qrlVyIK8yDropw0sLHBAbEbg2AYYvlHj0hVz9ZMV0eudL+Q6JOknwEXFkrpUafAM+MaBSsFrbsezyl1Q7Gcjld1jwSt93c+C5323wJWcbFEe5bdC95KPZ0+DA8b0iMXez1H9i31+SD/56wdZb/4vwPAXMVMuaJbpVvReobIbVtav/FNt5Xa2XUYygfvfOaW8UpuN91P7i70h31HiLyERZXk39iB2kyWEZ3TY9EWbVV0rOvBElXkK4JY3lH+PHkkTqwAJBeSAp2Q7T2ejRnZzKEpsjFaETSILA0ub8prknMK3IiXum4/oDqkoiH3cogB+RoEx13zknLRN207FRPJrtNiGlbWxpR210BXNSWOo3lci2iBs+8ZSL67+Wmeo4r2Vay2RDDLScx5X/aQyGh5FWJgbcXXQwQNMhoeKxCG42CQzXmE0/6L1CvpmSQpkxCQgKfHlCHUTgNDT8v7KgHxslLvjS5wVuEitrbcvtDn2uPFn8f0XBE/Ca9yRkQdqfm7AmooMBDl5Gkle7hrRkwSgUyfb1TIcw7xvEUvm/MNN6bwCWSpDUFQdE+f794xK923ujJ/qyySY0sYDOSUX0K9ywXHfwgCaioKaVckxJSd/SAqqZYLICDdnBtncdD3Nsj82T85T+Ms68GGXyX+l9F5uThaTHVmAd/mjvTRdMJKl3dTOM5wB/FlvrkdDJ+KOyAMqQX84r+0NTZ0MSQ0LOwUdqsTcoPpr8H2H2/Lr5hqyN7vG4tjqAZ2ymXKXaonakYU9V7I7Rbq9ejX+w0tIV1qz6e5VuPd5CKrwetGinWWB/yraP5+f3tnRIn3Uu+oAT6bqQ9ovziuLmrJq+/pDNlIndkknggYbWLfEsC3rQcG3QY6/VEb3SFmbokS+M1PVjlQRoxN3UpXFruKFl8Gm860KFw+YZroQoWOlXgtnlRI3XVsrFdS5QNHpHMrlkNMxHhiZfsIlJJBUtYPBu4KJ4XJWrUDqvaRqxePrcvBoZrp4lgjSrGYue1plGcmODLR6/D+8OaYaV44qfx7RHo5JT3TZ+169vcMS7k1nSotQLEiDjEENyOS+RmanqtgYhBRwHKIB3sXkRb5PHq95iO6nCqUND6uGRSHxTQ== 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)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6j9YJUGdlom/69klZPow2FuqvdOCG+RROvjQTR5P596xGomcJNJkDszptr+z3Ks2twCZY61mSK28yb49KbAAHsEyaBNMnkOxp8e2I0CZMgnf98DlrjXJKhJ+/GGGXKfxi0bW2jsvgO8GHTN/6dszyUREDl18q2Jk/5aV6lJjJrbefakLdx1qPTvFt+05UkDrerlzFDp4J1t6hs48kltdPcJBzesE9E47hizOtSlfVpNyjs8SJCbsYTJXiChLWKqTQ1d4NOu6eAQxJYXTAWmCQP4ypIFCQskF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J823rL6WXi9EmAYgXbziXp80buYmwZiIP7KrdwvbPeQbl7sLngrI922fuk+Z+KbqWD6DZH8vlq3njBsDNI2XI8o9OPYiM1ByO+Q+LOBBa062cPJDIGQRFMNckSYdBQ9TYHg6bOTTiLiDpbbhywWNewpnXhAnOh/3taouUVJmqbvfZ/XuN/5hlNF0ev50O0bvx/DINx5dEGQc98CE3cG/vUviuAlmS1QM1bhJoMnu X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: aeb346c0-f52e-4f7c-ab51-08dcc7f6c91d 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:53.1315 (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: gYNaXTFOuGb9rTOzww2H0qAjirbKru9o6NiCc+67Mi5GBafa3fcnIAs9mcTxJbT4nT/R/afKcq23TqjL6y6E4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6822 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 Reviewed-by: Damien Le Moal --- drivers/pinctrl/pinctrl-k210.c | 35 ++++++++-------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c index a898e40451fe..0f6b55fec31d 100644 --- a/drivers/pinctrl/pinctrl-k210.c +++ b/drivers/pinctrl/pinctrl-k210.c @@ -925,7 +925,6 @@ static int k210_fpioa_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct k210_fpioa_data *pdata; - int ret; dev_info(dev, "K210 FPIOA pin controller\n"); @@ -940,46 +939,28 @@ static int k210_fpioa_probe(struct platform_device *pdev) if (IS_ERR(pdata->fpioa)) return PTR_ERR(pdata->fpioa); - pdata->clk = devm_clk_get(dev, "ref"); + pdata->clk = devm_clk_get_enabled(dev, "ref"); if (IS_ERR(pdata->clk)) return PTR_ERR(pdata->clk); - ret = clk_prepare_enable(pdata->clk); - if (ret) - return ret; - - pdata->pclk = devm_clk_get_optional(dev, "pclk"); - if (!IS_ERR(pdata->pclk)) { - ret = clk_prepare_enable(pdata->pclk); - if (ret) - goto disable_clk; - } + pdata->pclk = devm_clk_get_optional_enabled(dev, "pclk"); + if (IS_ERR(pdata->pclk)) + return PTR_ERR(pdata->pclk); pdata->sysctl_map = syscon_regmap_lookup_by_phandle_args(np, "canaan,k210-sysctl-power", 1, &pdata->power_offset); - if (IS_ERR(pdata->sysctl_map)) { - ret = PTR_ERR(pdata->sysctl_map); - goto disable_pclk; - } + if (IS_ERR(pdata->sysctl_map)) + return PTR_ERR(pdata->sysctl_map); k210_fpioa_init_ties(pdata); pdata->pctl = pinctrl_register(&k210_pinctrl_desc, dev, (void *)pdata); - if (IS_ERR(pdata->pctl)) { - ret = PTR_ERR(pdata->pctl); - goto disable_pclk; - } + if (IS_ERR(pdata->pctl)) + return PTR_ERR(pdata->pctl); return 0; - -disable_pclk: - clk_disable_unprepare(pdata->pclk); -disable_clk: - clk_disable_unprepare(pdata->clk); - - return ret; } static const struct of_device_id k210_fpioa_dt_ids[] = { From patchwork Thu Aug 29 06:50:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jianzheng X-Patchwork-Id: 824457 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2047.outbound.protection.outlook.com [40.107.117.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41F8415DBC1; Thu, 29 Aug 2024 06:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914236; cv=fail; b=NuE0BU3f/Pp/8Jzd6dbmhwF69XgNRQF4MD+9G2wlL+ZOzltNEvrnd4SeDGqzkvwvl+gCpxWNhD4hBAFOPadGI4DyLpIeo7hKk+9Kk8zoa0h8NANscrk8OQiLQz5nmuYtLrxsFJ2rwvwNm7Vncbsfdqw5OCHRbn80YUNkl4if1SQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724914236; c=relaxed/simple; bh=1yagkEzQYkz2DFs/OW/ibHujPyLn9Y3vlRgDdUMEFmE=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=V6BOKsuRSDTaFBYNQTkpj4B+7T/rVu6pRjpzP/6vYVbCjG7uwp7GPyWe4ey0wU08LBoD83cY+jyJx6ZfWeaFJ9O7+IedvpWXmI2wG+r0l1cHxKVxoHNBheA0DDgmxrPiVe9ZBz9OzyHRRq4G4dtmPixzyj8ytaCNZCMe6eTG1dg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=JwjPwu8e; arc=fail smtp.client-ip=40.107.117.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="JwjPwu8e" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X80ZdhkdRRljyg43zIRhB9NpA1UbeufDToZqTpFl2aTG7auG7bWu+rzJALny2ol4l4apcwwtyVdHTUtrOtMScFMGA7EdHZBgOE8Q1IJ5aJtklLj/D9JHSDDFmW1NYY3CJn60S9oJcCFFve9PNQbfqY38FAd8zJiP8du2Cl9ewV1IQJ7dTOGn0477HzZrGjowRgL0s3WUnfltHRl4OLMQeJzFtb9rhbAY3cuO7vtOln1QQWGVYII6/Nj8NcUVHh6LLH3ivMLoA9pgQKOejCITns8zDFBhVya30Egsp84B3UFAFWMqciV1b5shly7L3F574B+wpLNXF5mJ6YQ2m/lWQQ== 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=4TpyFjnQw/ov6d0N6SzkMqv5UL92OEkGLab5JYV92f0=; b=YkGZEzzzNGPCUPy485IgK+3Fy/H/HyQc58ajI0blUZwGuY3EJZlPCoj+nmNezXTWbfkY7VMb/rJ2mdXnSPEOvfHAwLmtdOjueWflxAYweTEcYAmUGHPJfD1fBOEE73RKeZ6p1w6m3XPQMMZ9bfE1Xu5ALVgPYYPMicHX/esDL4eHwLzHCFWpEAfDDWAKj2OA2l0CUAetRu9L3nqbEG5T5Gy2rFaqOU+ArZBGXxcuWphRN8JxjeHqq5TN50BLCM1nzpFfcxpK7zaHWg/e+FYHAcaoCTMmGh7GO5tAfkLHutIxlje85fp34UNymRLdDi+U5VI42nT4vKZeHr/tGAc7bw== 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=4TpyFjnQw/ov6d0N6SzkMqv5UL92OEkGLab5JYV92f0=; b=JwjPwu8e+oYgc/VDUqqgPy2xgKIa73TVVKj/xQhx0xFwLX8cs3a12jewnRaLxEnFyfB3/I0A2jy9SuR0g3GfQ3v2GhKwMF3XLOF71S5vbfVrqmsYFchrfzm7cy6kqjaoD9bzmn39BS5v6k9JvDl5Lm9bW5TkNx2oJA2Kh76DyL0LLqf7IY70HikLsdSkg8zX8sxQNJnim81nref3O6LF2q4OCh0OPKKXziKmNtnI4ENESrgUPyy1rPzQm/tibYQnpsdBEPph2XBFcvcM1ITCRSuBPMbyAbrzn3XlFl4Zl4Cg64xMsSx9fZBSh8X3UKzl93WPmCeho1l+yzznRO8p2w== 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:50:31 +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:50:31 +0000 From: Wang Jianzheng To: Geert Uytterhoeven , Linus Walleij , linux-renesas-soc@vger.kernel.org (open list:PIN CONTROLLER - RENESAS), 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 5/5] pinctrl: renesas: Use devm_clk_get_enabled() helpers Date: Thu, 29 Aug 2024 14:50:17 +0800 Message-Id: <20240829065018.36863-1-wangjianzheng@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP301CA0077.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::19) To KL1PR0601MB4211.apcprd06.prod.outlook.com (2603:1096:820:23::14) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4211:EE_|SEYPR06MB6822:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a1cf53d-ecfb-4edc-d264-08dcc7f6e00d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: P/8SS+P2G783QD3mI7Com7MTUfAL4SQnP3kWRVZi3+psM0+AqzgmqDTG//pi62wIppTt+Q32YHC57Nr/B2i8rECEg0PUeHRuap0xCChqhGVMfKuySXRSqVIV16s10C8Pyj9y+pqJNv/Cri+nrXIvfUnqP70jA9xjEWdLMyWoHkBm35JZ1KDjBQaUB3Ay6go7xCWpWTDKAlvPLA7X1qugYaQuzAwXQeLV+Xl1QYdLBmSvY7W9JiIEr/9Za+xlAktnzWAcRSBkokQ8NstWZTImg/7w0eImTjGg+maoj42b3YD5T6k37keYdhEqMz7Ol/iS7ou2Qc5vt1IXOoWy+Siecr9CKXqyZCMbo1kpC2ExaIpK1gmZtEBfmk3mw3Klb3VpCBsi6DQOr2QhTLX07pkBVAsFZVIoODLnRWY4JWG9j5Iit1BMN5v0pn9nbrCZPVdRavX23qVA+bJZlrRcTQ96u7JzoybDnVVUWhPr/eyVUCCMwX9emsoFYaC5sS0gGYezC9MUIMANUmLMQGAFmLtI46ZiXUOGgDPEAz51pd3IXZMahtEXCdWgL2dl73OvuJjEB0hOBsSWwv1CGAXbA1K+ak3km8xG+FZok4yV03NsUA4TjQmenGrFTzGXfymVsRUmUTmBr8g7fxSCnFOs0cXbDqRyQ3BQclob95zRDDIHTvwsOfzEeQYv67Nd1yapirKWU8sIhWi9JCSb+ALW56B44LoG3y0vlIQGJLb3xrwtSzMVRBMTRExqzYbagoI1rt0bSdZjUI15ak57h7J5AjBz66zqKikA5PvilGKyHYWFT75Dx775F1NmTFTUtRTytqFp1DhQHsj1Rl0YK7vTfM7j2kaGYhQn3pGjSwFFmRdQXin+60cDXxZyNWSnSIHtuEGmaKf0Nhh92xaKD4ukV1SstcMh9LZK1VoKMiFgjRVNeaT7Np0mYj3gzYe1qN1t5s0j4r3Rvy2P3DoWUFLwHJ2M9aT/PQ9k4gE3YcuSmpY/XKH2ED/g4XGxgn97RZWvssb3RPrYKbunPeC7rLNqY1dHmMGffpATSQkn/neI/G6EW0ZLfqU2aFlEi5toqXKRePXZ4Mlg2WoaVDKKoLIcSpV7EyQl/255cOmE356xs9XLd7i3RQcJaYn4WRddutZtYr41a84ieXTxamkLMg2daxbSCZUwfKELBfU2Z8qzMsWY9fXpmjse+PLo01qgQPa3DSxamDP79tR5lz0DV+YxaUStpo5nv9Zuq6ReybtYa1tmm4D/Fwuk9ePHmFoqdbs3hUwmanQaCp7wcWnqxSIRqvYTbuAZ9SZTQOVgwEq2yNLiVqk8opSIRqY9m7NDFlInRNvua1W+3aMYmt/SaHUF0e/kJTeEY7qwfAuuJjP4vTAaCZDQg4nIsyHhO0Hpo6SE532UZge1vO0RtQUBsg3MHw3atg== 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)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ubHaj816oI7ciWTstmLSMiJNh1/vhehI0W8+fLSAQ/gzoEf2mVXx29uvPm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dAYwQLL41ygJCLiKOrBgL4AnJU0phPu5rGXDQEtr9Wt6bgNlFJRoaXtkJbmbcqGbO/Bdr5NZegpwN3E1afbtqBeBGc6A5baxzaYmRhMrvo+Xz8wNVDHL1/N8tTydF0/lQH0fCzMMasbKqo2wRaFAA25x77SPtKTVi8TlHdlOALBOvWvli0zon3+B/udRuGVxfbPAUWWZxAJos5isrBDifMDslS49af3Pm3d88/K2frYWWLpzaMB7DJwAzJhFh87YEq4BjZeBj+Rrkzu7lMpVvk98ctV99mF6wlclENK9yg9gMzzRk5aKTbhbmDVSM4Ddz9tN5cSq3r0VWxEAxX5bElHe2epiWJiwwO0xPAjH6mZ39MmWE4DLAZCbnupfPJHUNHOg/gWMwYg0c71K+7uIHL/oYRieznlDYbXAAb9WXCKD9YlslEtnQwyOW78kYB/2GedF9MKoWLb X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a1cf53d-ecfb-4edc-d264-08dcc7f6e00d 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:50:31.6766 (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: YisNLIhQwlXylABDjTLa72EG/D4VDA+r+nLTxkN5zKpbO/PQOt/apqEQGUVr0vyUqU24gpIourvrt7PhDNRJ7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6822 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/renesas/pinctrl-rzn1.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c index 39af1fe79c84..6a3616944b37 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c @@ -869,12 +869,9 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev) return PTR_ERR(ipctl->lev2); ipctl->lev2_protect_phys = (u32)res->start + 0x400; - ipctl->clk = devm_clk_get(&pdev->dev, NULL); + ipctl->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(ipctl->clk)) return PTR_ERR(ipctl->clk); - ret = clk_prepare_enable(ipctl->clk); - if (ret) - return ret; ipctl->dev = &pdev->dev; rzn1_pinctrl_desc.name = dev_name(&pdev->dev); @@ -884,7 +881,7 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev) ret = rzn1_pinctrl_probe_dt(pdev, ipctl); if (ret) { dev_err(&pdev->dev, "fail to probe dt properties\n"); - goto err_clk; + return ret; } platform_set_drvdata(pdev, ipctl); @@ -893,28 +890,16 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev) ipctl, &ipctl->pctl); if (ret) { dev_err(&pdev->dev, "could not register rzn1 pinctrl driver\n"); - goto err_clk; + return ret; } ret = pinctrl_enable(ipctl->pctl); if (ret) - goto err_clk; + return ret; dev_info(&pdev->dev, "probed\n"); return 0; - -err_clk: - clk_disable_unprepare(ipctl->clk); - - return ret; -} - -static void rzn1_pinctrl_remove(struct platform_device *pdev) -{ - struct rzn1_pinctrl *ipctl = platform_get_drvdata(pdev); - - clk_disable_unprepare(ipctl->clk); } static const struct of_device_id rzn1_pinctrl_match[] = { @@ -925,7 +910,6 @@ MODULE_DEVICE_TABLE(of, rzn1_pinctrl_match); static struct platform_driver rzn1_pinctrl_driver = { .probe = rzn1_pinctrl_probe, - .remove_new = rzn1_pinctrl_remove, .driver = { .name = "rzn1-pinctrl", .of_match_table = rzn1_pinctrl_match,