[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200408120541.GH11244@42.do-not-panic.com>
Date: Wed, 8 Apr 2020 12:05:41 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: Export fw_get_builtin_firmware()?
On Wed, Apr 08, 2020 at 11:45:26AM +0200, Borislav Petkov wrote:
> Hi guys,
>
> so I've come across this recently where the microcode loader
> has a trivial helper get_builtin_firmware() which scans through
> the builtin firmware to find microcode in there. Looking at
> fw_get_builtin_firmware(), that one does practically the same so how
> about I export it and have the microcode loader use it instead of
> homegrowing the same thing?
>
> IOW, something like this below?
>
> If you agree with the approach, I'll split it properly into patches,
> etc, of course.
> diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
> index 76f79913916d..d0ad1ff0ce6d 100644
> --- a/drivers/base/firmware_loader/main.c
> +++ b/drivers/base/firmware_loader/main.c
> @@ -106,8 +106,8 @@ static void fw_copy_to_prealloc_buf(struct firmware *fw,
> memcpy(buf, fw->data, fw->size);
> }
>
> -static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,
> - void *buf, size_t size)
> +bool fw_get_builtin_firmware(struct firmware *fw, const char *name, void *buf,
> + size_t size)
Yes please! Just a few things while you're at it.
Can you rename this to firmware_request_builtin() to match
the new style? And those users, can never be moduels can they?
And lastly, bonus points if you can add a respective test to
lib/test_firmware.c and tools/testing/selftests/firmware/ You'd need to
add a test dummy built-in firmware.
Luis
Powered by blists - more mailing lists