diff mbox series

[2/4] ARM: at91: pm: move "atmel.pm_modes" parsing into a common file

Message ID 20220222150846.255307-3-clement.leger@bootlin.com (mailing list archive)
State New, archived
Headers show
Series ARM: at91: add support for secure suspend on sama5d2 | expand

Commit Message

Clément Léger Feb. 22, 2022, 3:08 p.m. UTC
In order to add secure suspend support, split out code that will be
reused to parse the boot argument "atmel.pm_modes".

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 arch/arm/mach-at91/Makefile    |  2 +-
 arch/arm/mach-at91/pm.c        | 31 ++-------------------------
 arch/arm/mach-at91/pm.h        |  7 ++++++
 arch/arm/mach-at91/pm_common.c | 39 ++++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/mach-at91/pm_common.c

Comments

kernel test robot Feb. 22, 2022, 11:41 p.m. UTC | #1
Hi "Clément,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on soc/for-next]
[also build test WARNING on arm/for-next abelloni/rtc-next linus/master v5.17-rc5 next-20220217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Cl-ment-L-ger/ARM-at91-add-support-for-secure-suspend-on-sama5d2/20220222-231305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
config: arm-multi_v4t_defconfig (https://download.01.org/0day-ci/archive/20220223/202202230722.7V2NTBn5-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/2f5afeeacfd5e7985d4ef768c9a3f2b430fe3fa3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Cl-ment-L-ger/ARM-at91-add-support-for-secure-suspend-on-sama5d2/20220222-231305
        git checkout 2f5afeeacfd5e7985d4ef768c9a3f2b430fe3fa3
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> WARNING: modpost: vmlinux.o(.text+0xb79c): Section mismatch in reference from the function at91_pm_common_modes_select() to the (unknown reference) .init.rodata:(unknown)
The function at91_pm_common_modes_select() references
the (unknown reference) __initconst (unknown).
This is often because at91_pm_common_modes_select lacks a __initconst
annotation or the annotation of (unknown) is wrong.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 0dcc37180588..23620ccf7ab6 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -12,7 +12,7 @@  obj-$(CONFIG_SOC_SAMA7)		+= sama7.o
 obj-$(CONFIG_SOC_SAMV7)		+= samv7.o
 
 # Power Management
-obj-$(CONFIG_ATMEL_PM)		+= pm.o pm_suspend.o
+obj-$(CONFIG_ATMEL_PM)		+= pm.o pm_suspend.o pm_common.o
 
 ifeq ($(CONFIG_CPU_V7),y)
 AFLAGS_pm_suspend.o := -march=armv7-a
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index dd6f4ce3f766..b575304ccf63 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -99,15 +99,6 @@  static struct at91_soc_pm soc_pm = {
 	},
 };
 
-static const match_table_t pm_modes __initconst = {
-	{ AT91_PM_STANDBY,	"standby" },
-	{ AT91_PM_ULP0,		"ulp0" },
-	{ AT91_PM_ULP0_FAST,    "ulp0-fast" },
-	{ AT91_PM_ULP1,		"ulp1" },
-	{ AT91_PM_BACKUP,	"backup" },
-	{ -1, NULL },
-};
-
 #define at91_ramc_read(id, field) \
 	__raw_readl(soc_pm.data.ramc[id] + field)
 
@@ -1243,25 +1234,7 @@  void __init sama7_pm_init(void)
 
 static int __init at91_pm_modes_select(char *str)
 {
-	char *s;
-	substring_t args[MAX_OPT_ARGS];
-	int standby, suspend;
-
-	if (!str)
-		return 0;
-
-	s = strsep(&str, ",");
-	standby = match_token(s, pm_modes, args);
-	if (standby < 0)
-		return 0;
-
-	suspend = match_token(str, pm_modes, args);
-	if (suspend < 0)
-		return 0;
-
-	soc_pm.data.standby_mode = standby;
-	soc_pm.data.suspend_mode = suspend;
-
-	return 0;
+	return at91_pm_common_modes_select(str, &soc_pm.data.standby_mode,
+					   &soc_pm.data.suspend_mode);
 }
 early_param("atmel.pm_modes", at91_pm_modes_select);
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 53bdc9000e44..e9f7f9841afd 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -40,6 +40,13 @@  struct at91_pm_data {
 	unsigned int pmc_mckr_offset;
 	unsigned int pmc_version;
 };
+
+#include <linux/parser.h>
+
+extern const match_table_t pm_modes;
+
+int at91_pm_common_modes_select(char *str, int *standby_mode, int *suspend_mode);
+
 #endif
 
 #endif
diff --git a/arch/arm/mach-at91/pm_common.c b/arch/arm/mach-at91/pm_common.c
new file mode 100644
index 000000000000..45b74fb0a211
--- /dev/null
+++ b/arch/arm/mach-at91/pm_common.c
@@ -0,0 +1,39 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+#include <linux/kernel.h>
+#include <linux/parser.h>
+#include <linux/string.h>
+
+#include "pm.h"
+
+const match_table_t pm_modes __initconst = {
+	{ AT91_PM_STANDBY,	"standby" },
+	{ AT91_PM_ULP0,		"ulp0" },
+	{ AT91_PM_ULP0_FAST,    "ulp0-fast" },
+	{ AT91_PM_ULP1,		"ulp1" },
+	{ AT91_PM_BACKUP,	"backup" },
+	{ -1, NULL },
+};
+
+int at91_pm_common_modes_select(char *str, int *standby_mode, int *suspend_mode)
+{
+	char *s;
+	substring_t args[MAX_OPT_ARGS];
+	int standby, suspend;
+
+	if (!str)
+		return 0;
+
+	s = strsep(&str, ",");
+	standby = match_token(s, pm_modes, args);
+	if (standby < 0)
+		return 0;
+
+	suspend = match_token(str, pm_modes, args);
+	if (suspend < 0)
+		return 0;
+
+	*standby_mode = standby;
+	*suspend_mode = suspend;
+
+	return 0;
+}