mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c87761db21
commit
48d09e9787
@@ -20,12 +20,19 @@ struct firmware {
|
||||
struct module;
|
||||
struct device;
|
||||
|
||||
/*
|
||||
* Built-in firmware functionality is only available if FW_LOADER=y, but not
|
||||
* FW_LOADER=m
|
||||
*/
|
||||
#ifdef CONFIG_FW_LOADER
|
||||
struct builtin_fw {
|
||||
char *name;
|
||||
void *data;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
bool firmware_request_builtin(struct firmware *fw, const char *name);
|
||||
|
||||
/* We have to play tricks here much like stringify() to get the
|
||||
__COUNTER__ macro to be expanded as we want it */
|
||||
#define __fw_concat1(x, y) x##y
|
||||
@@ -38,6 +45,14 @@ struct builtin_fw {
|
||||
static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
|
||||
__used __section(".builtin_fw") = { name, blob, size }
|
||||
|
||||
#else
|
||||
static inline bool firmware_request_builtin(struct firmware *fw,
|
||||
const char *name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
|
||||
int request_firmware(const struct firmware **fw, const char *name,
|
||||
struct device *device);
|
||||
|
Reference in New Issue
Block a user