From: Luis Chamberlain <mcgrof@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: Export fw_get_builtin_firmware()?
Date: Wed, 8 Apr 2020 12:05:41 +0000 [thread overview]
Message-ID: <20200408120541.GH11244@42.do-not-panic.com> (raw)
In-Reply-To: <20200408094526.GC24663@zn.tnic>
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
prev parent reply other threads:[~2020-04-08 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 9:45 Export fw_get_builtin_firmware()? Borislav Petkov
2020-04-08 10:20 ` Greg Kroah-Hartman
2020-04-08 12:05 ` Luis Chamberlain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200408120541.GH11244@42.do-not-panic.com \
--to=mcgrof@kernel.org \
--cc=bp@alien8.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.