* [PATCH] cpufreq: SPEAr: Instantiate as platform_driver
@ 2014-03-10 10:13 Viresh Kumar
2014-03-11 1:04 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2014-03-10 10:13 UTC (permalink / raw)
To: rjw
Cc: linaro-kernel, cpufreq, linux-pm, linux-kernel, joshc,
robherring2, Viresh Kumar
As multiplatform build is being adopted by more and more ARM platforms, initcall
function should be used very carefully. For example, when SPEAr cpufreq driver
is enabled on a kernel booted on a non-SPEAr board, we will get following boot
time error:
spear_cpufreq: Invalid cpufreq_tbl
To eliminate this undesired the effect, the patch changes SPEAr driver to have
it instantiated as a platform_driver. Then it will only run on platforms that
create the platform_device "spear-cpufreq".
This patch also creates platform node for SPEAr13xx boards.
Reported-by: Josh Cartwright <joshc@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
arch/arm/mach-spear/spear1310.c | 1 +
arch/arm/mach-spear/spear1340.c | 1 +
drivers/cpufreq/spear-cpufreq.c | 13 +++++++++++--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 7ad0030..824b12a 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -28,6 +28,7 @@
static void __init spear1310_dt_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
}
static const char * const spear1310_dt_board_compat[] = {
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 3fb6834..7b6bff7 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table,
spear1340_auxdata_lookup, NULL);
+ platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
}
static const char * const spear1340_dt_board_compat[] = {
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index 410b54a..4cfdcff 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -19,6 +19,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/of_device.h>
+#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/types.h>
@@ -166,7 +167,7 @@ static struct cpufreq_driver spear_cpufreq_driver = {
.attr = cpufreq_generic_attr,
};
-static int spear_cpufreq_driver_init(void)
+static int spear_cpufreq_probe(struct platform_device *pdev)
{
struct device_node *np;
const struct property *prop;
@@ -234,7 +235,15 @@ out_put_node:
of_node_put(np);
return ret;
}
-late_initcall(spear_cpufreq_driver_init);
+
+static struct platform_driver spear_cpufreq_platdrv = {
+ .driver = {
+ .name = "spear-cpufreq",
+ .owner = THIS_MODULE,
+ },
+ .probe = spear_cpufreq_probe,
+};
+module_platform_driver(spear_cpufreq_platdrv);
MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>");
MODULE_DESCRIPTION("SPEAr CPUFreq driver");
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: SPEAr: Instantiate as platform_driver
2014-03-10 10:13 [PATCH] cpufreq: SPEAr: Instantiate as platform_driver Viresh Kumar
@ 2014-03-11 1:04 ` Rafael J. Wysocki
2014-03-11 3:46 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-03-11 1:04 UTC (permalink / raw)
To: Viresh Kumar
Cc: linaro-kernel, cpufreq, linux-pm, linux-kernel, joshc, robherring2
On Monday, March 10, 2014 03:43:18 PM Viresh Kumar wrote:
> As multiplatform build is being adopted by more and more ARM platforms, initcall
> function should be used very carefully. For example, when SPEAr cpufreq driver
> is enabled on a kernel booted on a non-SPEAr board, we will get following boot
> time error:
>
> spear_cpufreq: Invalid cpufreq_tbl
>
> To eliminate this undesired the effect, the patch changes SPEAr driver to have
> it instantiated as a platform_driver. Then it will only run on platforms that
> create the platform_device "spear-cpufreq".
>
> This patch also creates platform node for SPEAr13xx boards.
>
> Reported-by: Josh Cartwright <joshc@codeaurora.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Whoever maintains the SPEAr platform, I need an ACK from that person in order
to take this patch.
> ---
> arch/arm/mach-spear/spear1310.c | 1 +
> arch/arm/mach-spear/spear1340.c | 1 +
> drivers/cpufreq/spear-cpufreq.c | 13 +++++++++++--
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
> index 7ad0030..824b12a 100644
> --- a/arch/arm/mach-spear/spear1310.c
> +++ b/arch/arm/mach-spear/spear1310.c
> @@ -28,6 +28,7 @@
> static void __init spear1310_dt_init(void)
> {
> of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> + platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
> }
>
> static const char * const spear1310_dt_board_compat[] = {
> diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
> index 3fb6834..7b6bff7 100644
> --- a/arch/arm/mach-spear/spear1340.c
> +++ b/arch/arm/mach-spear/spear1340.c
> @@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void)
> {
> of_platform_populate(NULL, of_default_bus_match_table,
> spear1340_auxdata_lookup, NULL);
> + platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
> }
>
> static const char * const spear1340_dt_board_compat[] = {
> diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
> index 410b54a..4cfdcff 100644
> --- a/drivers/cpufreq/spear-cpufreq.c
> +++ b/drivers/cpufreq/spear-cpufreq.c
> @@ -19,6 +19,7 @@
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/of_device.h>
> +#include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/types.h>
>
> @@ -166,7 +167,7 @@ static struct cpufreq_driver spear_cpufreq_driver = {
> .attr = cpufreq_generic_attr,
> };
>
> -static int spear_cpufreq_driver_init(void)
> +static int spear_cpufreq_probe(struct platform_device *pdev)
> {
> struct device_node *np;
> const struct property *prop;
> @@ -234,7 +235,15 @@ out_put_node:
> of_node_put(np);
> return ret;
> }
> -late_initcall(spear_cpufreq_driver_init);
> +
> +static struct platform_driver spear_cpufreq_platdrv = {
> + .driver = {
> + .name = "spear-cpufreq",
> + .owner = THIS_MODULE,
> + },
> + .probe = spear_cpufreq_probe,
> +};
> +module_platform_driver(spear_cpufreq_platdrv);
>
> MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>");
> MODULE_DESCRIPTION("SPEAr CPUFreq driver");
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: SPEAr: Instantiate as platform_driver
2014-03-11 1:04 ` Rafael J. Wysocki
@ 2014-03-11 3:46 ` Viresh Kumar
2014-03-11 12:44 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2014-03-11 3:46 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Lists linaro-kernel, cpufreq, linux-pm,
Linux Kernel Mailing List, Josh Cartwright, Rob Herring
On 11 March 2014 09:04, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, March 10, 2014 03:43:18 PM Viresh Kumar wrote:
>> As multiplatform build is being adopted by more and more ARM platforms, initcall
>> function should be used very carefully. For example, when SPEAr cpufreq driver
>> is enabled on a kernel booted on a non-SPEAr board, we will get following boot
>> time error:
>>
>> spear_cpufreq: Invalid cpufreq_tbl
>>
>> To eliminate this undesired the effect, the patch changes SPEAr driver to have
>> it instantiated as a platform_driver. Then it will only run on platforms that
>> create the platform_device "spear-cpufreq".
>>
>> This patch also creates platform node for SPEAr13xx boards.
>>
>> Reported-by: Josh Cartwright <joshc@codeaurora.org>
>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> Whoever maintains the SPEAr platform, I need an ACK from that person in order
> to take this patch.
Okay, here you go:
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
:)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: SPEAr: Instantiate as platform_driver
2014-03-11 3:46 ` Viresh Kumar
@ 2014-03-11 12:44 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-03-11 12:44 UTC (permalink / raw)
To: Viresh Kumar
Cc: Lists linaro-kernel, cpufreq, linux-pm,
Linux Kernel Mailing List, Josh Cartwright, Rob Herring
On Tuesday, March 11, 2014 11:46:22 AM Viresh Kumar wrote:
> On 11 March 2014 09:04, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > On Monday, March 10, 2014 03:43:18 PM Viresh Kumar wrote:
> >> As multiplatform build is being adopted by more and more ARM platforms, initcall
> >> function should be used very carefully. For example, when SPEAr cpufreq driver
> >> is enabled on a kernel booted on a non-SPEAr board, we will get following boot
> >> time error:
> >>
> >> spear_cpufreq: Invalid cpufreq_tbl
> >>
> >> To eliminate this undesired the effect, the patch changes SPEAr driver to have
> >> it instantiated as a platform_driver. Then it will only run on platforms that
> >> create the platform_device "spear-cpufreq".
> >>
> >> This patch also creates platform node for SPEAr13xx boards.
> >>
> >> Reported-by: Josh Cartwright <joshc@codeaurora.org>
> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> >
> > Whoever maintains the SPEAr platform, I need an ACK from that person in order
> > to take this patch.
>
> Okay, here you go:
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> :)
I see. OK
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-11 12:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 10:13 [PATCH] cpufreq: SPEAr: Instantiate as platform_driver Viresh Kumar
2014-03-11 1:04 ` Rafael J. Wysocki
2014-03-11 3:46 ` Viresh Kumar
2014-03-11 12:44 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.