diff options
Diffstat (limited to 'include/linux/firmware.h')
-rw-r--r-- | include/linux/firmware.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 6c7eff2ebada..c8ecf5b2a207 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
@@ -1,18 +1,39 @@ | |||
1 | #ifndef _LINUX_FIRMWARE_H | 1 | #ifndef _LINUX_FIRMWARE_H |
2 | #define _LINUX_FIRMWARE_H | 2 | #define _LINUX_FIRMWARE_H |
3 | |||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
4 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/compiler.h> | ||
7 | |||
5 | #define FIRMWARE_NAME_MAX 30 | 8 | #define FIRMWARE_NAME_MAX 30 |
6 | #define FW_ACTION_NOHOTPLUG 0 | 9 | #define FW_ACTION_NOHOTPLUG 0 |
7 | #define FW_ACTION_HOTPLUG 1 | 10 | #define FW_ACTION_HOTPLUG 1 |
8 | 11 | ||
9 | struct firmware { | 12 | struct firmware { |
10 | size_t size; | 13 | size_t size; |
11 | u8 *data; | 14 | const u8 *data; |
12 | }; | 15 | }; |
13 | 16 | ||
14 | struct device; | 17 | struct device; |
15 | 18 | ||
19 | struct builtin_fw { | ||
20 | char *name; | ||
21 | void *data; | ||
22 | unsigned long size; | ||
23 | }; | ||
24 | |||
25 | /* We have to play tricks here much like stringify() to get the | ||
26 | __COUNTER__ macro to be expanded as we want it */ | ||
27 | #define __fw_concat1(x, y) x##y | ||
28 | #define __fw_concat(x, y) __fw_concat1(x, y) | ||
29 | |||
30 | #define DECLARE_BUILTIN_FIRMWARE(name, blob) \ | ||
31 | DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob)) | ||
32 | |||
33 | #define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \ | ||
34 | static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \ | ||
35 | __used __section(.builtin_fw) = { name, blob, size } | ||
36 | |||
16 | #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) | 37 | #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) |
17 | int request_firmware(const struct firmware **fw, const char *name, | 38 | int request_firmware(const struct firmware **fw, const char *name, |
18 | struct device *device); | 39 | struct device *device); |