diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-02-25 22:09:43 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-02-25 22:09:43 +0000 |
commit | ed59e6f455eef1db6e3b89d6a749bf868e4e974e (patch) | |
tree | 7950f104403229c24409ac4261a649da9e1050cd | |
parent | 29af9988d7213fcccf11011159261b94af4f1bee (diff) |
Print a message when a firmware is request
to let the user have an idea why the driver does not work.
-rw-r--r-- | libdde_linux26/include/linux/firmware.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/libdde_linux26/include/linux/firmware.h b/libdde_linux26/include/linux/firmware.h new file mode 100644 index 00000000..06e7a1ce --- /dev/null +++ b/libdde_linux26/include/linux/firmware.h @@ -0,0 +1,75 @@ +#ifndef _LINUX_FIRMWARE_H +#define _LINUX_FIRMWARE_H + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/compiler.h> + +#define FIRMWARE_NAME_MAX 30 +#define FW_ACTION_NOHOTPLUG 0 +#define FW_ACTION_HOTPLUG 1 + +struct firmware { + size_t size; + const u8 *data; +}; + +struct device; + +struct builtin_fw { + char *name; + void *data; + unsigned long size; +}; + +/* We have to play tricks here much like stringify() to get the + __COUNTER__ macro to be expanded as we want it */ +#define __fw_concat1(x, y) x##y +#define __fw_concat(x, y) __fw_concat1(x, y) + +#define DECLARE_BUILTIN_FIRMWARE(name, blob) \ + DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob)) + +#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \ + static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \ + __used __section(.builtin_fw) = { name, blob, size } + +#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) +int request_firmware(const struct firmware **fw, const char *name, + struct device *device); +int request_firmware_nowait( + struct module *module, int uevent, + const char *name, struct device *device, void *context, + void (*cont)(const struct firmware *fw, void *context)); + +void release_firmware(const struct firmware *fw); +#else +#ifdef DDE_LINUX +#include <ddekit/printf.h> +#endif +static inline int request_firmware(const struct firmware **fw, + const char *name, + struct device *device) +{ +#ifdef DDE_LINUX + ddekit_printf("firmware %s requested, but not implemented\n", name); +#endif + return -EINVAL; +} +static inline int request_firmware_nowait( + struct module *module, int uevent, + const char *name, struct device *device, void *context, + void (*cont)(const struct firmware *fw, void *context)) +{ +#ifdef DDE_LINUX + ddekit_printf("firmware %s requested, but not implemented\n", name); +#endif + return -EINVAL; +} + +static inline void release_firmware(const struct firmware *fw) +{ +} +#endif + +#endif |