From patchwork Tue Jul 30 06:55:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Wang X-Patchwork-Id: 263206 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 3882B2C0168 for ; Tue, 30 Jul 2013 17:48:24 +1000 (EST) Received: from ch1outboundpool.messaging.microsoft.com (ch1ehsobe003.messaging.microsoft.com [216.32.181.183]) (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 9A9612C00A7 for ; Tue, 30 Jul 2013 17:47:52 +1000 (EST) Received: from mail39-ch1-R.bigfish.com (10.43.68.232) by CH1EHSOBE001.bigfish.com (10.43.70.51) with Microsoft SMTP Server id 14.1.225.22; Tue, 30 Jul 2013 07:47:47 +0000 Received: from mail39-ch1 (localhost [127.0.0.1]) by mail39-ch1-R.bigfish.com (Postfix) with ESMTP id 25D314E0182; Tue, 30 Jul 2013 07:47:47 +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(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1155h) Received: from mail39-ch1 (localhost.localdomain [127.0.0.1]) by mail39-ch1 (MessageSwitch) id 1375170465490082_13009; Tue, 30 Jul 2013 07:47:45 +0000 (UTC) Received: from CH1EHSMHS013.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.230]) by mail39-ch1.bigfish.com (Postfix) with ESMTP id 727291A004C; Tue, 30 Jul 2013 07:47:45 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS013.bigfish.com (10.43.70.13) with Microsoft SMTP Server (TLS) id 14.16.227.3; Tue, 30 Jul 2013 07:47:44 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.136.1; Tue, 30 Jul 2013 07:47:42 +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 r6U7lZ8p005634; Tue, 30 Jul 2013 00:47:39 -0700 From: Dongsheng Wang To: , Subject: [PATCH] cpuidle: fix unremovable issue for module driver Date: Tue, 30 Jul 2013 14:55:19 +0800 Message-ID: <1375167319-12821-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: 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 After __cpuidle_register_device, the cpu incs are added up, but decs are not, thus the module refcount is not match. So the module "exit" function can not be executed when we do remove operation. Move module_put into __cpuidle_register_device to fix it. Signed-off-by: Wang Dongsheng diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index d75040d..e964ada 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -351,11 +351,8 @@ EXPORT_SYMBOL_GPL(cpuidle_disable_device); static void __cpuidle_unregister_device(struct cpuidle_device *dev) { - struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); - list_del(&dev->device_list); per_cpu(cpuidle_devices, dev->cpu) = NULL; - module_put(drv->owner); } static int __cpuidle_device_init(struct cpuidle_device *dev) @@ -384,6 +381,8 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) per_cpu(cpuidle_devices, dev->cpu) = dev; list_add(&dev->device_list, &cpuidle_detected_devices); + module_put(drv->owner); + ret = cpuidle_coupled_register_device(dev); if (ret) { __cpuidle_unregister_device(dev);