From patchwork Sat Dec 23 04:53:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10131389 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 440D46019D for ; Sat, 23 Dec 2017 04:54:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AC4F29CB7 for ; Sat, 23 Dec 2017 04:54:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C7BD29CD7; Sat, 23 Dec 2017 04:54:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4056E29CB7 for ; Sat, 23 Dec 2017 04:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756065AbdLWEyG (ORCPT ); Fri, 22 Dec 2017 23:54:06 -0500 Received: from mail-bl2nam02on0080.outbound.protection.outlook.com ([104.47.38.80]:57696 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752448AbdLWEyF (ORCPT ); Fri, 22 Dec 2017 23:54:05 -0500 Received: from BN6PR03CA0001.namprd03.prod.outlook.com (10.168.230.139) by BN3PR03MB2353.namprd03.prod.outlook.com (10.166.74.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Sat, 23 Dec 2017 04:54:03 +0000 Received: from BN1AFFO11FD027.protection.gbl (2a01:111:f400:7c10::162) by BN6PR03CA0001.outlook.office365.com (2603:10b6:404:23::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Sat, 23 Dec 2017 04:54:03 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD027.mail.protection.outlook.com (10.58.52.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Sat, 23 Dec 2017 04:53:47 +0000 Received: from b29396-OptiPlex-7040.ap.freescale.net (b29396-OptiPlex-7040.ap.freescale.net [10.192.242.1]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBN4rxYX012872; Fri, 22 Dec 2017 21:53:59 -0700 From: Dong Aisheng To: CC: , , , , , "Rafael J. Wysocki" , Anson Huang , Leonard Crestez Subject: [PATCH RESEND V2 1/1] cpufreq: imx6q: switch to Use clk_bulk_get to refine clk operations Date: Sat, 23 Dec 2017 12:53:52 +0800 Message-ID: <1514004832-373-1-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131584784278000587; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(39860400002)(396003)(346002)(376002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(68736007)(6916009)(36756003)(16586007)(6666003)(316002)(50466002)(4326008)(8656006)(54906003)(59450400001)(2906002)(51416003)(53936002)(39060400002)(48376002)(85426001)(498600001)(97736004)(86362001)(47776003)(105606002)(305945005)(356003)(2351001)(8936002)(106466001)(50226002)(5660300001)(77096006)(81156014)(81166006)(104016004)(8676002)(32563001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2353; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD027; 1:knMSeIyyyHFvVEuMM7euuAjnuIc2bTCtF6r85YL9q1wb3NfL4AaLx7P2Fr+bpPOyW4DrdNN3vmJhxM5AVJV6q2p3g8f1NrGNFlLehAmMJkDk7ylysFHbun6UUY2C8Xzx MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0818fc0-6cbb-4ecc-93cb-08d549c12733 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN3PR03MB2353; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 3:g/RQHNL0XE65KCwbkVSTvM/RnAW6eN4eQ6VF0HvRxvViySPGRLnPgPplE4R6XEoeIAY/3LCMP2jqThNUCsQ5cohTMd2xkn3RMOSUb4DVKu5Zsy4Da7VMLd5Z+45DIWVY8RHgKYYHv2cLMuTA5nnwuPEyipUGOjoYDxL2B5IBJySwSMzs977hMcVOhvxRkxhR2iDAxZcgpLpeVZxHl22ksbLeisdvNicjwoLTDqqOgP4l8TwEiDKvuPbQ8wqc5w2F4HFRJkXlMEwjEz2XyBpIKkmyuF51FNNm/5h1JzlFhMqC9RZ1hv9gSF41w+7nTYe/rUo4BYAo5iewFMLqu59IupoNEr5WtvJqrJ6L6vkvjw0=; 25:ved3WVsco5Djeye02Xe7YBtIuYH5aFzR2rF5SI7gxplyt8LfyzgM4b64+x3UbQbIoqtbCsZZf0BC7B5fmfiVz4I3nxTa062OU0NzpXKNyy2pXSoN8QmcpnB3gJ0S7ZBSNR1BX4Uf2Ifhikmw7cKTYD0PAUcVdwZSdRQ3c4c9eJlg9elwbEfeyfpWFtHRGGgin6I+xovgsi7T+8Ku/Bindgvs0FBvRGa0LIq+45jpmSSrMrGGS3l5ubguYzw2phy/cBca7utAaQsM4QoKn7RIo+no8LDYUHMH65+/j94sqB/X87W9755zlMjSjyd7I51p6AJf6GIfOdE/6r1beyYgBQ== X-MS-TrafficTypeDiagnostic: BN3PR03MB2353: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 31:+8FpAnbk9GrAvpjQhyc6ktC3VrpAyEnn3cG+hX70p3Cl4AN2YdfWNZVqpgmFVMSorltQwfTNdTEZOvLLR3rpItsZX2fd+zHTi+POMyZlUGWgDsBEI6ITiz8CAHVML0n9wv5KTbmKIT1FsnujYgCAj4b9YKhTsZW3v+gJaZ2a2Km04kPAN3amWoKj7YDNzX1zHe489BXXzolo+iwYQrpt1yp2yXFFHG2a4aA9jK2Gc2w=; 4:zv2W5nASw2Bu6PIlq2CH4tI6uIkfzefdWzGqLocF3axD6JbgLOoUQsB83meZjAsj8B7rTciXRhVawVTshU/1dhiXWbgDXXGYEzvy3RQatoNbb+KgW8AsLtY1ikEtuTWJ5B0fYcPR/eg6ZM75BBDD38oU8tpPbV5KIpzYakvy7ftqzucQveRz1C0GiLCZxmRumilUEEJ6rlzhRvVRjhSf95YV6qrLSL5SFfR4+gP81RpTSwNmo+svmbdHoNhNRYlt/Ip4GVFzvx1DMLI2BD5ITp09hUriTmM1tqKsigS3HrAJXLAPeINJORooIvliD4Hp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3231023)(944510053)(944921053)(946801053)(946901053)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123565025)(20161123559100)(20161123556025)(20161123561025)(20161123563025)(201708071742011); SRVR:BN3PR03MB2353; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN3PR03MB2353; X-Forefront-PRVS: 0530FCB552 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2353; 23:9Mzro/DRYKjxKRgKT0rKYONjvxgyznQjoxf5hbbij?= =?us-ascii?Q?ZGA91ycvKf+3VA1jrNRU90mg8HuJG+x9hXiBM7hZYV6OL5RHQqoK0I03BDQH?= =?us-ascii?Q?RVfpZo9Bd1gVHBbZ45tJWxCT08qVBMAzp4MNRxuiiOLHyIB8cswqYMaAFUH4?= =?us-ascii?Q?RDK7HZiauixK597KurQLkUR5d+qATXMhFFDlqqsGhgm7FvUXRQeDYzgEdOYP?= =?us-ascii?Q?y2v8pt6CRTTOTUVsEINcE7XKA5WcGvEaTXFqkA8YstKhOwU6DRCINGtD8M79?= =?us-ascii?Q?j9dxfOuwo6CtrTGaL8b8n5i2xKLOCe0qeu9OY+xM7JVYCBf3bVN8Wk7wDg0E?= =?us-ascii?Q?7CiztP5bgvHfEZA/L5PFshjgfwjAZCXtBJ9NTTttNLXm6zghdMLVMLZeshNe?= =?us-ascii?Q?f6CMT2RfVpUiJJ0rK4zjphINgTPrgeOdKnHMxcQ0d8ziJTXiLauIUQdF/1EG?= =?us-ascii?Q?xCgjNyVD9+Gurlj5DyeISHHj+9ZST9ADlFZAgD7EWzExXvqVmXa4z3zHYAR/?= =?us-ascii?Q?xY57ia1qtNMJETnLgY4DptFMi7FXRmzvfxB7JDa6EoPICMFRAJhGIg0MkKmd?= =?us-ascii?Q?cnR2DC39rUhxGu/PE8nMOt8YrHJnBVKpe/0H0F+8BLQN4OaiDr6FYwfCBRNz?= =?us-ascii?Q?2KJhWfbDAhpZn+YCR1fdTkqJemI1jI9Vjcp4TywRpodZCbqnsR1r6PDzPhdr?= =?us-ascii?Q?tWH66PLXh96QisZmPAuwnjoF0iSZ+5ZZRRwqjw0XywhA4P97etOPjxSSjqP2?= =?us-ascii?Q?b/ueYxEnU2C2oLOPyC59qlzcz/+UEO7p2s2/SHVWbOdorVAz+m4WeH94t0ES?= =?us-ascii?Q?+BWPy8DQWE2sagiRQUX7ZH2zi2wg7MrJvIzzhFLwkFcyiLNdevO79SLJz/bd?= =?us-ascii?Q?r3aKXU3BPRFI73M2hvoYsVzojFi0Rmu+YnzNqMKwOCBJbL5wJbLnS02y2zjI?= =?us-ascii?Q?GimsAru1AwArKRgqZDI6Iguswc4TH0iAPKAKuMp+1SpFBVfhSAD4aa3+bPtG?= =?us-ascii?Q?52eOnHhguou0tl4mzWaxKFuTQ52JlX1o14LTvsHNUr1PqO1HI2K1WlnmgnXN?= =?us-ascii?Q?6/U1bY/gX7ujOWS7gyZdMB1ClnMdT5YSKkj8NG331fZpJFNBFpG0XpLVQ6Yr?= =?us-ascii?Q?P7XnTCdO343eVjPZKCGEpbI6lUKaUDb?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 6:8+J2mp82I53BDziWyqf8QLRMvIgVbzBQU67h3+/c4rXcc3IZRFgdhn3CQh0dmUGNMKfgPdstz1jD2bdxzCNrDR6T3H56w1g0U98IPoQFzatBIiPFI3SimqqmyE2zXszoA1YBFWpcdkieQoX6F+F1oRld90z2IaX7Ldb7b7Y65R6kUjQ8kO+c9gqIgjxi9Lo0aot3IH8a9sAry3viHMl1Bonc05fXQJ/l5NhClXh9wVYKZR1d0W0IYqFTBTZxQkhLBPzp6Mawn8yuQaZlDkuXViqvi8LWZSBsjDVG8jG3rK+PKkYx7TtEtaleOA0sjKU+fqMAt4NY6lRgB9JmYUdQkrHkR6jtpVgqjXBKLaFIiVA=; 5:F/uLnvWuxVOeW5rFhjdcUL8kNC4sfdCHY8wkY7mAtmUtPUWb2NCJOUOiyrxbmSc+/bCGHAEsPFvGbq2YkljGgtlclrGZIquwQe9CLcozdFkS9VUdo6GQcOacV4UBJ6XRmLCxR7FZee3RBYgDDTisWooh/LAXIbc/nBQFvNRErvc=; 24:FsgxtY4NuFtD7L/dZNOqWlV7ixkmlGsgQ5YHTH/Q0T/HJXgn+7vPL0xdd2O3GE2B6DdEQDocJqhyaUZ3ObUmBtWcYYXANcYKW684Fzu8cIM=; 7:VeHHvldx8mBL1QemBt/+s8ry8XY6g8rHYw0P8noJK04k47+NFX2vtfmTdYolDlMdPzifQoKMiu8L98C/i2jbJN93Qv7bwTeiCPwNFSj+Lk7Qquc5SCjj05MteRiA7uaDTR34m4qp6nGhZQnW6sS30Jk0/rdFFn8RG4nZWA9B89Ur/a04wui/io689nvZz/HijnfgJrR8kt4Kui4qqNcou4AxAFg2Rg3T7gjkZqXZAENIS9Wn+p9I5Ji244xvnv15 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2017 04:53:47.6284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0818fc0-6cbb-4ecc-93cb-08d549c12733 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB2353 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use clk_bulk_get to ease the driver clocks handling. Cc: "Rafael J. Wysocki" Cc: Shawn Guo Cc: Anson Huang Cc: Leonard Crestez Acked-by: Viresh Kumar Signed-off-by: Dong Aisheng --- Rebased on linux-pm.git/linux-next branch --- drivers/cpufreq/imx6q-cpufreq.c | 125 ++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 69 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index d9b2c2d..8bfb077 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -25,15 +25,29 @@ static struct regulator *arm_reg; static struct regulator *pu_reg; static struct regulator *soc_reg; -static struct clk *arm_clk; -static struct clk *pll1_sys_clk; -static struct clk *pll1_sw_clk; -static struct clk *step_clk; -static struct clk *pll2_pfd2_396m_clk; - -/* clk used by i.MX6UL */ -static struct clk *pll2_bus_clk; -static struct clk *secondary_sel_clk; +enum IMX6_CPUFREQ_CLKS { + ARM, + PLL1_SYS, + STEP, + PLL1_SW, + PLL2_PFD2_396M, + /* MX6UL requires two more clks */ + PLL2_BUS, + SECONDARY_SEL, +}; +#define IMX6Q_CPUFREQ_CLK_NUM 5 +#define IMX6UL_CPUFREQ_CLK_NUM 7 + +static int num_clks; +static struct clk_bulk_data clks[] = { + { .id = "arm" }, + { .id = "pll1_sys" }, + { .id = "step" }, + { .id = "pll1_sw" }, + { .id = "pll2_pfd2_396m" }, + { .id = "pll2_bus" }, + { .id = "secondary_sel" }, +}; static struct device *cpu_dev; static bool free_opp; @@ -53,7 +67,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) new_freq = freq_table[index].frequency; freq_hz = new_freq * 1000; - old_freq = clk_get_rate(arm_clk) / 1000; + old_freq = clk_get_rate(clks[ARM].clk) / 1000; opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz); if (IS_ERR(opp)) { @@ -112,29 +126,31 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) * voltage of 528MHz, so lower the CPU frequency to one * half before changing CPU frequency. */ - clk_set_rate(arm_clk, (old_freq >> 1) * 1000); - clk_set_parent(pll1_sw_clk, pll1_sys_clk); - if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) - clk_set_parent(secondary_sel_clk, pll2_bus_clk); + clk_set_rate(clks[ARM].clk, (old_freq >> 1) * 1000); + clk_set_parent(clks[PLL1_SW].clk, clks[PLL1_SYS].clk); + if (freq_hz > clk_get_rate(clks[PLL2_PFD2_396M].clk)) + clk_set_parent(clks[SECONDARY_SEL].clk, + clks[PLL2_BUS].clk); else - clk_set_parent(secondary_sel_clk, pll2_pfd2_396m_clk); - clk_set_parent(step_clk, secondary_sel_clk); - clk_set_parent(pll1_sw_clk, step_clk); + clk_set_parent(clks[SECONDARY_SEL].clk, + clks[PLL2_PFD2_396M].clk); + clk_set_parent(clks[STEP].clk, clks[SECONDARY_SEL].clk); + clk_set_parent(clks[PLL1_SW].clk, clks[STEP].clk); } else { - clk_set_parent(step_clk, pll2_pfd2_396m_clk); - clk_set_parent(pll1_sw_clk, step_clk); - if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) { - clk_set_rate(pll1_sys_clk, new_freq * 1000); - clk_set_parent(pll1_sw_clk, pll1_sys_clk); + clk_set_parent(clks[STEP].clk, clks[PLL2_PFD2_396M].clk); + clk_set_parent(clks[PLL1_SW].clk, clks[STEP].clk); + if (freq_hz > clk_get_rate(clks[PLL2_PFD2_396M].clk)) { + clk_set_rate(clks[PLL1_SYS].clk, new_freq * 1000); + clk_set_parent(clks[PLL1_SW].clk, clks[PLL1_SYS].clk); } else { /* pll1_sys needs to be enabled for divider rate change to work. */ pll1_sys_temp_enabled = true; - clk_prepare_enable(pll1_sys_clk); + clk_prepare_enable(clks[PLL1_SYS].clk); } } /* Ensure the arm clock divider is what we expect */ - ret = clk_set_rate(arm_clk, new_freq * 1000); + ret = clk_set_rate(clks[ARM].clk, new_freq * 1000); if (ret) { dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); regulator_set_voltage_tol(arm_reg, volt_old, 0); @@ -143,7 +159,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) /* PLL1 is only needed until after ARM-PODF is set. */ if (pll1_sys_temp_enabled) - clk_disable_unprepare(pll1_sys_clk); + clk_disable_unprepare(clks[PLL1_SYS].clk); /* scaling down? scale voltage after frequency */ if (new_freq < old_freq) { @@ -174,7 +190,7 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) { int ret; - policy->clk = arm_clk; + policy->clk = clks[ARM].clk; ret = cpufreq_generic_init(policy, freq_table, transition_latency); policy->suspend_freq = policy->max; @@ -266,28 +282,15 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) return -ENOENT; } - arm_clk = clk_get(cpu_dev, "arm"); - pll1_sys_clk = clk_get(cpu_dev, "pll1_sys"); - pll1_sw_clk = clk_get(cpu_dev, "pll1_sw"); - step_clk = clk_get(cpu_dev, "step"); - pll2_pfd2_396m_clk = clk_get(cpu_dev, "pll2_pfd2_396m"); - if (IS_ERR(arm_clk) || IS_ERR(pll1_sys_clk) || IS_ERR(pll1_sw_clk) || - IS_ERR(step_clk) || IS_ERR(pll2_pfd2_396m_clk)) { - dev_err(cpu_dev, "failed to get clocks\n"); - ret = -ENOENT; - goto put_clk; - } - if (of_machine_is_compatible("fsl,imx6ul") || - of_machine_is_compatible("fsl,imx6ull")) { - pll2_bus_clk = clk_get(cpu_dev, "pll2_bus"); - secondary_sel_clk = clk_get(cpu_dev, "secondary_sel"); - if (IS_ERR(pll2_bus_clk) || IS_ERR(secondary_sel_clk)) { - dev_err(cpu_dev, "failed to get clocks specific to imx6ul\n"); - ret = -ENOENT; - goto put_clk; - } - } + of_machine_is_compatible("fsl,imx6ull")) + num_clks = IMX6UL_CPUFREQ_CLK_NUM; + else + num_clks = IMX6Q_CPUFREQ_CLK_NUM; + + ret = clk_bulk_get(cpu_dev, num_clks, clks); + if (ret) + goto put_node; arm_reg = regulator_get(cpu_dev, "arm"); pu_reg = regulator_get_optional(cpu_dev, "pu"); @@ -424,22 +427,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) regulator_put(pu_reg); if (!IS_ERR(soc_reg)) regulator_put(soc_reg); -put_clk: - if (!IS_ERR(arm_clk)) - clk_put(arm_clk); - if (!IS_ERR(pll1_sys_clk)) - clk_put(pll1_sys_clk); - if (!IS_ERR(pll1_sw_clk)) - clk_put(pll1_sw_clk); - if (!IS_ERR(step_clk)) - clk_put(step_clk); - if (!IS_ERR(pll2_pfd2_396m_clk)) - clk_put(pll2_pfd2_396m_clk); - if (!IS_ERR(pll2_bus_clk)) - clk_put(pll2_bus_clk); - if (!IS_ERR(secondary_sel_clk)) - clk_put(secondary_sel_clk); + + clk_bulk_put(num_clks, clks); +put_node: of_node_put(np); + return ret; } @@ -453,13 +445,8 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev) if (!IS_ERR(pu_reg)) regulator_put(pu_reg); regulator_put(soc_reg); - clk_put(arm_clk); - clk_put(pll1_sys_clk); - clk_put(pll1_sw_clk); - clk_put(step_clk); - clk_put(pll2_pfd2_396m_clk); - clk_put(pll2_bus_clk); - clk_put(secondary_sel_clk); + + clk_bulk_put(num_clks, clks); return 0; }