diff mbox

[2/8] cpufreq: imx: Use generic platdev driver

Message ID 08c7bf360dfb7620591c0e0de6e047fffb0a5546.1461228081.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar April 21, 2016, 8:43 a.m. UTC
The cpufreq-dt-platdev driver supports creation of cpufreq-dt platform
device now, reuse that and remove similar code from platform code.

Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-imx/imx27-dt.c         | 4 ----
 arch/arm/mach-imx/mach-imx51.c       | 3 ---
 arch/arm/mach-imx/mach-imx53.c       | 2 --
 arch/arm/mach-imx/mach-imx7d.c       | 6 ------
 drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
 5 files changed, 5 insertions(+), 15 deletions(-)

Comments

Lucas Stach April 21, 2016, 9:19 a.m. UTC | #1
Am Donnerstag, den 21.04.2016, 14:13 +0530 schrieb Viresh Kumar:
> The cpufreq-dt-platdev driver supports creation of cpufreq-dt platform
> device now, reuse that and remove similar code from platform code.
> 
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Looks good to me:

Acked-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  arch/arm/mach-imx/imx27-dt.c         | 4 ----
>  arch/arm/mach-imx/mach-imx51.c       | 3 ---
>  arch/arm/mach-imx/mach-imx53.c       | 2 --
>  arch/arm/mach-imx/mach-imx7d.c       | 6 ------
>  drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
>  5 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
> index bd42d1bd10af..90c62bf01f9e 100644
> --- a/arch/arm/mach-imx/imx27-dt.c
> +++ b/arch/arm/mach-imx/imx27-dt.c
> @@ -20,11 +20,7 @@
>  
>  static void __init imx27_dt_init(void)
>  {
> -	struct platform_device_info devinfo = { .name = "cpufreq-dt", };
> -
>  	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> -
> -	platform_device_register_full(&devinfo);
>  }
>  
>  static const char * const imx27_dt_board_compat[] __initconst = {
> diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c
> index 6883fbaf9484..10a82a4f1e58 100644
> --- a/arch/arm/mach-imx/mach-imx51.c
> +++ b/arch/arm/mach-imx/mach-imx51.c
> @@ -50,13 +50,10 @@ static void __init imx51_ipu_mipi_setup(void)
>  
>  static void __init imx51_dt_init(void)
>  {
> -	struct platform_device_info devinfo = { .name = "cpufreq-dt", };
> -
>  	imx51_ipu_mipi_setup();
>  	imx_src_init();
>  
>  	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> -	platform_device_register_full(&devinfo);
>  }
>  
>  static void __init imx51_init_late(void)
> diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
> index 86316a979297..18b5c5c136db 100644
> --- a/arch/arm/mach-imx/mach-imx53.c
> +++ b/arch/arm/mach-imx/mach-imx53.c
> @@ -40,8 +40,6 @@ static void __init imx53_dt_init(void)
>  static void __init imx53_init_late(void)
>  {
>  	imx53_pm_init();
> -
> -	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
>  }
>  
>  static const char * const imx53_dt_board_compat[] __initconst = {
> diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
> index 5a27f20c9a82..b450f525a670 100644
> --- a/arch/arm/mach-imx/mach-imx7d.c
> +++ b/arch/arm/mach-imx/mach-imx7d.c
> @@ -105,11 +105,6 @@ static void __init imx7d_init_irq(void)
>  	irqchip_init();
>  }
>  
> -static void __init imx7d_init_late(void)
> -{
> -	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
> -}
> -
>  static const char *const imx7d_dt_compat[] __initconst = {
>  	"fsl,imx7d",
>  	NULL,
> @@ -117,7 +112,6 @@ static const char *const imx7d_dt_compat[] __initconst = {
>  
>  DT_MACHINE_START(IMX7D, "Freescale i.MX7 Dual (Device Tree)")
>  	.init_irq	= imx7d_init_irq,
> -	.init_late	= imx7d_init_late,
>  	.init_machine	= imx7d_init_machine,
>  	.dt_compat	= imx7d_dt_compat,
>  MACHINE_END
> diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
> index 3b3e6804cf14..ac12c4a02964 100644
> --- a/drivers/cpufreq/cpufreq-dt-platdev.c
> +++ b/drivers/cpufreq/cpufreq-dt-platdev.c
> @@ -12,6 +12,11 @@
>  #include <linux/platform_device.h>
>  
>  static const struct of_device_id machines[] = {
> +	{ .compatible = "fsl,imx27", },
> +	{ .compatible = "fsl,imx51", },
> +	{ .compatible = "fsl,imx53", },
> +	{ .compatible = "fsl,imx7d", },
> +
>  	{ .compatible = "marvell,berlin", },
>  
>  	{ .compatible = "samsung,exynos3250", },
Arnd Bergmann April 21, 2016, 9:46 a.m. UTC | #2
On Thursday 21 April 2016 14:13:48 Viresh Kumar wrote:
> The cpufreq-dt-platdev driver supports creation of cpufreq-dt platform
> device now, reuse that and remove similar code from platform code.
> 
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  arch/arm/mach-imx/imx27-dt.c         | 4 ----
>  arch/arm/mach-imx/mach-imx51.c       | 3 ---
>  arch/arm/mach-imx/mach-imx53.c       | 2 --
>  arch/arm/mach-imx/mach-imx7d.c       | 6 ------
>  drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
>  5 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
> index bd42d1bd10af..90c62bf01f9e 100644
> --- a/arch/arm/mach-imx/imx27-dt.c
> +++ b/arch/arm/mach-imx/imx27-dt.c
> @@ -20,11 +20,7 @@
>  
>  static void __init imx27_dt_init(void)
>  {
> -	struct platform_device_info devinfo = { .name = "cpufreq-dt", };
> -
>  	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> -
> -	platform_device_register_full(&devinfo);
>  }
>

Please remove the entire function now, a NULL .init_machine machine
callback pointer has the same effect as the remaining line.

The rest of the patch is fine.

	Arnd
Viresh Kumar April 21, 2016, 9:50 a.m. UTC | #3
On 21-04-16, 11:46, Arnd Bergmann wrote:
> On Thursday 21 April 2016 14:13:48 Viresh Kumar wrote:
> > The cpufreq-dt-platdev driver supports creation of cpufreq-dt platform
> > device now, reuse that and remove similar code from platform code.
> > 
> > Cc: Shawn Guo <shawnguo@kernel.org>
> > Cc: Sascha Hauer <kernel@pengutronix.de>
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> >  arch/arm/mach-imx/imx27-dt.c         | 4 ----
> >  arch/arm/mach-imx/mach-imx51.c       | 3 ---
> >  arch/arm/mach-imx/mach-imx53.c       | 2 --
> >  arch/arm/mach-imx/mach-imx7d.c       | 6 ------
> >  drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
> >  5 files changed, 5 insertions(+), 15 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
> > index bd42d1bd10af..90c62bf01f9e 100644
> > --- a/arch/arm/mach-imx/imx27-dt.c
> > +++ b/arch/arm/mach-imx/imx27-dt.c
> > @@ -20,11 +20,7 @@
> >  
> >  static void __init imx27_dt_init(void)
> >  {
> > -	struct platform_device_info devinfo = { .name = "cpufreq-dt", };
> > -
> >  	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > -
> > -	platform_device_register_full(&devinfo);
> >  }
> >
> 
> Please remove the entire function now, a NULL .init_machine machine
> callback pointer has the same effect as the remaining line.
> 
> The rest of the patch is fine.

Perhaps that should be done in a separate patch I feel. Will do so after this is
merged.
Arnd Bergmann April 21, 2016, 10:17 a.m. UTC | #4
On Thursday 21 April 2016 15:20:32 Viresh Kumar wrote:
> > > diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
> > > index bd42d1bd10af..90c62bf01f9e 100644
> > > --- a/arch/arm/mach-imx/imx27-dt.c
> > > +++ b/arch/arm/mach-imx/imx27-dt.c
> > > @@ -20,11 +20,7 @@
> > >  
> > >  static void __init imx27_dt_init(void)
> > >  {
> > > -   struct platform_device_info devinfo = { .name = "cpufreq-dt", };
> > > -
> > >     of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > > -
> > > -   platform_device_register_full(&devinfo);
> > >  }
> > >
> > 
> > Please remove the entire function now, a NULL .init_machine machine
> > callback pointer has the same effect as the remaining line.
> > 
> > The rest of the patch is fine.
> 
> Perhaps that should be done in a separate patch I feel. Will do so after this is
> merged.
> 

I would do it in the same patch, just like you remove some of the
.init_late() callbacks elsewhere, but it clearly works either way, so
do as you like unless Shawn or Sascha have a strong opinion on the
matter.

	Arnd
diff mbox

Patch

diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index bd42d1bd10af..90c62bf01f9e 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -20,11 +20,7 @@ 
 
 static void __init imx27_dt_init(void)
 {
-	struct platform_device_info devinfo = { .name = "cpufreq-dt", };
-
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-
-	platform_device_register_full(&devinfo);
 }
 
 static const char * const imx27_dt_board_compat[] __initconst = {
diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c
index 6883fbaf9484..10a82a4f1e58 100644
--- a/arch/arm/mach-imx/mach-imx51.c
+++ b/arch/arm/mach-imx/mach-imx51.c
@@ -50,13 +50,10 @@  static void __init imx51_ipu_mipi_setup(void)
 
 static void __init imx51_dt_init(void)
 {
-	struct platform_device_info devinfo = { .name = "cpufreq-dt", };
-
 	imx51_ipu_mipi_setup();
 	imx_src_init();
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_full(&devinfo);
 }
 
 static void __init imx51_init_late(void)
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 86316a979297..18b5c5c136db 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -40,8 +40,6 @@  static void __init imx53_dt_init(void)
 static void __init imx53_init_late(void)
 {
 	imx53_pm_init();
-
-	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
 }
 
 static const char * const imx53_dt_board_compat[] __initconst = {
diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
index 5a27f20c9a82..b450f525a670 100644
--- a/arch/arm/mach-imx/mach-imx7d.c
+++ b/arch/arm/mach-imx/mach-imx7d.c
@@ -105,11 +105,6 @@  static void __init imx7d_init_irq(void)
 	irqchip_init();
 }
 
-static void __init imx7d_init_late(void)
-{
-	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
-}
-
 static const char *const imx7d_dt_compat[] __initconst = {
 	"fsl,imx7d",
 	NULL,
@@ -117,7 +112,6 @@  static const char *const imx7d_dt_compat[] __initconst = {
 
 DT_MACHINE_START(IMX7D, "Freescale i.MX7 Dual (Device Tree)")
 	.init_irq	= imx7d_init_irq,
-	.init_late	= imx7d_init_late,
 	.init_machine	= imx7d_init_machine,
 	.dt_compat	= imx7d_dt_compat,
 MACHINE_END
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 3b3e6804cf14..ac12c4a02964 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -12,6 +12,11 @@ 
 #include <linux/platform_device.h>
 
 static const struct of_device_id machines[] = {
+	{ .compatible = "fsl,imx27", },
+	{ .compatible = "fsl,imx51", },
+	{ .compatible = "fsl,imx53", },
+	{ .compatible = "fsl,imx7d", },
+
 	{ .compatible = "marvell,berlin", },
 
 	{ .compatible = "samsung,exynos3250", },