datapath: Add IS_ERR_OR_NULL for backward compatibility.
authorPravin B Shelar <pshelar@nicira.com>
Fri, 12 Sep 2014 23:03:34 +0000 (16:03 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Fri, 12 Sep 2014 23:05:47 +0000 (16:05 -0700)
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
acinclude.m4
datapath/linux/compat/include/linux/err.h

index 742862d..e903273 100644 (file)
@@ -283,6 +283,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [OVS_DEFINE([HAVE_CSUM_COPY_DBG])])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST])
+  OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random])
   OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy])
index 50faf2a..4a4ce7e 100644 (file)
@@ -18,4 +18,11 @@ static inline void *ERR_CAST(const void *ptr)
 }
 #endif /* HAVE_ERR_CAST */
 
+#ifndef HAVE_IS_ERR_OR_NULL
+static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
+{
+       return !ptr || IS_ERR_VALUE((unsigned long)ptr);
+}
+#endif
+
 #endif