1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_FIRMWARE_H
3 #define _LINUX_FIRMWARE_H
5 #include <linux/types.h>
6 #include <linux/compiler.h>
9 #define FW_ACTION_NOUEVENT 0
10 #define FW_ACTION_UEVENT 1
16 /* firmware loader private fields */
24 * Built-in firmware functionality is only available if FW_LOADER=y, but not
27 #ifdef CONFIG_FW_LOADER
28 bool firmware_request_builtin(struct firmware *fw, const char *name);
30 static inline bool firmware_request_builtin(struct firmware *fw,
37 #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
38 int request_firmware(const struct firmware **fw, const char *name,
39 struct device *device);
40 int firmware_request_nowarn(const struct firmware **fw, const char *name,
41 struct device *device);
42 int firmware_request_platform(const struct firmware **fw, const char *name,
43 struct device *device);
44 int request_firmware_nowait(
45 struct module *module, bool uevent,
46 const char *name, struct device *device, gfp_t gfp, void *context,
47 void (*cont)(const struct firmware *fw, void *context));
48 int request_firmware_direct(const struct firmware **fw, const char *name,
49 struct device *device);
50 int request_firmware_into_buf(const struct firmware **firmware_p,
51 const char *name, struct device *device, void *buf, size_t size);
52 int request_partial_firmware_into_buf(const struct firmware **firmware_p,
53 const char *name, struct device *device,
54 void *buf, size_t size, size_t offset);
56 void release_firmware(const struct firmware *fw);
58 static inline int request_firmware(const struct firmware **fw,
60 struct device *device)
65 static inline int firmware_request_nowarn(const struct firmware **fw,
67 struct device *device)
72 static inline int firmware_request_platform(const struct firmware **fw,
74 struct device *device)
79 static inline int request_firmware_nowait(
80 struct module *module, bool uevent,
81 const char *name, struct device *device, gfp_t gfp, void *context,
82 void (*cont)(const struct firmware *fw, void *context))
87 static inline void release_firmware(const struct firmware *fw)
91 static inline int request_firmware_direct(const struct firmware **fw,
93 struct device *device)
98 static inline int request_firmware_into_buf(const struct firmware **firmware_p,
99 const char *name, struct device *device, void *buf, size_t size)
104 static inline int request_partial_firmware_into_buf
105 (const struct firmware **firmware_p,
107 struct device *device,
108 void *buf, size_t size, size_t offset)
115 int firmware_request_cache(struct device *device, const char *name);