summaryrefslogtreecommitdiffstats
path: root/include/acpi/platform
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-01-11 16:55:25 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-01-25 18:41:23 +0100
commitae57857b9b6341096ddfd9c0cf26fb640c561160 (patch)
tree91295591eaeefcd5a5fa0c0198a859fa87c3e3e2 /include/acpi/platform
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07 (diff)
downloadlinux-ae57857b9b6341096ddfd9c0cf26fb640c561160.tar.bz2
ACPICA: Use uintptr_t and offsetof() in Linux kernel builds
To avoid "performing pointer subtraction with a null pointer has undefined behavior" compiler warnings, use uintptr_t and offsetof() that are always available during Linux kernel builds to define acpi_uintptr_t and the ACPI_TO_INTEGER() and ACPI_OFFSET() macros. Based on earlier proposal from Arnd Bergmann. Link: https://lore.kernel.org/linux-acpi/20210927121338.938994-1-arnd@kernel.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include/acpi/platform')
-rw-r--r--include/acpi/platform/aclinux.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index b3ffb9bbf664..cec41e004ecf 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -114,6 +114,11 @@
#define acpi_raw_spinlock raw_spinlock_t *
#define acpi_cpu_flags unsigned long
+#define acpi_uintptr_t uintptr_t
+
+#define ACPI_TO_INTEGER(p) ((uintptr_t)(p))
+#define ACPI_OFFSET(d, f) offsetof(d, f)
+
/* Use native linux version of acpi_os_allocate_zeroed */
#define USE_NATIVE_ALLOCATE_ZEROED