From patchwork Tue Jul 23 09:28:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Wang X-Patchwork-Id: 261032 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 3FA5C2C01C5 for ; Tue, 23 Jul 2013 20:20:11 +1000 (EST) Received: from co1outboundpool.messaging.microsoft.com (co1ehsobe003.messaging.microsoft.com [216.32.180.186]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "MSIT Machine Auth CA 2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D3A232C0096 for ; Tue, 23 Jul 2013 20:19:40 +1000 (EST) Received: from mail145-co1-R.bigfish.com (10.243.78.233) by CO1EHSOBE034.bigfish.com (10.243.66.99) with Microsoft SMTP Server id 14.1.225.22; Tue, 23 Jul 2013 10:19:35 +0000 Received: from mail145-co1 (localhost [127.0.0.1]) by mail145-co1-R.bigfish.com (Postfix) with ESMTP id EB74ED402C6; Tue, 23 Jul 2013 10:19:34 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h1de097h8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1155h) Received: from mail145-co1 (localhost.localdomain [127.0.0.1]) by mail145-co1 (MessageSwitch) id 1374574772236163_17307; Tue, 23 Jul 2013 10:19:32 +0000 (UTC) Received: from CO1EHSMHS012.bigfish.com (unknown [10.243.78.237]) by mail145-co1.bigfish.com (Postfix) with ESMTP id 35EF874004A; Tue, 23 Jul 2013 10:19:32 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS012.bigfish.com (10.243.66.22) with Microsoft SMTP Server (TLS) id 14.16.227.3; Tue, 23 Jul 2013 10:19:31 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.3.136.1; Tue, 23 Jul 2013 10:19:30 +0000 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r6NAJLGt024080; Tue, 23 Jul 2013 03:19:22 -0700 From: Dongsheng Wang To: Subject: [PATCH 1/2] cpuidle: fix cpu idle driver as a module can not remove Date: Tue, 23 Jul 2013 17:28:00 +0800 Message-ID: <1374571681-31911-1-git-send-email-dongsheng.wang@freescale.com> X-Mailer: git-send-email 1.8.0 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: rjw@sisk.pl, linuxppc-dev@lists.ozlabs.org, Wang Dongsheng , linux-pm@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Wang Dongsheng The module can not be removed when execute "rmmod". rmmod not use "--force". Log: root:~# rmmod cpuidle-e500 incs[9], decs[1] rmmod: can't unload 'cpuidle_e500': Resource temporarily unavailable Signed-off-by: Wang Dongsheng --- Branch: pm-cpuidle drivers/cpuidle/cpuidle.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index fdc432f..534320a 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -386,6 +386,9 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) goto err_coupled; dev->registered = 1; + + module_put(drv->owner); + return 0; err_coupled: @@ -432,8 +435,6 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device); */ void cpuidle_unregister_device(struct cpuidle_device *dev) { - struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); - if (dev->registered == 0) return; @@ -448,8 +449,6 @@ void cpuidle_unregister_device(struct cpuidle_device *dev) cpuidle_coupled_unregister_device(dev); cpuidle_resume_and_unlock(); - - module_put(drv->owner); } EXPORT_SYMBOL_GPL(cpuidle_unregister_device);