linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi: Mute gcc warning
@ 2019-09-29  1:13 Zhenzhong Duan
  2019-10-12  8:35 ` Zhenzhong Duan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhenzhong Duan @ 2019-09-29  1:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Zhenzhong Duan, Josh Boyer, Thomas Gleixner, Ingo Molnar,
	Peter Zijlstra, H. Peter Anvin, Chao Fan

When build with "EXTRA_CFLAGS=-Wall" gcc warns:

arch/x86/boot/compressed/acpi.c:29:30: warning: get_cmdline_acpi_rsdp defined but not used [-Wunused-function]

Fixes: 41fa1ee9c6d6 ("acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Chao Fan <fanc.fnst@cn.fujitsu.com>
---
 arch/x86/boot/compressed/acpi.c | 48 ++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index 149795c..25019d4 100644
--- a/arch/x86/boot/compressed/acpi.c
+++ b/arch/x86/boot/compressed/acpi.c
@@ -21,30 +21,6 @@
 struct mem_vector immovable_mem[MAX_NUMNODES*2];
 
 /*
- * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
- * digits, and '\0' for termination.
- */
-#define MAX_ADDR_LEN 19
-
-static acpi_physical_address get_cmdline_acpi_rsdp(void)
-{
-	acpi_physical_address addr = 0;
-
-#ifdef CONFIG_KEXEC
-	char val[MAX_ADDR_LEN] = { };
-	int ret;
-
-	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
-	if (ret < 0)
-		return 0;
-
-	if (kstrtoull(val, 16, &addr))
-		return 0;
-#endif
-	return addr;
-}
-
-/*
  * Search EFI system tables for RSDP.  If both ACPI_20_TABLE_GUID and
  * ACPI_TABLE_GUID are found, take the former, which has more features.
  */
@@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void)
 }
 
 #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE)
+/*
+ * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
+ * digits, and '\0' for termination.
+ */
+#define MAX_ADDR_LEN 19
+
+static acpi_physical_address get_cmdline_acpi_rsdp(void)
+{
+	acpi_physical_address addr = 0;
+
+#ifdef CONFIG_KEXEC
+	char val[MAX_ADDR_LEN] = { };
+	int ret;
+
+	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
+	if (ret < 0)
+		return 0;
+
+	if (kstrtoull(val, 16, &addr))
+		return 0;
+#endif
+	return addr;
+}
+
 /* Compute SRAT address from RSDP. */
 static unsigned long get_acpi_srat_table(void)
 {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] acpi: Mute gcc warning
  2019-09-29  1:13 [PATCH] acpi: Mute gcc warning Zhenzhong Duan
@ 2019-10-12  8:35 ` Zhenzhong Duan
  2019-10-17 11:01 ` [tip: x86/urgent] x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard tip-bot2 for Zhenzhong Duan
  2019-10-18 11:41 ` tip-bot2 for Zhenzhong Duan
  2 siblings, 0 replies; 4+ messages in thread
From: Zhenzhong Duan @ 2019-10-12  8:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Josh Boyer, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	H. Peter Anvin, Chao Fan

It's been a while on this patch,still see this warning in daily build.
Will anybody be willing to review it? :)

Thanks
Zhenzhong

On 2019/9/29 9:13, Zhenzhong Duan wrote:
> When build with "EXTRA_CFLAGS=-Wall" gcc warns:
>
> arch/x86/boot/compressed/acpi.c:29:30: warning: get_cmdline_acpi_rsdp defined but not used [-Wunused-function]
>
> Fixes: 41fa1ee9c6d6 ("acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down")
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Cc: Josh Boyer <jwboyer@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Chao Fan <fanc.fnst@cn.fujitsu.com>
> ---
>   arch/x86/boot/compressed/acpi.c | 48 ++++++++++++++++++++---------------------
>   1 file changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
> index 149795c..25019d4 100644
> --- a/arch/x86/boot/compressed/acpi.c
> +++ b/arch/x86/boot/compressed/acpi.c
> @@ -21,30 +21,6 @@
>   struct mem_vector immovable_mem[MAX_NUMNODES*2];
>   
>   /*
> - * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
> - * digits, and '\0' for termination.
> - */
> -#define MAX_ADDR_LEN 19
> -
> -static acpi_physical_address get_cmdline_acpi_rsdp(void)
> -{
> -	acpi_physical_address addr = 0;
> -
> -#ifdef CONFIG_KEXEC
> -	char val[MAX_ADDR_LEN] = { };
> -	int ret;
> -
> -	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
> -	if (ret < 0)
> -		return 0;
> -
> -	if (kstrtoull(val, 16, &addr))
> -		return 0;
> -#endif
> -	return addr;
> -}
> -
> -/*
>    * Search EFI system tables for RSDP.  If both ACPI_20_TABLE_GUID and
>    * ACPI_TABLE_GUID are found, take the former, which has more features.
>    */
> @@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void)
>   }
>   
>   #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE)
> +/*
> + * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
> + * digits, and '\0' for termination.
> + */
> +#define MAX_ADDR_LEN 19
> +
> +static acpi_physical_address get_cmdline_acpi_rsdp(void)
> +{
> +	acpi_physical_address addr = 0;
> +
> +#ifdef CONFIG_KEXEC
> +	char val[MAX_ADDR_LEN] = { };
> +	int ret;
> +
> +	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
> +	if (ret < 0)
> +		return 0;
> +
> +	if (kstrtoull(val, 16, &addr))
> +		return 0;
> +#endif
> +	return addr;
> +}
> +
>   /* Compute SRAT address from RSDP. */
>   static unsigned long get_acpi_srat_table(void)
>   {

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: x86/urgent] x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard
  2019-09-29  1:13 [PATCH] acpi: Mute gcc warning Zhenzhong Duan
  2019-10-12  8:35 ` Zhenzhong Duan
@ 2019-10-17 11:01 ` tip-bot2 for Zhenzhong Duan
  2019-10-18 11:41 ` tip-bot2 for Zhenzhong Duan
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Zhenzhong Duan @ 2019-10-17 11:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Zhenzhong Duan, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	linux-kernel

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     c83672e12b98de42bc4549d806588fc3955f8935
Gitweb:        https://git.kernel.org/tip/c83672e12b98de42bc4549d806588fc3955f8935
Author:        Zhenzhong Duan <zhenzhong.duan@oracle.com>
AuthorDate:    Sun, 29 Sep 2019 09:13:52 +08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 17 Oct 2019 12:55:49 +02:00

x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard

When building with "EXTRA_CFLAGS=-Wall" gcc warns:

arch/x86/boot/compressed/acpi.c:29:30: warning: get_cmdline_acpi_rsdp defined but not used [-Wunused-function]

get_cmdline_acpi_rsdp() is only used when CONFIG_RANDOMIZE_BASE and
CONFIG_MEMORY_HOTREMOVE are both enabled, so any build where one of these
config options is disabled has this issue.

Move the function under the same ifdef guard as the call site.

[ tglx: Add context to the changelog so it becomes useful ]

Fixes: 41fa1ee9c6d6 ("acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/1569719633-32164-1-git-send-email-zhenzhong.duan@oracle.com

---
 arch/x86/boot/compressed/acpi.c | 48 ++++++++++++++++----------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index 149795c..25019d4 100644
--- a/arch/x86/boot/compressed/acpi.c
+++ b/arch/x86/boot/compressed/acpi.c
@@ -21,30 +21,6 @@
 struct mem_vector immovable_mem[MAX_NUMNODES*2];
 
 /*
- * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
- * digits, and '\0' for termination.
- */
-#define MAX_ADDR_LEN 19
-
-static acpi_physical_address get_cmdline_acpi_rsdp(void)
-{
-	acpi_physical_address addr = 0;
-
-#ifdef CONFIG_KEXEC
-	char val[MAX_ADDR_LEN] = { };
-	int ret;
-
-	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
-	if (ret < 0)
-		return 0;
-
-	if (kstrtoull(val, 16, &addr))
-		return 0;
-#endif
-	return addr;
-}
-
-/*
  * Search EFI system tables for RSDP.  If both ACPI_20_TABLE_GUID and
  * ACPI_TABLE_GUID are found, take the former, which has more features.
  */
@@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void)
 }
 
 #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE)
+/*
+ * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
+ * digits, and '\0' for termination.
+ */
+#define MAX_ADDR_LEN 19
+
+static acpi_physical_address get_cmdline_acpi_rsdp(void)
+{
+	acpi_physical_address addr = 0;
+
+#ifdef CONFIG_KEXEC
+	char val[MAX_ADDR_LEN] = { };
+	int ret;
+
+	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
+	if (ret < 0)
+		return 0;
+
+	if (kstrtoull(val, 16, &addr))
+		return 0;
+#endif
+	return addr;
+}
+
 /* Compute SRAT address from RSDP. */
 static unsigned long get_acpi_srat_table(void)
 {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip: x86/urgent] x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard
  2019-09-29  1:13 [PATCH] acpi: Mute gcc warning Zhenzhong Duan
  2019-10-12  8:35 ` Zhenzhong Duan
  2019-10-17 11:01 ` [tip: x86/urgent] x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard tip-bot2 for Zhenzhong Duan
@ 2019-10-18 11:41 ` tip-bot2 for Zhenzhong Duan
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Zhenzhong Duan @ 2019-10-18 11:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Zhenzhong Duan, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	linux-kernel

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     228d120051a2234356690924c1f42e07e54e1eaf
Gitweb:        https://git.kernel.org/tip/228d120051a2234356690924c1f42e07e54e1eaf
Author:        Zhenzhong Duan <zhenzhong.duan@oracle.com>
AuthorDate:    Sun, 29 Sep 2019 09:13:52 +08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 18 Oct 2019 13:33:38 +02:00

x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard

When building with "EXTRA_CFLAGS=-Wall" gcc warns:

arch/x86/boot/compressed/acpi.c:29:30: warning: get_cmdline_acpi_rsdp defined but not used [-Wunused-function]

get_cmdline_acpi_rsdp() is only used when CONFIG_RANDOMIZE_BASE and
CONFIG_MEMORY_HOTREMOVE are both enabled, so any build where one of these
config options is disabled has this issue.

Move the function under the same ifdef guard as the call site.

[ tglx: Add context to the changelog so it becomes useful ]

Fixes: 41fa1ee9c6d6 ("acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/1569719633-32164-1-git-send-email-zhenzhong.duan@oracle.com


---
 arch/x86/boot/compressed/acpi.c | 48 ++++++++++++++++----------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index 149795c..25019d4 100644
--- a/arch/x86/boot/compressed/acpi.c
+++ b/arch/x86/boot/compressed/acpi.c
@@ -21,30 +21,6 @@
 struct mem_vector immovable_mem[MAX_NUMNODES*2];
 
 /*
- * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
- * digits, and '\0' for termination.
- */
-#define MAX_ADDR_LEN 19
-
-static acpi_physical_address get_cmdline_acpi_rsdp(void)
-{
-	acpi_physical_address addr = 0;
-
-#ifdef CONFIG_KEXEC
-	char val[MAX_ADDR_LEN] = { };
-	int ret;
-
-	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
-	if (ret < 0)
-		return 0;
-
-	if (kstrtoull(val, 16, &addr))
-		return 0;
-#endif
-	return addr;
-}
-
-/*
  * Search EFI system tables for RSDP.  If both ACPI_20_TABLE_GUID and
  * ACPI_TABLE_GUID are found, take the former, which has more features.
  */
@@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void)
 }
 
 #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE)
+/*
+ * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
+ * digits, and '\0' for termination.
+ */
+#define MAX_ADDR_LEN 19
+
+static acpi_physical_address get_cmdline_acpi_rsdp(void)
+{
+	acpi_physical_address addr = 0;
+
+#ifdef CONFIG_KEXEC
+	char val[MAX_ADDR_LEN] = { };
+	int ret;
+
+	ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
+	if (ret < 0)
+		return 0;
+
+	if (kstrtoull(val, 16, &addr))
+		return 0;
+#endif
+	return addr;
+}
+
 /* Compute SRAT address from RSDP. */
 static unsigned long get_acpi_srat_table(void)
 {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18 11:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29  1:13 [PATCH] acpi: Mute gcc warning Zhenzhong Duan
2019-10-12  8:35 ` Zhenzhong Duan
2019-10-17 11:01 ` [tip: x86/urgent] x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard tip-bot2 for Zhenzhong Duan
2019-10-18 11:41 ` tip-bot2 for Zhenzhong Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).