Skip to contentSkip to conversation

ARM: imx6: suspend: Use the size of imx6_suspend() function for fncpy()

PATCH New Dean Gehnert 1 participant 1 message Jul 18, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx6: suspend: Use the size of imx6_suspend() function for fncpy()

Use the size of the imx6_suspend() function for fncpy() instead of the hard coded size of 'MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info)'. Only need to copy the size of the imx6_suspend() function and not extra code space beyond the function.

Cc Russell King <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Pengutronix Kernel Team <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc NXP Linux Team <[email protected]>
Fixes df595746fa69 ("ARM: imx: add suspend in ocram support for i.mx6q")
---
 arch/arm/mach-imx/common.h       | 2 ++
 arch/arm/mach-imx/pm-imx6.c      | 2 +-
 arch/arm/mach-imx/suspend-imx6.S | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-imx/common.h +2 -0
index 13f3068e9845..c73152786ead 100644
@@ -96,10 +96,12 @@ int imx_cpu_kill(unsigned int cpu);
 void imx53_suspend(void __iomem *ocram_vbase);
 extern const u32 imx53_suspend_sz;
 void imx6_suspend(void __iomem *ocram_vbase);
+extern const u32 imx6_suspend_sz;
 #else
 static inline void imx53_suspend(void __iomem *ocram_vbase) {}
 static const u32 imx53_suspend_sz;
 static inline void imx6_suspend(void __iomem *ocram_vbase) {}
+static const u32 imx6_suspend_sz;
 #endif
 
 void v7_cpu_resume(void);
arch/arm/mach-imx/pm-imx6.c +1 -1
index 045b9fdd342d..d467ca05b95f 100644
@@ -570,7 +570,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
 	imx6_suspend_in_ocram_fn = fncpy(
 		suspend_ocram_base + sizeof(*pm_info),
 		&imx6_suspend,
-		MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info));
+		imx6_suspend_sz);
 
 	__arm_iomem_set_ro(suspend_ocram_base, MX6Q_SUSPEND_OCRAM_SIZE);
 
arch/arm/mach-imx/suspend-imx6.S +3 -0
index e06f946b75b9..ee19ac288a90 100644
@@ -328,3 +328,6 @@ resume:
 
 	ret	lr
 ENDPROC(imx6_suspend)
+
+ENTRY(imx6_suspend_sz)
+        .word   . - imx6_suspend
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel