public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-kernel@vger.kernel.org,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] cpuidle: don't use modular platform register in non-modular ARM drivers
Date: Fri, 17 Jan 2014 02:18:38 +0100	[thread overview]
Message-ID: <3872763.be1TKi9G4j@vostro.rjw.lan> (raw)
In-Reply-To: <1389910767-4040-1-git-send-email-paul.gortmaker@windriver.com>

On Thursday, January 16, 2014 05:19:27 PM Paul Gortmaker wrote:
> 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@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

I'd appreciate some ACKs from the ARM people.

Thanks!

> diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
> index 6e51114057d0..631e2cd9bce6 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 aded75928028..a1aae519a573 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);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2014-01-17  1:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 22:19 [PATCH] cpuidle: don't use modular platform register in non-modular ARM drivers Paul Gortmaker
2014-01-17  1:18 ` Rafael J. Wysocki [this message]

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=3872763.be1TKi9G4j@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=paul.gortmaker@windriver.com \
    /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