From patchwork Wed Jun 12 13:08:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 17826 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 668E923903 for ; Wed, 12 Jun 2013 13:08:57 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf11sf1797505vcb.10 for ; Wed, 12 Jun 2013 06:08:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=2l5r24l/Z2Vn5LF4eOc4lRE7HUlSXfUWwUkKtdT25RY=; b=QZhSu5hoR68ag/nt6+wpedPX6/gIE3INFGdi9bSju5OKFKH/hMeTu1e+qeN6sFo2h0 UHoo+3INbuS9+2U1SgsBtn/oGeyZQM/Bn3YBxtaBZp99G/m1TLSrMPcTo9qH1feXGNzk d1JxvchBQAh0sSoOZD0KJtxzw2mcccaLUU1w41qKfjIdui+gXGL6oheims3D+5NKq3BM KLpaFZXeN6fYi6DaMZB/5HhmVAVm/M7I7U/DFhF1cpXUcr7E6mo/+8OjZ0nVY8IR4Wj8 +rqM+FK52KFx9zc5fDyfUh/vWcjeXMgnR6BgcqUPRPl8tDyOjl/Us8sJMDt6zgTPxwpp qjBg== X-Received: by 10.236.135.66 with SMTP id t42mr11008431yhi.36.1371042536380; Wed, 12 Jun 2013 06:08:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.117.104 with SMTP id kd8ls3687156qeb.93.gmail; Wed, 12 Jun 2013 06:08:56 -0700 (PDT) X-Received: by 10.58.15.193 with SMTP id z1mr9754769vec.40.1371042536117; Wed, 12 Jun 2013 06:08:56 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id p8si8565679vdv.83.2013.06.12.06.08.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Jun 2013 06:08:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hf12so6214545vcb.15 for ; Wed, 12 Jun 2013 06:08:55 -0700 (PDT) X-Received: by 10.52.155.67 with SMTP id vu3mr8279117vdb.94.1371042535901; Wed, 12 Jun 2013 06:08:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp143380vec; Wed, 12 Jun 2013 06:08:55 -0700 (PDT) X-Received: by 10.180.83.166 with SMTP id r6mr59597wiy.60.1371042534574; Wed, 12 Jun 2013 06:08:54 -0700 (PDT) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [2a00:1450:400c:c03::22f]) by mx.google.com with ESMTPS id eq10si835888wib.86.2013.06.12.06.08.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Jun 2013 06:08:54 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c03::22f; Received: by mail-we0-f175.google.com with SMTP id t59so6981944wes.34 for ; Wed, 12 Jun 2013 06:08:54 -0700 (PDT) X-Received: by 10.180.101.170 with SMTP id fh10mr4200004wib.22.1371042534153; Wed, 12 Jun 2013 06:08:54 -0700 (PDT) Received: from mai.home (AToulouse-654-1-404-219.w82-125.abo.wanadoo.fr. [82.125.3.219]) by mx.google.com with ESMTPSA id x13sm24555864wib.3.2013.06.12.06.08.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Jun 2013 06:08:53 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Cc: linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, patches@linaro.org Subject: [PATCH 1/8] cpuidle: Remove governor module format Date: Wed, 12 Jun 2013 15:08:48 +0200 Message-Id: <1371042535-22630-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkcA9aS77ntDjyXPbQoKOwhenQ3twur1uIXztb1hG8LgAVC0dJPMk/p03CZTEOuXRNtsIH+ X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The governors are defined as module in the code, but the Kconfig options do not allow to compile them as module. This is not really a problem but the init order is: the cpuidle init functions (framework and driver) and then the governors. That leads to some weirdness in the cpuidle framework because the function cpuidle_register_device calls cpuidle_enable_device which in turns fails at the first attempt because no governor is registered. When the governor is registered, the framework calls cpuidle_enable_device again which will invoke the __cpuidle_register_device function. Of course, in order to make this to work, the return code of cpuidle_enable_device is not checked by the caller in cpuidle_register_device. Instead of having this cyclic call graph and relying on a positive side effect of the hackish back and forth call to cpuidle_enable_device, let's fix the init order for the governor in order to clean up the cpuidle_enable_device function. Remove the module init code and replaced it with postcore_initcall, so we have: * cpuidle framework : core_initcall * cpuidle governors : postcore_initcall * cpuidle drivers : device_initcall Remove exit module code as it is dead code (governors aren't compiled as module). Signed-off-by: Daniel Lezcano --- drivers/cpuidle/governors/ladder.c | 12 +----------- drivers/cpuidle/governors/menu.c | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 9b78405..9f08e8c 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -192,14 +192,4 @@ static int __init init_ladder(void) return cpuidle_register_governor(&ladder_governor); } -/** - * exit_ladder - exits the governor - */ -static void __exit exit_ladder(void) -{ - cpuidle_unregister_governor(&ladder_governor); -} - -MODULE_LICENSE("GPL"); -module_init(init_ladder); -module_exit(exit_ladder); +postcore_initcall(init_ladder); diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index fe343a0..743138c 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -540,14 +540,4 @@ static int __init init_menu(void) return cpuidle_register_governor(&menu_governor); } -/** - * exit_menu - exits the governor - */ -static void __exit exit_menu(void) -{ - cpuidle_unregister_governor(&menu_governor); -} - -MODULE_LICENSE("GPL"); -module_init(init_menu); -module_exit(exit_menu); +postcore_initcall(init_menu);