HACK: initialize firmware cache on demand due to uninitialized spin lock

This commit is contained in:
Waldemar Tomme 2023-04-03 19:19:56 +02:00
parent 5822d4a329
commit 60c572c9f1

View File

@ -40,6 +40,26 @@ MODULE_LICENSE("GPL");
/* Builtin firmware support */ /* Builtin firmware support */
static int _____fw_cache_init = 0;
static void __init fw_cache_init(void);
// HACK this initializes the module if not already done.
static void HACK_ensure_fw_cache_init(void)
{
if(_____fw_cache_init)
{
printk("HACK in %s: fw_cache is already initialized.", __FILE__);
dump_stack();
return;
}
_____fw_cache_init = 1;
printk("HACK in %s: initializing fw_cache", __FILE__);
dump_stack();
fw_cache_init();
}
#ifdef CONFIG_FW_LOADER #ifdef CONFIG_FW_LOADER
extern struct builtin_fw __start_builtin_fw[]; extern struct builtin_fw __start_builtin_fw[];
@ -1312,6 +1332,8 @@ request_firmware_nowait(
{ {
struct firmware_work *fw_work; struct firmware_work *fw_work;
HACK_ensure_fw_cache_init();
fw_work = kzalloc(sizeof(struct firmware_work), gfp); fw_work = kzalloc(sizeof(struct firmware_work), gfp);
if (!fw_work) if (!fw_work)
return -ENOMEM; return -ENOMEM;