Linux Audio

Check our new training course

Loading...
v6.8
 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
12int firmware_fallback_sysfs(struct firmware *fw, const char *name,
13			    struct device *device,
14			    u32 opt_flags,
15			    int ret);
16void kill_pending_fw_fallback_reqs(bool kill_all);
17
18void fw_fallback_set_cache_timeout(void);
19void fw_fallback_set_default_timeout(void);
20
 
 
21#else /* CONFIG_FW_LOADER_USER_HELPER */
22static 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
31static inline void kill_pending_fw_fallback_reqs(bool kill_all) { }
32static inline void fw_fallback_set_cache_timeout(void) { }
33static inline void fw_fallback_set_default_timeout(void) { }
34#endif /* CONFIG_FW_LOADER_USER_HELPER */
35
36#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
37int firmware_fallback_platform(struct fw_priv *fw_priv);
38#else
39static inline int firmware_fallback_platform(struct fw_priv *fw_priv)
40{
41	return -ENOENT;
42}
43#endif
 
 
 
 
44
45#endif /* __FIRMWARE_FALLBACK_H */
v4.17
 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/**
 9 * struct firmware_fallback_config - firmware fallback configuration settings
10 *
11 * Helps describe and fine tune the fallback mechanism.
12 *
13 * @force_sysfs_fallback: force the sysfs fallback mechanism to be used
14 * 	as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y.
15 * 	Useful to help debug a CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
16 * 	functionality on a kernel where that config entry has been disabled.
17 * @ignore_sysfs_fallback: force to disable the sysfs fallback mechanism.
18 * 	This emulates the behaviour as if we had set the kernel
19 * 	config CONFIG_FW_LOADER_USER_HELPER=n.
20 * @old_timeout: for internal use
21 * @loading_timeout: the timeout to wait for the fallback mechanism before
22 * 	giving up, in seconds.
23 */
24struct firmware_fallback_config {
25	unsigned int force_sysfs_fallback;
26	unsigned int ignore_sysfs_fallback;
27	int old_timeout;
28	int loading_timeout;
29};
30
31#ifdef CONFIG_FW_LOADER_USER_HELPER
32int fw_sysfs_fallback(struct firmware *fw, const char *name,
33		      struct device *device,
34		      unsigned int opt_flags,
35		      int ret);
36void kill_pending_fw_fallback_reqs(bool only_kill_custom);
37
38void fw_fallback_set_cache_timeout(void);
39void fw_fallback_set_default_timeout(void);
40
41int register_sysfs_loader(void);
42void unregister_sysfs_loader(void);
43#else /* CONFIG_FW_LOADER_USER_HELPER */
44static inline int fw_sysfs_fallback(struct firmware *fw, const char *name,
45				    struct device *device,
46				    unsigned int opt_flags,
47				    int ret)
48{
49	/* Keep carrying over the same error */
50	return ret;
51}
52
53static inline void kill_pending_fw_fallback_reqs(bool only_kill_custom) { }
54static inline void fw_fallback_set_cache_timeout(void) { }
55static inline void fw_fallback_set_default_timeout(void) { }
 
56
57static inline int register_sysfs_loader(void)
 
 
 
58{
59	return 0;
60}
61
62static inline void unregister_sysfs_loader(void)
63{
64}
65#endif /* CONFIG_FW_LOADER_USER_HELPER */
66
67#endif /* __FIRMWARE_FALLBACK_H */