From patchwork Tue Apr 19 06:43:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia Hongtao X-Patchwork-Id: 8877191 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 79F1BBF29F for ; Tue, 19 Apr 2016 06:52:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93BAF201EF for ; Tue, 19 Apr 2016 06:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B231C2015A for ; Tue, 19 Apr 2016 06:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751736AbcDSGwo (ORCPT ); Tue, 19 Apr 2016 02:52:44 -0400 Received: from mail-bn1on0087.outbound.protection.outlook.com ([157.56.110.87]:55654 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751657AbcDSGwn (ORCPT ); Tue, 19 Apr 2016 02:52:43 -0400 X-Greylist: delayed 81832 seconds by postgrey-1.27 at vger.kernel.org; Tue, 19 Apr 2016 02:52:43 EDT Received: from BLUPR03CA007.namprd03.prod.outlook.com (10.255.124.24) by BY1PR0301MB1221.namprd03.prod.outlook.com (10.161.203.17) with Microsoft SMTP Server (TLS) id 15.1.466.19; Tue, 19 Apr 2016 06:52:40 +0000 Received: from BL2FFO11OLC005.protection.gbl (10.255.124.4) by BLUPR03CA007.outlook.office365.com (10.255.124.24) with Microsoft SMTP Server (TLS) id 15.1.453.26 via Frontend Transport; Tue, 19 Apr 2016 06:52:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.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 BL2FFO11OLC005.mail.protection.outlook.com (10.173.160.91) with Microsoft SMTP Server (TLS) id 15.1.472.8 via Frontend Transport; Tue, 19 Apr 2016 06:52:40 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u3J6qaJ4004625; Mon, 18 Apr 2016 23:52:37 -0700 From: Jia Hongtao To: , CC: , , , Subject: [PATCH V2] cpufreq: qoriq: Fix cooling device registration issue during suspend Date: Tue, 19 Apr 2016 14:43:26 +0800 Message-ID: <1461048206-23567-1-git-send-email-hongtao.jia@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131055223606586808; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(48376002)(50466002)(5001770100001)(189998001)(36756003)(5003940100001)(2906002)(586003)(1220700001)(81166005)(1096002)(4326007)(15650500001)(6806005)(47776003)(106466001)(105606002)(11100500001)(104016004)(33646002)(50226001)(5008740100001)(19580395003)(19580405001)(50986999)(77096005)(87936001)(85426001)(86362001)(92566002)(229853001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB1221; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC005; 1:X4nuU4xjVWFIkkMJVWpzuGTnQonSMJ+rcjotuu3/Vv0NLfOSOgsJp6LU6Dnhla0sKBJxUM3EeeZNniAjdt2MSqJGfIV1PJXf2foiK7PHRpP3kdVPbJWyoY/JUxbGxiSuqA95S2yZLkzQSbGqlimQ7Lev7ZRQgibSbYgSuwVj3UmQ8V7H7Uii7EEBEDMTWb+lbu4s4K7odyVv2lmSNikhKiWll4MFxDkABLBvkYF/XyqV/oY8659LrlA7nEMpJZ565QpZF3bzpQLcoOr14hvUWFCEepQ1eB+is2Uc3Jc+hJGvgofwryi6bQg1rHIE5OWWgZCmUo2ZCT0KykmLkcLh9wrKrN0fNjS5P4bAjSCO/TMSgg/oil6E7zOWcyXb+6WEYCkqlJhSYTvRvFM6qjR82z51K9EUTx6hMQPfIBxRwOzjNzsNFD6v7vEVYXMbZu8tIol9b9XP+QQ48YyQq3/mWrbySG+FpbCUbDtoyOEJZ/V2q9i4oBnf6BVRaO9/gZuxms7t2ywY81dIWDvmF5a6IVzHnaOQuc0hHfk8HVaUe0mjheLd/YLzJIydmIsXw9tZc6TQXN65aqlQB8331zZHTcr3xSpNzSap5E9yd4JH5V0H+il7NB/PHgYMaT956YoVfnub+psbbnRyIK37DUGb1HcmsHnKWuc6pAyjH95mk5vOYxcee4pa0X4zgiOV6mMP MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f32e39be-e2e6-4e24-adb8-08d3681f337e X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1221; 2:MzSL+nBq4t08bDmaJN9pAt+bVcqrAekqAZMzsP6EBoBNTruLI0+13MWCVK3XWUG8n/YA6uI3SJphvQb9vfrleV7uH0s386ndHQYoH9oK3uSfZkQutLCCIGYTIqqHUTKsGA7HDuUgJHME22yLT8QH3qos13PN7+/rVxQ3CgS20NI1iXI0E4OkhNVgskLayzXG; 3:p1ypdGIBpjBxv59O28lCNBte6u2Iq6QV8tkFY9L61x1A6DGwcTqlW2aNgrTRAXKhW+20vodDyFi/3JVoKT3rzvwsqwtFjKuGOUlT0LMJxVF9A/GOMRzPYzMwi+PDKYysN+K1naavhmkTinzto+ohZACT/kZ4qiTYN02aKlqTGfTLgGwwoA5liiJDR+Tm7MnOmxZ/R1/TfrVYZY8QEFfyvWjtbYx8EKvNwPWp19nuPuA=; 25:lMoZzkEP55H5/EtdEbYGCB9ILza/zWcCNXKGDvKQEMgxG+zwQttZRY6Yh2Hi6kzpz2fTR8aJLYHfFUhsLvrXe5bzSnv+7+4vbCkLdqa20mEwv07aOWly4/QWFun1uNhg5qkta7kcER3o3hsrzyQaf6Xbl0ca30PuJb7rsEL+SPgrt40+dEktOXeIEMLNqwMfB1Hx5+0vcIJf8F9dLeE6yuXuIb7HpvBQTyeiHLYh/s8YygPwN6DNEzdfmlYwAJGxR1yCIHYPYvVBrgylnMnqGu7cE3PNn21lKUYlgVrjT8FE5TZMhnYkmhl7YnCfM8ZquWHUHCRUGYtevSnU652qXw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1221; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13017025)(13018025)(13024025)(13015025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BY1PR0301MB1221; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR0301MB1221; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1221; 4:GiC0BmYeDFFtLHTtCpUz7wrpD1LbS4EnzVU7eCTMSUnASv6aAJDe9FS5vVOmNBvXeUM8XFOvvBKx7I1o2EelTeIa7951zRyHznbsKvAGeUhles8pzINz7IVBIF09eh7Nr70V94OSSIGRMbTtPFXEchl0BOeEvrSypyPgtv+KnmCbA1MODX8DWZl8ldNXnX55uJyXFRXgWzB0O0iIxTMzc94t/52bM9HzKMqYwbD+JRfTuLqI1pdsMzInF/oyPshg6BYuFuQQlqeAP9pu4xq4XlyokzA/Bmss1Rt48ZHq0GO4ciBugy19+/AvZGjJHSb8IqUgqTcrfZN7mpIHUbbEWc2RotnbKPXbctreyU35/sG7bqNGCqF1ypnUC0zWtqN37O+nME5jtOv/ccJeD9L7JSrkPm7ZToAcUVniVK9LGGyiVogspIxYYp8923rFtPzz1dRrQXK70ADDwjnJ0g0hQEPnp94b9ABPNvtx1QjMWwY= X-Forefront-PRVS: 0917DFAC67 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0301MB1221; 23:PgJrEojCLK5fY78l3ONoZQ6moAiYbpxQzVBpszW?= =?us-ascii?Q?m2D80B89ZwFO2JU2ZfJSeilcxc0tsC7sqNBxGI6Uu0c6bx0EUkxSeE9d2w2P?= =?us-ascii?Q?B/bkEVUz9SFyDUBiTTw800/FYz476igun3M1iNFdWvY6HHcn3HuNkbgx7Tcg?= =?us-ascii?Q?EWkg2JATdPiAnoZZVltHUDz2KH4PcIKccEyiuBhTMhp9izB+daerfgtCCC95?= =?us-ascii?Q?mTLtMdPZPq0QeMqj2RKXK+B0qzxK8zSptOqFE5eiRIzSelgePNN58fIIgakA?= =?us-ascii?Q?P91Fd3uMO8/gSxkk9flqlUCyEHoIUedZMBqPlYaBOEcCTO58X+k+D/uwVr4r?= =?us-ascii?Q?Kw2nLHX+Si81OH8W4Wx1E8OPHL3FGt8pWp1DsoQpCLL6+8JZOxyHcoibCR+V?= =?us-ascii?Q?9LUNofKP105mRb9ex1LXKR28FASUOq1s+hazfw29id3vBqteqKRt15aMjfFD?= =?us-ascii?Q?uds9ouxRolknnhTWb8JKr4G3bPGDg3zirYY3nHbj7h9ErGMu2vjNOoJIXsK/?= =?us-ascii?Q?EIRt7EYUPyYIsOC3XJl2tCadtWEWb05Sclvzj6vtjZI7ukwi/kojONLiabx9?= =?us-ascii?Q?kV3JdD5DVDDWslcnH7TME+UUJk8z1slVSQ+w7EwrrPGkx1h3zC31O2XrkPdJ?= =?us-ascii?Q?Kavjwb9epS6gyGC332A4mk6xAsa69mL4tMsDZN7SJTs0vGcNHAWxvBJrZWev?= =?us-ascii?Q?p2WQagaWa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ange-CrossTenant-OriginalArrivalTime: 19 Apr 2016 06:52:40.4246 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1221 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Cooling device is registered by ready callback. It's also invoked while system resuming from sleep (Enabling non-boot cpus). Thus cooling device may be multiple registered. Matchable unregistration is added to exit callback to fix this issue. Signed-off-by: Jia Hongtao --- Changes for V2: * Using qoriq_cpufreq_cpu_exit() callback instead of adding stop_cpu(). drivers/cpufreq/qoriq-cpufreq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index b23e525..0b85f90 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -301,10 +301,11 @@ err_np: return -ENODEV; } -static int __exit qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy) +static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy) { struct cpu_data *data = policy->driver_data; + cpufreq_cooling_unregister(data->cdev); kfree(data->pclk); kfree(data->table); kfree(data); @@ -348,7 +349,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = { .name = "qoriq_cpufreq", .flags = CPUFREQ_CONST_LOOPS, .init = qoriq_cpufreq_cpu_init, - .exit = __exit_p(qoriq_cpufreq_cpu_exit), + .exit = qoriq_cpufreq_cpu_exit, .verify = cpufreq_generic_frequency_table_verify, .target_index = qoriq_cpufreq_target, .get = cpufreq_generic_get,