summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHanjun Guo <hanjun.guo@linaro.org>2015-05-11 12:17:13 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-05-13 23:28:14 +0200
commit25956b6612601cf36022392ffa83f6bf97939bcd (patch)
treef3b8efbce1c45c7ccf5796e38046f13477d22a76 /include
parent030bbdbf4c833bc69f502eae58498bc5572db736 (diff)
downloadlinux-stable-25956b6612601cf36022392ffa83f6bf97939bcd.tar.gz
linux-stable-25956b6612601cf36022392ffa83f6bf97939bcd.tar.bz2
linux-stable-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')
-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);