diff mbox series

ACPI: fix the warning reported by the sparse

Message ID 20241031112030.72647-1-cuiyunhui@bytedance.com
State New
Headers show
Series ACPI: fix the warning reported by the sparse | expand

Commit Message

Yunhui Cui Oct. 31, 2024, 11:20 a.m. UTC
All architectures use early_memremap() instead of early_ioremap().
Therefore, to solve the warning detected by sparse:
../arch/riscv/kernel/acpi.c:213:30: warning: incorrect type in return expression (different address spaces)
../arch/riscv/kernel/acpi.c:213:30:    expected void [noderef] __iomem *
../arch/riscv/kernel/acpi.c:213:30:    got void *
../arch/riscv/kernel/acpi.c:221:24: warning: incorrect type in argument 1 (different address spaces)
../arch/riscv/kernel/acpi.c:221:24:    expected void *addr
../arch/riscv/kernel/acpi.c:221:24:    got void [noderef] __iomem *map
The __iomem attribute of __acpi_map_table() is removed.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/arm64/kernel/acpi.c     | 6 +++---
 arch/loongarch/kernel/acpi.c | 2 +-
 arch/riscv/kernel/acpi.c     | 6 +++---
 arch/x86/kernel/acpi/boot.c  | 2 +-
 drivers/acpi/osl.c           | 2 +-
 include/linux/acpi.h         | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index e6f66491fbe9..69017dadb82d 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -88,10 +88,10 @@  static bool __init dt_is_stub(void)
 }
 
 /*
- * __acpi_map_table() will be called before page_init(), so early_ioremap()
- * or early_memremap() should be called here to for ACPI table mapping.
+ * __acpi_map_table() will be called before page_init(), so early_memremap()
+ * should be called here to for ACPI table mapping.
  */
-void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
+void __init *__acpi_map_table(unsigned long phys, unsigned long size)
 {
 	if (!size)
 		return NULL;
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index f1a74b80f22c..a29c1d86e274 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -34,7 +34,7 @@  u64 acpi_saved_sp;
 
 struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
 
-void __init __iomem * __acpi_map_table(unsigned long phys, unsigned long size)
+void __init *__acpi_map_table(unsigned long phys, unsigned long size)
 {
 
 	if (!phys || !size)
diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index 2fd29695a788..861ab56962a2 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -202,10 +202,10 @@  struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu)
 }
 
 /*
- * __acpi_map_table() will be called before paging_init(), so early_ioremap()
- * or early_memremap() should be called here to for ACPI table mapping.
+ * __acpi_map_table() will be called before paging_init(), so early_memremap()
+ * should be called here to for ACPI table mapping.
  */
-void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
+void __init *__acpi_map_table(unsigned long phys, unsigned long size)
 {
 	if (!size)
 		return NULL;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 3a44a9dc3fb7..e1ed297552e7 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -105,7 +105,7 @@  static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = {
  * This is just a simple wrapper around early_memremap(),
  * with sanity checks for phys == 0 and size == 0.
  */
-void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
+void __init *__acpi_map_table(unsigned long phys, unsigned long size)
 {
 
 	if (!phys || !size)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 70af3fbbebe5..a36486b59bca 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -334,7 +334,7 @@  void __iomem __ref
 	}
 
 	if (!acpi_permanent_mmap)
-		return __acpi_map_table((unsigned long)phys, size);
+		return (void __iomem __force *)__acpi_map_table((unsigned long)phys, size);
 
 	mutex_lock(&acpi_ioremap_lock);
 	/* Check if there's a suitable mapping already. */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4d5ee84c468b..d4627d96c13b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -207,7 +207,7 @@  static inline int acpi_debugger_notify_command_complete(void)
 		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
 		((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
 
-void __iomem *__acpi_map_table(unsigned long phys, unsigned long size);
+void *__acpi_map_table(unsigned long phys, unsigned long size);
 void __acpi_unmap_table(void __iomem *map, unsigned long size);
 int early_acpi_boot_init(void);
 int acpi_boot_init (void);