diff mbox series

[v2] ARM: tango: Improve ARCH_MULTIPLATFORM compatibility

Message ID 48e3596f-4c76-8481-5cd4-5e8e79d31a09@free.fr (mailing list archive)
State Mainlined, archived
Commit d0f9f16788e15d9eb40f68b047732d49658c5a3a
Headers show
Series [v2] ARM: tango: Improve ARCH_MULTIPLATFORM compatibility | expand

Commit Message

Marc Gonzalez Jan. 16, 2019, 3:49 p.m. UTC
Calling platform-specific code unconditionally blows up when running
an ARCH_MULTIPLATFORM kernel on a different platform. Don't do it.

Reported-by: Paolo Pisati <p.pisati@gmail.com>
Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
---
v1 was Paolo's patch: https://patchwork.kernel.org/patch/10573007/
Paolo: Sorry for procrastinating with your patch.
---
 arch/arm/mach-tango/pm.c    | 6 ++----
 arch/arm/mach-tango/pm.h    | 7 +++++++
 arch/arm/mach-tango/setup.c | 2 ++
 3 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-tango/pm.h

Comments

Pavel Machek Jan. 16, 2019, 10:05 p.m. UTC | #1
On Wed 2019-01-16 16:49:58, Marc Gonzalez wrote:
> Calling platform-specific code unconditionally blows up when running
> an ARCH_MULTIPLATFORM kernel on a different platform. Don't do it.
> 
> Reported-by: Paolo Pisati <p.pisati@gmail.com>
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>

Acked-by: Pavel Machek <pavel@ucw.cz>

> @@ -0,0 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifdef CONFIG_SUSPEND
> +void __init tango_pm_init(void);
> +#else
> +#define tango_pm_init NULL
> +#endif
> diff --git a/arch/arm/mach-tango/setup.c b/arch/arm/mach-tango/setup.c
> index 677dd7b5efd9..824f90737b04 100644
> --- a/arch/arm/mach-tango/setup.c
> +++ b/arch/arm/mach-tango/setup.c
> @@ -2,6 +2,7 @@
>  #include <asm/mach/arch.h>
>  #include <asm/hardware/cache-l2x0.h>
>  #include "smc.h"
> +#include "pm.h"
>  
>  static void tango_l2c_write(unsigned long val, unsigned int reg)
>  {
> @@ -15,4 +16,5 @@ DT_MACHINE_START(TANGO_DT, "Sigma Tango DT")
>  	.dt_compat	= tango_dt_compat,
>  	.l2c_aux_mask	= ~0,
>  	.l2c_write_sec	= tango_l2c_write,
> +	.init_late	= tango_pm_init,
>  MACHINE_END
Arnd Bergmann Jan. 30, 2019, 10:47 a.m. UTC | #2
On Wed, Jan 16, 2019 at 11:05 PM Pavel Machek <pavel@ucw.cz> wrote:
>
> On Wed 2019-01-16 16:49:58, Marc Gonzalez wrote:
> > Calling platform-specific code unconditionally blows up when running
> > an ARCH_MULTIPLATFORM kernel on a different platform. Don't do it.
> >
> > Reported-by: Paolo Pisati <p.pisati@gmail.com>
> > Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
>
> Acked-by: Pavel Machek <pavel@ucw.cz>

Applied to fixes branch, and marked cc:stable for backports to 4.9, 4.14,
4.19 and 4.20.

Thanks!

    Arnd
diff mbox series

Patch

diff --git a/arch/arm/mach-tango/pm.c b/arch/arm/mach-tango/pm.c
index 028e50c6383f..a32c3b631484 100644
--- a/arch/arm/mach-tango/pm.c
+++ b/arch/arm/mach-tango/pm.c
@@ -3,6 +3,7 @@ 
 #include <linux/suspend.h>
 #include <asm/suspend.h>
 #include "smc.h"
+#include "pm.h"
 
 static int tango_pm_powerdown(unsigned long arg)
 {
@@ -24,10 +25,7 @@  static const struct platform_suspend_ops tango_pm_ops = {
 	.valid = suspend_valid_only_mem,
 };
 
-static int __init tango_pm_init(void)
+void __init tango_pm_init(void)
 {
 	suspend_set_ops(&tango_pm_ops);
-	return 0;
 }
-
-late_initcall(tango_pm_init);
diff --git a/arch/arm/mach-tango/pm.h b/arch/arm/mach-tango/pm.h
new file mode 100644
index 000000000000..35ea705a0ee2
--- /dev/null
+++ b/arch/arm/mach-tango/pm.h
@@ -0,0 +1,7 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_SUSPEND
+void __init tango_pm_init(void);
+#else
+#define tango_pm_init NULL
+#endif
diff --git a/arch/arm/mach-tango/setup.c b/arch/arm/mach-tango/setup.c
index 677dd7b5efd9..824f90737b04 100644
--- a/arch/arm/mach-tango/setup.c
+++ b/arch/arm/mach-tango/setup.c
@@ -2,6 +2,7 @@ 
 #include <asm/mach/arch.h>
 #include <asm/hardware/cache-l2x0.h>
 #include "smc.h"
+#include "pm.h"
 
 static void tango_l2c_write(unsigned long val, unsigned int reg)
 {
@@ -15,4 +16,5 @@  DT_MACHINE_START(TANGO_DT, "Sigma Tango DT")
 	.dt_compat	= tango_dt_compat,
 	.l2c_aux_mask	= ~0,
 	.l2c_write_sec	= tango_l2c_write,
+	.init_late	= tango_pm_init,
 MACHINE_END