Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932185AbbG1O35 (ORCPT ); Tue, 28 Jul 2015 10:29:57 -0400 Received: from mail-bn1bn0108.outbound.protection.outlook.com ([157.56.110.108]:9280 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755227AbbG1O3y (ORCPT ); Tue, 28 Jul 2015 10:29:54 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Dong Aisheng To: CC: , , , , , , , , , Subject: [PATCH V3 1/5] clk: remove duplicated code with __clk_set_parent_after Date: Tue, 28 Jul 2015 21:19:41 +0800 Message-ID: <1438089585-30103-2-git-send-email-aisheng.dong@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438089585-30103-1-git-send-email-aisheng.dong@freescale.com> References: <1438089585-30103-1-git-send-email-aisheng.dong@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD030;1:ToMrUkGfBLOZadcTzpawe/DlymTa7jhXbrErq21uI7aJXYQGtg0owt30o1wXvRN8Ap5KDNst8j1NWIH8P917OFWr06hfrS+6d/b6dxvBLNk8Oo922y0EHRApYHPWroS36KqWkp6hezkLrFW7Y4Gbs0kgKL4SvB415f25LLrDvSvrQXOFzv8Mh2Eq1pn4ntzOQU3+H00VkDf2+cWESuUX4H7U4jnYenKkSlPm6XlC2fBDe8g7nwkcm4+SW/mQ/qNuJ3xgLfP56tyC8xXtRlG64Mjr8p7dSsdy63ICdCgyPf/zGiWyAK0nyB6XB325Hn4uCiwATuk/dCWmTbzOgAg3vA== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(50986999)(86362001)(50226001)(92566002)(48376002)(19580405001)(76176999)(87936001)(85426001)(46102003)(2950100001)(47776003)(105606002)(107886002)(77156002)(106466001)(62966003)(110136002)(77096005)(229853001)(5001960100002)(104016003)(6806004)(36756003)(189998001)(33646002)(2351001)(19580395003)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0301MB1637;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1637;2:6zc1xT5n3KGhdymhY+K4MhziGo2xgrcQmT1YRA0OkfIPCWrFP+UKithrDdbdcc9YqzXmflUXiLsgpdEaUdq8vGEzKWfH0uh5G7XGFqhTzLsFCh0NFjEtpgvaK7ybHpLm4ZIAamjCRCw+/pSHLQROqCcK0G0SNT9DG7HaJ75yB4g=;3:O/8vdEVAC1HQdUAEnm2dW6YW9PHjvwItXHfiuTaJjXiGav2AW0VnCG3c8s2kK+CvJF+CPvFPX0DH1vDbgCyN4MCagVtc5O9YIE10MX4LTubLvnzbVhK0C87Qtd63iow5PxzvZtwYpuaHaTGtapnpI9BH8SyOWcIVbxc/IA5bBaxqVe3fEj0Yl/3bEVbM7ryM1Uu6+7cxkkUPmR6n7LpVLKbd1dTsn2yj0BmLB6IHl6Y=;25:GLgkClJp4gmSJ0eCvTzawOw4HRpveaxczC+YJyj1M+nDbE5MTMdwJ6tAcMf+KTZU7nI1cb0Hz+dJLPbzrOsukZurUCuOq1k8CfMeAO+0XJHbhd6j2oiu1t8IifKR8bS4ENpipOHdCbUlc8BQgJbxopm7uLrK1BtOfgdPmVLP5BSe4DO5JRENimeu3RI7NtN2uqYo/fDP1o9FCwG6Ym9Zx65oyZB0pxVJ3JpjokuipL1+aWF8b/VoZwW7xPbR8BSFARpyXI9s+rJRJCXVoMtNxw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1637; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1637;20:dic942KnkOPmfe3PMEtU4wl6TRvo+LHdx8T6GjFZq1/tglWF9k0SvBz/Uz/n8LqYQoDai8L8+J16MxZHaYVCIyLHkVZV2QK0GQsJlpn7GgHglJx6RdDHDr5waccWT3IwnIfjdeBwB6MGLPtb03Y6QYelBXvOUiM/qjrT6rfFUMoU9jS5mhTHkuN5KMP0ZYVU5Vuw6SKX34LiultUWNDs56/1PYhhAIEdk9WH5xTmNbY9SXU5hdHLfInmfG+w7dmg/oAq5WzzE7ZvXokdi+yu4NGEhMKHeJFQpbVPslA1fomPLmmG6R1i0aJEgVESMmWPvMoS5cypK+NKaQ928ME3DDno56uIBMWUte5fKY4csVg=;4:M0RrY3+GF95zLe//37rph3Cbl4Mdbh2UzbEyQqEcusNi/SnVY8n5iQwG95WU2taN4ucNErH9b9ulcuNIccMDv1RlsaCkh9XqT+1E7KDcCxxLUOx9EVFMRfz3xuStWZD6h4issXO2e3oMyJqb2Uv9VuV/C4R+O9rIf3dfWJpNoY8EYalZNpR+n+JuK2fWwuYpZdMw1IT7DYWHv2q3o42RXaF3TUis7nMoW7dH0lFrIIvfoHE60yd+AMPJ+hcp0e7riHT5KEvHb6vA32ywKry6les15yjyaMSj8c+zZ0D5wzE= BY2PR0301MB1637: X-MS-Exchange-Organization-RulesExecuted 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:BY2PR0301MB1637;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1637; X-Forefront-PRVS: 06515DA04B X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1637;23:N0cu7isMSZFZO7iOggPDZ+eiSHcZZYD2eVVICRgUBkTH/27DJP+JOXsYzI9MjawZDY4MSV45J8WqGB929yHiSAAqMZeUXvGxP4z6i3RcIu+tFvXtLwVwOP17xz4SBMWSDwfvHpldrLVNbR4gSsQA1aDZKOUD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MczGA3fP8sDju4zAKbRdknDJh8a43AzVUvKHcjqx5CHyvWJIZMG4mdZpNvl5oVYidR6C7lpA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2015 14:29:47.5288 (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.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1637 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1320 Lines: 40 __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 7bb9757..4c7f7b2 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1185,14 +1185,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; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/