linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: paul.gortmaker@windriver.com (Paul Gortmaker)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 28/73] cpuidle: don't use modular platform register in non-modular ARM drivers
Date: Tue, 21 Jan 2014 16:22:31 -0500	[thread overview]
Message-ID: <1390339396-3479-29-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1390339396-3479-1-git-send-email-paul.gortmaker@windriver.com>

These two drivers are configured with Kconfig options that are
both declared as bool.  Hence it is not possible for the code
to be built as modular.  However the code is currently using the
module_platform_driver() macro for driver registration.

While this currently works, we really don't want to be including
the module.h header in non-modular code, which we'll be forced
to do, pending some upcoming code relocation from init.h into
module.h.  So we fix it now by using the non-modular equivalent.

With some macro detangulation, and a little help from cpp, we can
see that module_platform_driver(calxeda_cpuidle_plat_driver) gets
roughly translated into:

  static int __init calxeda_cpuidle_plat_driver_init(void)
  {
        return platform_driver_register(&calxeda_cpuidle_plat_driver);
  }
  module_init(calxeda_cpuidle_plat_driver_init);

  static void __exit calxeda_cpuidle_plat_driver_exit(void)
  {
        platform_driver_unregister(&calxeda_cpuidle_plat_driver);
  }
  module_exit(calxeda_cpuidle_plat_driver_exit);

[and similarly for the other file, cpuidle-zynq.c]

And since we've already established that the code is non-modular,
we can completely drop any code relating to module_exit.  For non
modular code, module_init beomes __initcall.  But direct use of
__initcall is discouraged, vs. one of the priority categorized
subgroups.  As __initcall gets mapped onto device_initcall, our
use of device_initcall directly in this change means that the
runtime impact is zero -- they will remain at level 6 in the
initcall ordering.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: linux-pm at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/cpuidle/cpuidle-calxeda.c | 6 +++++-
 drivers/cpuidle/cpuidle-zynq.c    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index 6e51114..631e2cd 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -78,4 +78,8 @@ static struct platform_driver calxeda_cpuidle_plat_driver = {
         .probe = calxeda_cpuidle_probe,
 };
 
-module_platform_driver(calxeda_cpuidle_plat_driver);
+static int __init calxeda_cpuidle_plat_driver_init(void)
+{
+	return platform_driver_register(&calxeda_cpuidle_plat_driver);
+}
+device_initcall(calxeda_cpuidle_plat_driver_init);
diff --git a/drivers/cpuidle/cpuidle-zynq.c b/drivers/cpuidle/cpuidle-zynq.c
index aded759..a1aae51 100644
--- a/drivers/cpuidle/cpuidle-zynq.c
+++ b/drivers/cpuidle/cpuidle-zynq.c
@@ -85,4 +85,8 @@ static struct platform_driver zynq_cpuidle_driver = {
 	.probe = zynq_cpuidle_probe,
 };
 
-module_platform_driver(zynq_cpuidle_driver);
+static int __init zynq_cpuidle_driver_init(void)
+{
+	return platform_driver_register(&zynq_cpuidle_driver);
+}
+device_initcall(zynq_cpuidle_driver_init);
-- 
1.8.4.1

  parent reply	other threads:[~2014-01-21 21:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 21:22 [PATCH RFC 00/73] tree-wide: clean up some no longer required #include <linux/init.h> Paul Gortmaker
2014-01-21 21:22 ` [PATCH 16/73] arm: include module.h in drivers/bus/omap_l3_smx.c Paul Gortmaker
2014-01-21 21:22 ` [PATCH 17/73] arm: fix implicit module.h use in mach-at91 gpio.h Paul Gortmaker
2014-01-21 21:22 ` [PATCH 18/73] arm: fix implicit #include <linux/init.h> in entry asm Paul Gortmaker
2014-01-21 21:22 ` [PATCH 19/73] arm: mach-s3c64xx mach-crag6410-module.c is not modular Paul Gortmaker
2014-01-23 13:16   ` Charles Keepax
2014-02-15 17:04     ` Kukjin Kim
2014-01-21 21:22 ` [PATCH 20/73] arm: use subsys_initcall in non-modular pl320 IPC code Paul Gortmaker
2014-01-21 21:44   ` Arnd Bergmann
2014-01-21 22:19     ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 21/73] arm: don't use module_init in non-modular mach-vexpress/spc.c code Paul Gortmaker
2014-01-21 21:22 ` [PATCH 27/73] drivers/clk: don't use module_init in clk-nomadik.c which is non-modular Paul Gortmaker
2014-01-31 23:17   ` Mike Turquette
2014-01-21 21:22 ` Paul Gortmaker [this message]
2014-01-21 21:22 ` [PATCH 33/73] arm: delete non-required instances of include <linux/init.h> Paul Gortmaker
2014-01-22  7:00 ` [PATCH RFC 00/73] tree-wide: clean up some no longer required #include <linux/init.h> Stephen Rothwell
2014-01-23  0:38   ` Paul Gortmaker
2014-01-28  3:13     ` Benjamin Herrenschmidt
2014-01-28 16:21       ` Paul Gortmaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390339396-3479-29-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).