From 63e521d0a280169b48d569ec96611aa5a4011f8c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 31 May 2012 11:08:55 +0100 Subject: [PATCH] include/linux/firmware.h: Check for FW_ACTION_HOTPLUG. The FW_ACTION_HOTPLUG and FW_ACTION_NOHOTPLUG macros, and the 'hotplug' (later renamed 'uevent') parameter of request_firmware_nowait() were added in vanilla kernel 2.6.14. Update the include/linux/firmware.h compatibility code to work with kernels prior to 2.6.14. If FW_ACTION_HOTPLUG is not defined, omit the uevent parameter and define FW_ACTION_HOTPLUG and FW_ACTION_NOHOTPLUG. The uevent parameter will be ignored for these older kernels so FW_ACTION_NOHOTPLUG will behave just like FW_ACTION_HOTPLUG for these older kernels. Signed-off-by: Ian Abbott --- include/linux/firmware.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 514b8630..2f87c5be 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -24,8 +24,13 @@ static inline int comedi_internal_request_firmware_nowait( const char *name, struct device *device, unsigned gfp, void *context, void (*cont)(const struct firmware *fw, void *context)) { +#ifdef FW_ACTION_HOTPLUG return request_firmware_nowait( module, uevent, name, device, context, cont); +#else + return request_firmware_nowait( + module, name, device, context, cont); +#endif } #undef request_firmware_nowait @@ -38,4 +43,15 @@ static inline int comedi_internal_request_firmware_nowait( #define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) do; while (0) #endif +/* + * FW_ACTION_HOTPLUG and FW_ACTION_NOHOTPLUG and the uevent/hotplug parameter + * of request_firmware_nowait() were added in vanilla kernel 2.6.14. We've + * already dealt with the missing parameter above, but define the missing + * values below. Comedi drivers would normally use FW_ACTION_HOTPLUG. + */ +#ifndef FW_ACTION_HOTPLUG +#define FW_ACTION_NOHOTPLUG 0 +#define FW_ACTION_HOTPLUG 1 +#endif + #endif -- 2.26.2