AC_DEFINE([CONFIG_COMEDI_HAVE_GENERIC_BOOL_TYPE],[true],[Define if Linux kernel source has generic 'bool' type in linux/types.h])
fi
+COMEDI_CHECK_REQUEST_FIRMWARE_NOWAIT_HAS_GFP([$LINUX_SRC_DIR],
+ [REQUEST_FIRMWARE_NOWAIT_HAS_GFP="yes"],
+ [REQUEST_FIRMWARE_NOWAIT_HAS_GFP="no"])
+if test "$REQUEST_FIRMWARE_NOWAIT_HAS_GFP" = "yes" ; then
+ AC_DEFINE([CONFIG_COMEDI_REQUEST_FIRMWARE_NOWAIT_HAS_GFP],[true],[Define if Linux kernel 'request_firmware_nowait' function has 'gfp' parameter])
+fi
+
AS_CHECK_LINUX_CONFIG_OPTION([CONFIG_USB],[HAVE_USB="yes"],[HAVE_USB="yes"],[HAVE_USB="no"])
AM_CONDITIONAL([CONFIG_USB],[test "$HAVE_USB" = "yes"])
AC_ARG_ENABLE([usb],[ --disable-usb Disable support for USB devices],
#include_next <linux/firmware.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+#ifdef CONFIG_COMEDI_REQUEST_FIRMWARE_NOWAIT_HAS_GFP
+
+/* Define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) for use in the callback function
+ * of request_firmware_nowait(). This version just calls
+ * release_firmware(fw). */
+#define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) release_firmware(fw)
+
+#else
/* Redefine request_firmware_nowait() to add gfp parameter. This will be
* ignored for kernel versions prior to 2.6.33. */
/* Define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) for use in the callback function
* of request_firmware_nowait(). This version does nothing. */
#define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) do; while (0)
-#else
-/* Define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) for use in the callback function
- * of request_firmware_nowait(). This version just calls
- * release_firmware(fw). */
-#define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) release_firmware(fw)
#endif
#endif
$3
fi
])
+
+# COMEDI_CHECK_REQUEST_FIRMWARE_NOWAIT_HAS_GFP([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# -------------------------------------------------------------
+# Check if the kernel's request_firmware_nowait() function has the gfp
+# parameter. This was added in vanilla 2.6.33 but Red Hat backported it
+# to their 2.6.32 kernel.
+AC_DEFUN([COMEDI_CHECK_REQUEST_FIRMWARE_NOWAIT_HAS_GFP],
+[
+ AC_REQUIRE([AC_PROG_EGREP])
+ AC_MSG_CHECKING([$1 for gfp parameter in request_firmware_nowait()])
+ $EGREP -q gfp_t "$1/include/linux/firmware.h"
+ if (($?)); then
+ AC_MSG_RESULT([no])
+ $3
+ else
+ AC_MSG_RESULT([yes])
+ $2
+ fi
+])