From patchwork Thu May 14 13:28:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dong Aisheng X-Patchwork-Id: 6406221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EA4459F1C1 for ; Thu, 14 May 2015 14:41:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 276B820444 for ; Thu, 14 May 2015 14:41:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A02920437 for ; Thu, 14 May 2015 14:41:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsuHd-0003Vu-34; Thu, 14 May 2015 14:38:45 +0000 Received: from mail-bn1on0729.outbound.protection.outlook.com ([2a01:111:f400:fc10::729] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsuHG-0003Nu-D8 for linux-arm-kernel@lists.infradead.org; Thu, 14 May 2015 14:38:23 +0000 Received: from CH1PR03CA007.namprd03.prod.outlook.com (10.255.156.152) by BN3PR03MB1350.namprd03.prod.outlook.com (10.163.34.149) with Microsoft SMTP Server (TLS) id 15.1.160.19; Thu, 14 May 2015 14:37:58 +0000 Received: from BN1BFFO11FD030.protection.gbl (10.255.156.132) by CH1PR03CA007.outlook.office365.com (10.255.156.152) with Microsoft SMTP Server (TLS) id 15.1.154.19 via Frontend Transport; Thu, 14 May 2015 14:37:58 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD030.mail.protection.outlook.com (10.58.144.93) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Thu, 14 May 2015 14:37:58 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t4EEboxH007474; Thu, 14 May 2015 07:37:54 -0700 From: Dong Aisheng To: Subject: [PATCH v2 1/5] clk: remove duplicated code with __clk_set_parent_after Date: Thu, 14 May 2015 21:28:59 +0800 Message-ID: <1431610143-21853-2-git-send-email-aisheng.dong@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431610143-21853-1-git-send-email-aisheng.dong@freescale.com> References: <1431610143-21853-1-git-send-email-aisheng.dong@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD030; 1:eRFeZndJ46Mop1x6pKJulM56MEZs6M+vhTzaLrrDHZlr1ljNU+XyQmEYH5CN+0Sbtd6u1ZKPqAszjDps/zewXAgbsnSY3q25DEBSAaZs6kOsZ79OwFhydshG/ek1WSIjHkD0yep6YC2FqMR3NL4TpSaDvx9YR9DR6R2i2IwsS26FApoSMA4nCkeeEVStGGXXcurpBcleP+7QhWamG4Gy7qyqoLookZ4hRkPfeFXWrVPjHQJmKS/Z2X26coT3juFsdIUEZFTs8iBe7/B68xW9wA5L27FFw4JgUF9yPAdHDKULekgLCYFTZ16irnROz0QdoQh+DTTRCXi+LaHYm26MXA== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(189998001)(104016003)(107886002)(110136002)(19580395003)(5001960100002)(19580405001)(48376002)(50466002)(33646002)(77096005)(105606002)(50226001)(6806004)(87936001)(2950100001)(106466001)(36756003)(76176999)(85426001)(46102003)(50986999)(92566002)(62966003)(77156002)(86362001)(47776003)(229853001)(2351001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR03MB1350; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1350; 2:wQh+MYXHETLZsTKLwuIQUYY7exlPxI3a0300QadO/X2aCJTcVO452cEFyLgzOqHD; 2:yjBw2LmdM2As/oC0098RWs46Xpa4QXv3I/5o4aHH5yZNBtcs4EuyAr/tQx3/E6efJtybNXehI3zKmZt5KnuFygc1AiysSZ4Gh5+pvD8lR2iRsSlJERt95rFH16taLQ8HJN5e+iptmsrULxvHfLl3UDrBkE73AwLG2zEyYApjNNVB/xVk5MLY5VCxWk3UEG7IfKp6q0ZzjLt7HMc1lCy7t4SBJvUagNGWOyvrLQe+yDY=; 6:9y/XmnQc3oaf2F/72zpg3bLMavqYv/f4j3Xf+L7s1LVan0G4Zj/CBMO75Nd8N79Nv6iag2hbft1U2GAMQGRBesmKGuqgdqUOYxUe1luVQMr3z5h2ACdVgs3jQI52ctmPa26WR6LWgjfDDWCHBdjSrf256XC6tg5VbZstk0d2KIqsvpMRYzZmzunTcd6kCfmHF0t037y/O/tdKbQc/wzAHP0J1ByZI6HKjn1eX2pZCOjOzZDaF5N4TlncyO6T+RJqLPWuz+nrb7bB86UEUOdR9c8HmABDWWkzm9ZmrXFxCcJiK7982n8gb4hF7XOKCwuDaibCBjNdZZgLv5wf1TDrgQ==; 3:IdV0RjEAS9jpNrMkRz3Cqe7/XOxfF6rTpJu1n2NTIrlEy7kyCTqFe0Y6mZTP7wTIEZR93+qRM4YQMjLh7v+969zmLEJ4d5qVRNO8khr0Raf0+SxWChDZR8XzZEMAFiuXJjaMk4legWRmUIBzxU0rErekAUgJRJrHIblnoRFLAr2GD+apzeY65j9q3Gs7stkbo5B/q3cIqDi1uTP6XC77ZxWrL5mJ9DiOavSFTDG/AHyfJBo/c57rOPaYpWG7GQyDul9wUpNGGoJwdeCWC72hKH4PSEeaBvaHyQp1POypLvg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1350; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN3PR03MB1350; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1350; X-Forefront-PRVS: 0576145E86 X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1350; 9:y+jitXREgzWsSe/WTYKKQ64qJkhxmHJKOyjRR/BZ6WP01MYJ1YQ6+OcmFQBiFU8OyepL961htPIKyBxPQfgZbd6W7OaQXc38Cv1ZvB05iFZ1x0aoQdOV5ovZSpd/n6oZ2hEogaA3QWaW51Su7Dpz1xNaht3FTiqyEEJRVrjLLCxt33NjBNB8oRQmPP1nM/cozrvSVcLAk+rsz4t2hquSRpjnBd4kHrJfpfDhNtcP5NvVhCBEuzYVrUBrBaEeBpae3ECYEd+J9khHN7T5/KeqNuBsN1/0ZQiN5Zpa3Ndhmxwtigi/VFPj2gcORZdk52fQY+BZx4mWdh85HI2Od9Wa7pxrKX7fPBEy/Yn7E6s9gRtfC+ML9fj6bXCr03Rkj2JHIliccbPUYWcxlRLko0CUWQRSaksOdXUGpc31EwnVv5yT4U/vjuK6jK2IGZzF4kPxOQZKhrmWqE9hCCmBodexlMJebUuc9n4NtVncc8iOi+hWYokKFlh3FEjMOL1xVqax80nWFyPXvpKfKMu+AwmoU52ukJViVL2KiShzRWmdh/F92PlTk5J8RqzBR6utJlA3oLziH8nrqzkBHFz30Thb3puhTGi00PaC2QqQdCE9WgKEjXurEmYVr4TQ/G2EfiPVxeTX4yRFBJot3hmA8oR9RhS3Dltb9ecniECBWhpTyxVkaaluuHGFAkU7XeC8A9jLsbwmgD2mogLzqy68nZBdbXpx281MUcTML8MCaTXWlSw7FrL3QZ1uhVGLmfj/ds7YTlba0MLI0YAbNdZjisqW2aSV4zo8d842wKv++JUldFJyAh8GVkjws9+mktBosrbRBTsH19yv2fADMoSMCozhS9rdYAlHxECfiIKWei7mqHn13ENoxbvbChT4UbN6i+KbW8E0Zq8d+K2jCqvn6lPwcg== X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1350; 3:nNwJA/JaD9jLkuMBXCVLxPeSGlh3+mejk91u2mgv8MW2lehmcIE14f9czFzZNeodc8Y4fDLS8UVnK73j1knlXrkC7auJBsE6m+L3TSSdoAnCkvAeR2tE0FJi8cuib+vqVE9g8Y5XonZgjA7eS/mLdg==; 10:j/BfWRYavictnkZYPeq7e+3qB84nr2HQUdEsSGvwtaOeMbknZ88n4BBJuphTJ4qVmsKHL13qUb0Xv+volUcPFxBWsdER58A8SPTDRG5o8/w=; 6:7lfF2AIM29LZT/SmpQQBrklyQ+sT1QYGCUQwdDodSPvs4qYWWBfCv04T5qamFAjH X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2015 14:37:58.1452 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1350 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150514_073822_766253_751346A1 X-CRM114-Status: UNSURE ( 7.18 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: Ranjani.Vaidyanathan@freescale.com, b20596@freescale.com, mturquette@linaro.org, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, r64343@freescale.com, b20788@freescale.com, shawn.guo@linaro.org, b29396@freescale.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __clk_set_parent_after() actually used the second argument then we could put this duplicate logic in there and call it with a different order of arguments in the success vs. error paths in this function. Cc: Mike Turquette Cc: Stephen Boyd Suggested-by: Stephen Boyd Signed-off-by: Dong Aisheng --- drivers/clk/clk.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 659f2b0..0e813ea 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent, flags = clk_enable_lock(); clk_reparent(core, old_parent); clk_enable_unlock(flags); + __clk_set_parent_after(core, old_parent, parent); - if (core->prepare_count) { - flags = clk_enable_lock(); - clk_core_disable(core); - clk_core_disable(parent); - clk_enable_unlock(flags); - clk_core_unprepare(parent); - } return ret; }