From patchwork Mon May 8 14:03:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 9716233 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 F264F60234 for ; Mon, 8 May 2017 14:08:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E182B1FF27 for ; Mon, 8 May 2017 14:08:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D652F2029C; Mon, 8 May 2017 14:08:30 +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=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8E8320223 for ; Mon, 8 May 2017 14:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=On3NtrV39Ot4xf08qLwM8TpdYXrhoLQ8hhbyp2gFVsk=; b=I2kScpG+kUsFS+ ReR+zbHLMz0qUy9G09EtY+fmVJF7Lzt+3i0aE7D2VwfNAkVw4w8VZWrojeCXgjR87FovqCH6rmKk3 SKyLi4BSJDUVu/F8d0j5heVWm2C8qIeOy1Hr57hVrewlHEzvnk/KB36II/3b4qA2HFEk3YquIzc/t V4Eu7rxPmHHE4WipT+RmfGQDK2Y8KcUc52RhzMXAK1Hz975h45OQ5NEfdkKev+ebgiM32Tp5VefOt dgfk/UWTULhzsJAsqkwqNxNjER2M2KvXN9cYCt5HKWulNMGE8AW6/OlDvsGATXHa8ULilh4OfwDWl BlLYJ1LD6H6mCsrBqIYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d7jKu-0001gP-I4; Mon, 08 May 2017 14:08:28 +0000 Received: from mail-dm3nam03on0083.outbound.protection.outlook.com ([104.47.41.83] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d7jHL-0006uk-Kz for linux-arm-kernel@lists.infradead.org; Mon, 08 May 2017 14:05:01 +0000 Received: from DM2PR03CA0029.namprd03.prod.outlook.com (10.141.96.28) by BN3PR0301MB0899.namprd03.prod.outlook.com (10.160.156.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11; Mon, 8 May 2017 14:04:23 +0000 Received: from BN1BFFO11FD004.protection.gbl (2a01:111:f400:7c10::1:137) by DM2PR03CA0029.outlook.office365.com (2a01:111:e400:2428::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11 via Frontend Transport; Mon, 8 May 2017 14:04:23 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; arm.linux.org.uk; dkim=none (message not signed) header.d=none; arm.linux.org.uk; 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 BN1BFFO11FD004.mail.protection.outlook.com (10.58.144.67) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1047.9 via Frontend Transport; Mon, 8 May 2017 14:04:22 +0000 Received: from b29396-OptiPlex-7040.ap.freescale.net (b29396-OptiPlex-7040.ap.freescale.net [10.192.242.182]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v48E3rlt032011; Mon, 8 May 2017 07:04:16 -0700 From: Dong Aisheng To: Subject: [PATCH V2 3/3] cpufreq: imx6q: refine clk operations Date: Mon, 8 May 2017 22:03:53 +0800 Message-ID: <1494252233-21074-4-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494252233-21074-1-git-send-email-aisheng.dong@nxp.com> References: <1494252233-21074-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131387258628365092; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39400400002)(39860400002)(39410400002)(39850400002)(39840400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(54534003)(9170700003)(85426001)(7416002)(2906002)(305945005)(498600001)(189998001)(54906002)(5660300001)(104016004)(8656002)(38730400002)(110136004)(48376002)(5003940100001)(53936002)(50466002)(77096006)(105606002)(2351001)(106466001)(33646002)(356003)(8936002)(50226002)(86362001)(6666003)(39060400002)(2950100002)(76176999)(50986999)(6916009)(81166006)(47776003)(4326008)(36756003)(8676002)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0301MB0899; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD004; 1:wB5g+ZsG9DU9GMAYsy240wzJfgALKCX9Xh8GN1yWA63QEePTt2f7AGj0TfUHb8bwhG67jBUpBGvRwb4TXUnZsy3+BrbZ5EXlqqMNpkW+bGdLcxrRC5bZIctsAevbeDf1Szzmmz7+jkXxi6/RNk8eh1ijONe5b8+z9fhmpMoDDRdHrVcB4tYKAZ/3ncG5N8OT7ir5tvBt0KmBOS0tCmS8ZKcgf78ucB18VvqSdzA5bBZHDfe9XHSaJ1rcjOvYIYkOFUfAQBugUwV1d+pv9bxFA+3a152FdQ1E1wLLjrbB1JDSLLyD2LADmEGJhP/0914u/VQ7DazO6UQNVuzipcB01vBJkIRUe97lM9Dnod5+1eBk7klr4CnjdUO1gYrXzKkENe3y9enXLiSlT8yslmVTYARTqCn4guBJt7A0f9Fj6IWE5Uy6CoWI7WQ7VDpzRBqc7j79ajag+sbG+LpwzUdkRrRf1cdWZwvtEEz57/Snn/7J/n1qS8Fq1DD7BIeMzRUJ+BHarRUPpMDWBC0ZmKGVGJJhIRti51BoyA0n4Bk2b+j1QuufGD7pIR9awMP1+gUYHIgjVhTS2MFHdpgPEXAwA1hFcPci8kzr+I6oFU6zKDXWDfDQkH85cyQs3517ywDs MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b51b26e-cc9f-4f5f-501c-08d4961b20f2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BN3PR0301MB0899; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB0899; 3:oCJUMWY8lvb+aPua8Vv9Ht2ktTj86WooycwIiR0+zPSdI5Ow9jrfXASQqnxswPNxPx54nVsmFUsXKASiK1tiZIoSRo91Ge68ehiDDO5vTdebxnq0NzvUHghahobtCHpk0pfdFl1uZEmc0G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Pr7XB6DbqUd1lVHgeIl9xvcNKPcA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(5005006)(13017025)(13024025)(13023025)(13015025)(13018025)(8121501046)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123561025)(20161123559100)(20161123556025)(20161123563025); SRVR:BN3PR0301MB0899; BCL:0; PCL:0; RULEID:(400006); SRVR:BN3PR0301MB0899; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB0899; 4:kf65T/8Xy3aBVyLU1nS7UvDlYrj9E+rYQF4PaA29?= =?us-ascii?Q?+uwjZVctAXM8S0LK4SNW0TSzNtfbBktBtvW/yG5kwIL31kJABt1ntgedc2zT?= =?us-ascii?Q?p0PlMLIFyDEcUdy+DrcxdrfJoh+X4r32nqsLlocbCsfPH78f92pX2LCcRNaU?= =?us-ascii?Q?ypDfe8ghlhnulO2YDOW3OlK5N/CPXzDR6h0yGefTEgzWTZHl4hSR0XwIFGXm?= =?us-ascii?Q?Lr9e9pndGe/hkiLV4oSeESS7lQu8eqGlxIg7XXnEtTsvFYa0WNUpMCYeo/eu?= =?us-ascii?Q?Bs7vSdWK55pL5LB7FWeWvjZA62GbfvKcSkDK/LBAmhXqhPoKST/+7ifidqlN?= =?us-ascii?Q?2QxeupeMaf/jkggmP6e/Rmd3/RJEkGKwGtgdw3VeCwlnNwgJgA80pYl3D3c0?= =?us-ascii?Q?awW6N1bgPAvHT/vj0aMGu8vuDHrIo6FUSBqRDNrqfUToESyRj3EkhN7PJ/4/?= =?us-ascii?Q?zrjBKPw+kae5MMXi+y7ZP9tGlv0C5xapmDijSBWvgo4j5g7kXnzGif5aM6gL?= =?us-ascii?Q?1txTopBuMfH99rwW+MypDhR6ZQ8ISQxaugmKS7bIj8iTLsxtDxDrgKYljMqI?= =?us-ascii?Q?6Nb+hf+mzqw1PL+Gi6iGeES+YJ3GFWs+Gr2ieC7zv8FGY8J65REGQ55SoUWj?= =?us-ascii?Q?R655CrQSwsEVMSJbuDkqzGIITBHp79gv3HocfYJUwxYsMbvWJUNl3peflOja?= =?us-ascii?Q?Ai0Q7GhZ3NqpTpvE3Ci2eKeF5iG/EDOrpgC2Q0JxiigoeVgt6vD1GauzdW3B?= =?us-ascii?Q?oTGUpT4vGDAVhW/yM3PviZy+hH9Gep71QdSkPJRFunnBAPNcY8JOutzeJjAG?= =?us-ascii?Q?XuG/WedB9uvMKohDP34Ge5usukRGEmaAK8XhwmnoUMGymQ+LX7QYv9akxCPn?= =?us-ascii?Q?bNEiUzh/oHcV03Y3ZNqq6Y2PPkfEEhZmQtHgFXrzcObt4FA8nlwN6R35koEv?= =?us-ascii?Q?wEI+uFdqpP+r1Sxa19ypz1Sl8dikbISVb2N8HCcp2w=3D=3D?= X-Forefront-PRVS: 0301360BF5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB0899; 23:8czQ2WWjiZpRq23mve4HjC7QEnC8SZrh3Bwhins?= =?us-ascii?Q?WL9PcJoJdfuveZbxCFWnYFJjZ/ZJMxm+ImIlZWlSLichXE9EImZSMzviymh+?= =?us-ascii?Q?xad+wPtRdk4IVp3iz3bkurdhe9iqIduA3QvBCT421mi0FbKugPBBXf6YXt28?= =?us-ascii?Q?OQvk2p8Ybfy30u5Tf58xYw2RObUkcyZqNGFM4CLVq2dKoGfsdfC/466L+Zxg?= =?us-ascii?Q?EfxQR8ZumRNvXYtQkrlnkrs9mml9wEr9q6Croz0UA7JHhPkCd4TC/LQhmpC2?= =?us-ascii?Q?6x4FCpngCfwuEwgiQo4/MQ+mTp/kLELg9GYaJc4Q0ekSuFeNyzzJLjup5y1c?= =?us-ascii?Q?kDG3po7vBxi78wiPPMYa6RsoJx1yHoXm/oo2vRA9SSAzPMhu+n8JmyDUl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pJRjMXMAXGaT4n9EWDd3eqrarb0DGqEolM3Cjl4JICvuW9kM6382FS3PyqNGWoSoDKh8sDk7muFWZP3PLoUsGRUnFtPLwKHDeY89+wol310ckDKZ5dty11wPJJ4/YZuJAKoYosAkHdrIHD+F3FuSh0NYRkagcIC9tTAbwrNj98/VIk7kZyHOdVMhoguHxkUOIhWYkY9rGe1bdd5tHbu61iSiIZgzcW0rTMvKlthek5lLY4dJyG9pK7N8xzzBbu7B6bDH2m3kE556xWJ9ZG6O3n+mzOhuFU1h4m1aXSEMCGokFktM7heX4EaKg88bQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2017 14:04:22.3217 (UTC) 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: BN3PR0301MB0899 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170508_070448_439227_9F8C9064 X-CRM114-Status: GOOD ( 18.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, leonard.crestez@nxp.com, Russell King , ping.bai@nxp.com, anson.huang@nxp.com, viresh.kumar@linaro.org, mturquette@baylibre.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, broonie@kernel.org, geert@linux-m68k.org, octavian.purdila@nxp.com, kernel@pengutronix.de, fabio.estevam@nxp.com, f.fainelli@gmail.com, yibin.gong@nxp.com, shawnguo@kernel.org, sboyd@codeaurora.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use clk_bulk_get to ease the driver clocks handling. Cc: Michael Turquette Cc: Stephen Boyd Cc: Russell King Cc: Geert Uytterhoeven Cc: Florian Fainelli Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Mark Brown Cc: Shawn Guo Cc: Fabio Estevam Cc: Sascha Hauer Cc: Anson Huang Cc: Robin Gong Cc: Bai Ping Cc: Leonard Crestez Cc: Octavian Purdila Signed-off-by: Dong Aisheng --- ChangeLog: v1->v2: No changes --- drivers/cpufreq/imx6q-cpufreq.c | 119 ++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 66 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 7719b02..6158910 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -24,15 +24,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; @@ -51,7 +65,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)) { @@ -109,25 +123,27 @@ 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); } } /* 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); @@ -161,7 +177,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) static int imx6q_cpufreq_init(struct cpufreq_policy *policy) { - policy->clk = arm_clk; + policy->clk = clks[ARM].clk; return cpufreq_generic_init(policy, freq_table, transition_latency); } @@ -197,27 +213,14 @@ 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")) + num_clks = IMX6UL_CPUFREQ_CLK_NUM; + else + num_clks = IMX6Q_CPUFREQ_CLK_NUM; - if (of_machine_is_compatible("fsl,imx6ul")) { - 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; - } - } + 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"); @@ -354,22 +357,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; } @@ -383,13 +375,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; }