xref: /linux/drivers/base/firmware_loader/fallback.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __FIRMWARE_FALLBACK_H
3 #define __FIRMWARE_FALLBACK_H
4 
5 #include <linux/firmware.h>
6 #include <linux/device.h>
7 
8 #include "firmware.h"
9 #include "sysfs.h"
10 
11 #ifdef CONFIG_FW_LOADER_USER_HELPER
12 int firmware_fallback_sysfs(struct firmware *fw, const char *name,
13 			    struct device *device,
14 			    u32 opt_flags,
15 			    int ret);
16 void kill_pending_fw_fallback_reqs(bool kill_all);
17 
18 void fw_fallback_set_cache_timeout(void);
19 void fw_fallback_set_default_timeout(void);
20 
21 #else /* CONFIG_FW_LOADER_USER_HELPER */
22 static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name,
23 					  struct device *device,
24 					  u32 opt_flags,
25 					  int ret)
26 {
27 	/* Keep carrying over the same error */
28 	return ret;
29 }
30 
31 static inline void kill_pending_fw_fallback_reqs(bool kill_all) { }
32 static inline void fw_fallback_set_cache_timeout(void) { }
33 static inline void fw_fallback_set_default_timeout(void) { }
34 #endif /* CONFIG_FW_LOADER_USER_HELPER */
35 
36 #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
37 int firmware_fallback_platform(struct fw_priv *fw_priv);
38 #else
39 static inline int firmware_fallback_platform(struct fw_priv *fw_priv)
40 {
41 	return -ENOENT;
42 }
43 #endif
44 
45 #endif /* __FIRMWARE_FALLBACK_H */
46