From nobody Sat Apr 18 04:20:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2933DC433EF for ; Mon, 18 Jul 2022 22:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234500AbiGRWCn (ORCPT ); Mon, 18 Jul 2022 18:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233142AbiGRWCm (ORCPT ); Mon, 18 Jul 2022 18:02:42 -0400 X-Greylist: delayed 471 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Jul 2022 15:02:40 PDT Received: from mail.tpi.com (mail.tpi.com [50.126.108.186]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFFAF30578 for ; Mon, 18 Jul 2022 15:02:40 -0700 (PDT) Received: from sushi.tpi.com (sushi.tpi.com [10.0.0.212]) by mail.tpi.com (Postfix) with ESMTPA id E451347ECA5F; Mon, 18 Jul 2022 14:54:47 -0700 (PDT) From: Dean Gehnert Cc: Dean Gehnert , Russell King , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: imx6: suspend: Use the size of imx6_suspend() function for fncpy() Date: Mon, 18 Jul 2022 14:54:26 -0700 Message-Id: <20220718215426.21501-1-deang@tpi.com> X-Mailer: git-send-email 2.17.1 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Fixes: df595746fa69 ("ARM: imx: add suspend in ocram support for i.mx6q") Signed-off-by: Dean Gehnert --- 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(-) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 13f3068e9845..c73152786ead 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -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 =20 void v7_cpu_resume(void); diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 045b9fdd342d..d467ca05b95f 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -570,7 +570,7 @@ static int __init imx6q_suspend_init(const struct imx6_= pm_socdata *socdata) imx6_suspend_in_ocram_fn =3D fncpy( suspend_ocram_base + sizeof(*pm_info), &imx6_suspend, - MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info)); + imx6_suspend_sz); =20 __arm_iomem_set_ro(suspend_ocram_base, MX6Q_SUSPEND_OCRAM_SIZE); =20 diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-i= mx6.S index e06f946b75b9..ee19ac288a90 100644 --- a/arch/arm/mach-imx/suspend-imx6.S +++ b/arch/arm/mach-imx/suspend-imx6.S @@ -328,3 +328,6 @@ resume: =20 ret lr ENDPROC(imx6_suspend) + +ENTRY(imx6_suspend_sz) + .word . - imx6_suspend --=20 2.17.1