compat: fix compat_firmware_class.c compilation on older kernels
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Fri, 30 Mar 2012 21:25:19 +0000 (14:25 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Fri, 30 Mar 2012 21:48:03 +0000 (14:48 -0700)
CONFIG_COMPAT_FIRMWARE_CLASS is defined explicitly for any kernel >= 2.6.33
but CONFIG_FW_LOADER) || CONFIG_FW_LOADER_MODULE may still be disabled,
and in those cases we should still compile.

Lets clean this up by being explicit about the exported symbols within
compat_firmware_class.c instead of relying on the header file to rename them
for us at compile time. At the same time be consistent and use the
CONFIG_FW_LOADER) || CONFIG_FW_LOADER_MODULE checks on the header
to see which declarations to use.

mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel                  3.3.0-030300rc2-generic  [OK]
Trying kernel                     3.2.2-030202-generic  [OK]
Trying kernel                    3.1.10-030110-generic  [OK]
Trying kernel                    3.0.18-030018-generic  [OK]
Trying kernel                  2.6.39-02063904-generic  [OK]
Trying kernel                        2.6.38-13-generic  [OK]
Trying kernel                  2.6.38-02063808-generic  [OK]
Trying kernel                  2.6.37-02063706-generic  [OK]
Trying kernel                  2.6.36-02063604-generic  [OK]
Trying kernel                  2.6.35-02063512-generic  [OK]
Trying kernel                  2.6.34-02063410-generic  [OK]
Trying kernel                  2.6.33-02063305-generic  [OK]
Trying kernel                  2.6.32-02063255-generic  [OK]
Trying kernel                        2.6.31-22-generic  [OK]
Trying kernel                  2.6.31-02063113-generic  [OK]
Trying kernel                  2.6.30-02063010-generic  [OK]
Trying kernel                  2.6.29-02062906-generic  [OK]
Trying kernel                  2.6.28-02062810-generic  [OK]
Trying kernel                    2.6.27-020627-generic  [OK]
Trying kernel                    2.6.26-020626-generic  [OK]
Trying kernel                    2.6.25-020625-generic  [OK]
Trying kernel                    2.6.24-020624-generic  [OK]

Cc: stable@orbit-lab.org
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat/compat_firmware_class.c
include/linux/compat-2.6.33.h

index 01eda40..69b442b 100644 (file)
@@ -635,7 +635,7 @@ out:
  *      firmware image for this or any other device.
  **/
 int
-request_firmware(const struct firmware **firmware_p, const char *name,
+compat_request_firmware(const struct firmware **firmware_p, const char *name,
                  struct device *device)
 {
         int uevent = 1;
@@ -646,7 +646,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
  * release_firmware: - release the resource associated with a firmware image
  * @fw: firmware resource to release
  **/
-void release_firmware(const struct firmware *fw)
+void compat_release_firmware(const struct firmware *fw)
 {
        if (fw) {
                if (!fw_is_builtin_firmware(fw))
@@ -705,7 +705,7 @@ static int request_firmware_work_func(void *arg)
  *     in atomic contexts.
  **/
 int
-request_firmware_nowait(
+compat_request_firmware_nowait(
        struct module *module, int uevent,
        const char *name, struct device *device, gfp_t gfp, void *context,
        void (*cont)(const struct firmware *fw, void *context))
index c900a6f..0c71af9 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/firmware.h>
 #include <linux/input.h>
 
-#if defined(CONFIG_COMPAT_FIRMWARE_CLASS)
+#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
 #define release_firmware compat_release_firmware
 #define request_firmware compat_request_firmware
 #define request_firmware_nowait compat_request_firmware_nowait
@@ -37,7 +37,7 @@ static inline int compat_request_firmware(const struct firmware **fw,
 {
        return -EINVAL;
 }
-static inline int request_firmware_nowait(
+static inline int compat_request_firmware_nowait(
        struct module *module, int uevent,
        const char *name, struct device *device, gfp_t gfp, void *context,
        void (*cont)(const struct firmware *fw, void *context))