]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Added SPL_AC_5ARGS_DEVICE_CREATE autoconf configure check
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 13 Mar 2009 20:38:43 +0000 (13:38 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 13 Mar 2009 20:38:43 +0000 (13:38 -0700)
As of 2.6.27 kernels the device_create() API changed to include
a private data argument.  This check detects which version of
device_create() function the kernel has and properly defines
spl_device_create() to use the correct prototype.

config/spl-build.m4
configure
configure.ac
include/spl-device.h
spl_config.h.in

index f2dc7fa9ecd42a6693d284c68bc4a0719a53f060..d0cf86d9abbc89dcf059f8cbb6c79494108c6af6 100644 (file)
@@ -503,6 +503,28 @@ AC_DEFUN([SPL_AC_DEVICE_CREATE], [
                [])
 ])
 
+dnl #
+dnl # 2.6.27 API change,
+dnl # device_create() uses 5 args, new 'drvdata' argument.
+dnl #
+AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
+       AC_MSG_CHECKING([whether device_create() wants 5 args])
+       tmp_flags="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="-Werror"
+       SPL_LINUX_TRY_COMPILE([
+               #include <linux/device.h>
+       ],[
+               device_create(NULL, NULL, 0, NULL, "%d", 1);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
+                         [device_create wants 5 args])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+       EXTRA_KCFLAGS="$tmp_flags"
+])
+
 dnl #
 dnl # 2.6.13 API change, check whether class_device_create() is available.
 dnl # Class_device_create() was introduced in 2.6.13 and depricated
index 92dd8d732de2ea8de39223d6fca907d3c7e495d7..0467b602d458152ef7bd2ebc4b274ae9217f42d7 100755 (executable)
--- a/configure
+++ b/configure
@@ -19788,6 +19788,74 @@ _ACEOF
 
 
 
+       echo "$as_me:$LINENO: checking whether device_create() wants 5 args" >&5
+echo $ECHO_N "checking whether device_create() wants 5 args... $ECHO_C" >&6
+       tmp_flags="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="-Werror"
+
+
+cat >conftest.c <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+               #include <linux/device.h>
+
+int
+main (void)
+{
+
+               device_create(NULL, NULL, 0, NULL, "%d", 1);
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build
+       echo "obj-m := conftest.o" >build/Makefile
+       if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+               echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_5ARGS_DEVICE_CREATE 1
+_ACEOF
+
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+
+
+fi
+
+       rm -Rf build
+
+
+       EXTRA_KCFLAGS="$tmp_flags"
+
+
        echo "$as_me:$LINENO: checking whether symbol class_device_create is exported" >&5
 echo $ECHO_N "checking whether symbol class_device_create is exported... $ECHO_C" >&6
        grep -q -E '[[:space:]]class_device_create[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
index 7409cba6e61d6911ca966910ab264f0d6a5001a6..623d54dd588761d6467ab8df24fe0f30da1ac758 100644 (file)
@@ -54,6 +54,7 @@ SPL_AC_TASK_CURR
 SPL_AC_CTL_UNNUMBERED
 SPL_AC_FLS64
 SPL_AC_DEVICE_CREATE
+SPL_AC_5ARGS_DEVICE_CREATE
 SPL_AC_CLASS_DEVICE_CREATE
 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
index d18aedf072b13bf29dbcc46887d7b2a3f6a24d13..c82f65dfe0c4ce075afc9bfe44846d704e0c4f24 100644 (file)
@@ -13,8 +13,15 @@ typedef struct device                        spl_device;
 
 #define spl_class_create(mod, name)    class_create(mod, name)
 #define spl_class_destroy(cls)         class_destroy(cls)
-#define spl_device_create(cls, parent, devt, device, fmt, args...)            \
+
+# ifdef HAVE_5ARGS_DEVICE_CREATE
+# define spl_device_create(cls, parent, devt, drvdata, fmt, args...)          \
+       device_create(cls, parent, devt, drvdata, fmt, ## args)
+# else
+# define spl_device_create(cls, parent, devt, drvdata, fmt, args...)          \
        device_create(cls, parent, devt, fmt, ## args)
+# endif
+
 #define spl_device_destroy(cls, cls_dev, devt)                                \
        device_destroy(cls, devt)
 
index 931539c81454c5493ea710be6a9e7f6288321c48..f2895054d214fa5dc5227cd6818b7a60b69e77af 100644 (file)
@@ -21,6 +21,9 @@
 /* on_each_cpu wants 3 args */
 #undef HAVE_3ARGS_ON_EACH_CPU
 
+/* device_create wants 5 args */
+#undef HAVE_5ARGS_DEVICE_CREATE
+
 /* kernel defines atomic64_t */
 #undef HAVE_ATOMIC64_T