From patchwork Wed May 29 17:43:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 17271 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B279C25D81 for ; Wed, 29 May 2013 17:43:41 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r13sf10407570ghr.9 for ; Wed, 29 May 2013 10:43:41 -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=TXflOzaDZZNTDG5qg4xWFR3wFGzC6TWUyVrVAkM/1aw=; b=NhDPe//Mt1HynxIWtzHYpsYdpRtHVs7Fg1EIRAp0ffKMKAd+Oy62BebciPqvabmYgs Hn1Y6opl8BoTKk3nrIs7gsSH9/vw7GAt65o9xD5FJhhRAUJW9GqTgPWiWTeAzmRJ0R4k c95wBp3KxqXZ4vaJuCY/PkkTgyZN5x6p1kXYD4BXZprHQuhy/PvcF0rPdcbz6ojnO3zO D+qwZN73Nqsa+sJdcxhaBjWDNE0tYrXODx7/2hdlyoOk/14Mf0GXTVKMObZ1ktKn+m36 nKlWss89zOdbVWD8BG6ZiY1Ueogf6Yga2CoGOHC3dKZjksXHE5tN785h/SLHWJ6RWyHM BM6w== X-Received: by 10.236.143.101 with SMTP id k65mr1846085yhj.45.1369849421091; Wed, 29 May 2013 10:43:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.1 with SMTP id g1ls1207507qew.95.gmail; Wed, 29 May 2013 10:43:40 -0700 (PDT) X-Received: by 10.220.228.74 with SMTP id jd10mr2270090vcb.65.1369849420919; Wed, 29 May 2013 10:43:40 -0700 (PDT) Received: from mail-ve0-x230.google.com (mail-ve0-x230.google.com [2607:f8b0:400c:c01::230]) by mx.google.com with ESMTPS id ad7si22236634vdc.81.2013.05.29.10.43.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 10:43:40 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::230; Received: by mail-ve0-f176.google.com with SMTP id c13so1793887vea.21 for ; Wed, 29 May 2013 10:43:40 -0700 (PDT) X-Received: by 10.52.163.207 with SMTP id yk15mr1970838vdb.42.1369849420445; Wed, 29 May 2013 10:43:40 -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.220.229.199 with SMTP id jj7csp22127vcb; Wed, 29 May 2013 10:43:39 -0700 (PDT) X-Received: by 10.14.98.194 with SMTP id v42mr5125687eef.61.1369849419117; Wed, 29 May 2013 10:43:39 -0700 (PDT) Received: from mail-we0-x22c.google.com (mail-we0-x22c.google.com [2a00:1450:400c:c03::22c]) by mx.google.com with ESMTPS id b45si21609685eef.121.2013.05.29.10.43.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 10:43:39 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22c is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c03::22c; Received: by mail-we0-f172.google.com with SMTP id w62so6687854wes.3 for ; Wed, 29 May 2013 10:43:37 -0700 (PDT) X-Received: by 10.181.13.74 with SMTP id ew10mr2110638wid.9.1369849417313; Wed, 29 May 2013 10:43:37 -0700 (PDT) Received: from mai.home (AToulouse-654-1-324-164.w86-199.abo.wanadoo.fr. [86.199.211.164]) by mx.google.com with ESMTPSA id cw8sm32657116wib.7.2013.05.29.10.43.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 10:43:36 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Cc: linux-pm@lists.linux-foundation.org, patches@linaro.org, linaro-kernel@lists.linaro.org Subject: [PATCH 1/7] cpuidle: remove governor module format Date: Wed, 29 May 2013 19:43:28 +0200 Message-Id: <1369849414-7761-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkVvV5olvyi3PMLwJqrz9m9KBFJSi0BlmC6DbRHpaaxepE97H8po2yAyBzmNhyOKoWQ/R8F X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::230 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 change the init order for the governor in order to clean up the cpuidle_enable_device function. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/Makefile | 2 +- drivers/cpuidle/governors/ladder.c | 14 ++------------ drivers/cpuidle/governors/menu.c | 14 ++------------ 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 0d8bd55..05e2035 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -2,7 +2,7 @@ # Makefile for cpuidle. # -obj-y += cpuidle.o driver.o governor.o sysfs.o governors/ +obj-y += governors/ cpuidle.o driver.o governor.o sysfs.o obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 9b78405..928dc59 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -187,19 +187,9 @@ static struct cpuidle_governor ladder_governor = { /** * init_ladder - initializes the governor */ -static int __init init_ladder(void) +static int __init ladder_init(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); +core_initcall(ladder_init); diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index fe343a0..483bac1 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -535,19 +535,9 @@ static struct cpuidle_governor menu_governor = { /** * init_menu - initializes the governor */ -static int __init init_menu(void) +static int __init menu_init(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); +core_initcall(menu_init);