diff options
author | Luis Chamberlain <mcgrof@kernel.org> | 2021-10-21 08:58:34 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-10-22 14:13:44 +0200 |
commit | 48d09e97876bed4bcc503d528bdba8c907e43cb3 (patch) | |
tree | 19c98782f93da87cf9e1b2c6a0ac817e0c9fa9bf /drivers/base/firmware_loader/firmware.h | |
parent | component: do not leave master devres group open after bind (diff) | |
download | wireguard-linux-48d09e97876bed4bcc503d528bdba8c907e43cb3.tar.xz wireguard-linux-48d09e97876bed4bcc503d528bdba8c907e43cb3.zip |
firmware_loader: formalize built-in firmware API
Formalize the built-in firmware with a proper API. This can later
be used by other callers where all they need is built-in firmware.
We export the firmware_request_builtin() call for now only
under the TEST_FIRMWARE symbol namespace as there are no
direct modular users for it. If they pop up they are free
to export it generally. Built-in code always gets access to
the callers and we'll demonstrate a hidden user which has been
lurking in the kernel for a while and the reason why using a
proper API was better long term.
Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20211021155843.1969401-2-mcgrof@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_loader/firmware.h')
-rw-r--r-- | drivers/base/firmware_loader/firmware.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/firmware_loader/firmware.h b/drivers/base/firmware_loader/firmware.h index a3014e9e2c85..2889f446ad41 100644 --- a/drivers/base/firmware_loader/firmware.h +++ b/drivers/base/firmware_loader/firmware.h @@ -151,6 +151,23 @@ static inline void fw_state_done(struct fw_priv *fw_priv) int assign_fw(struct firmware *fw, struct device *device); +#ifdef CONFIG_FW_LOADER +bool firmware_is_builtin(const struct firmware *fw); +bool firmware_request_builtin_buf(struct firmware *fw, const char *name, + void *buf, size_t size); +#else /* module case */ +static inline bool firmware_is_builtin(const struct firmware *fw) +{ + return false; +} +static inline bool firmware_request_builtin_buf(struct firmware *fw, + const char *name, + void *buf, size_t size) +{ + return false; +} +#endif + #ifdef CONFIG_FW_LOADER_PAGED_BUF void fw_free_paged_buf(struct fw_priv *fw_priv); int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed); |