summaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
authorHanjun Guo2015-05-11 06:17:13 +0200
committerRafael J. Wysocki2015-05-13 23:28:14 +0200
commit25956b6612601cf36022392ffa83f6bf97939bcd (patch)
treef3b8efbce1c45c7ccf5796e38046f13477d22a76 /include/linux/acpi.h
parentLinux 4.1-rc3 (diff)
downloadkernel-qcow2-linux-25956b6612601cf36022392ffa83f6bf97939bcd.tar.gz
kernel-qcow2-linux-25956b6612601cf36022392ffa83f6bf97939bcd.tar.xz
kernel-qcow2-linux-25956b6612601cf36022392ffa83f6bf97939bcd.zip
ACPI / processor: Introduce invalid_logical_cpuid()
In ACPI processor drivers, we use direct comparisons of cpu logical id with -1 which are error prone in case logical cpuid is accidentally assinged an error code and prevents us from returning an error-encoding cpuid directly in some cases. So introduce invalid_logical_cpuid() to identify cpu with invalid logical cpu num, then it will be used to replace the direct comparisons with -1. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index e4da5e35e29c..913b49f9a6e6 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -158,6 +158,11 @@ typedef u32 phys_cpuid_t;
#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
#endif
+static inline bool invalid_logical_cpuid(u32 cpuid)
+{
+ return (int)cpuid < 0;
+}
+
#ifdef CONFIG_ACPI_HOTPLUG_CPU
/* Arch dependent functions for cpu hotplug support */
int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu);