Re: [PATCH] firmware_loader: allow firmware_class.path to take multiple paths

From: Jeff Layton

Date: Wed Mar 18 2026 - 08:59:10 EST


On Wed, 2026-03-18 at 13:40 +0100, Greg Kroah-Hartman wrote:
> On Wed, Mar 18, 2026 at 08:25:54AM -0400, Jeff Layton wrote:
> > Refactor fw_get_filesystem_firmware() by extracting the per-path
> > firmware loading logic into a new fw_try_firmware_path() helper.
> >
> > Use this helper to parse fw_path_para for ';'-separated paths,
> > trying each one before falling through to the default firmware
> > search paths. This allows users to specify multiple custom firmware
> > directories via firmware_class.path, e.g.:
> >
> > firmware_class.path=/custom/path1;/custom/path2
> >
> > Suggested-by: Michal Grzedzicki <mge@xxxxxxxx>
> > Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> > ---
> > This is something Michal had asked for last year, and I just got around
> > to implementing. Tested with a dummy module that calls
> > request_firmware().
> > ---
> > drivers/base/firmware_loader/main.c | 197 +++++++++++++++++++++---------------
> > 1 file changed, 118 insertions(+), 79 deletions(-)
> >
> > diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
> > index a11b30dda23be563bd55f25474ceff2153ddd667..5328d28a2141e85265e1bcc20e995ce4c5517c36 100644
> > --- a/drivers/base/firmware_loader/main.c
> > +++ b/drivers/base/firmware_loader/main.c
> > @@ -470,7 +470,6 @@ static int fw_decompress_xz(struct device *dev, struct fw_priv *fw_priv,
> > /* direct firmware loading support */
> > static char fw_path_para[256];
> > static const char * const fw_path[] = {
> > - fw_path_para,
> > "/lib/firmware/updates/" UTS_RELEASE,
> > "/lib/firmware/updates",
> > "/lib/firmware/" UTS_RELEASE,
> > @@ -480,10 +479,83 @@ static const char * const fw_path[] = {
> > /*
> > * Typical usage is that passing 'firmware_class.path=$CUSTOMIZED_PATH'
> > * from kernel command line because firmware_class is generally built in
> > - * kernel instead of module.
> > + * kernel instead of module. Multiple paths can be separated by ';'.
> > */
> > module_param_string(path, fw_path_para, sizeof(fw_path_para), 0644);
> > -MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path");
> > +MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path, multiple paths can be separated by ';'");
>
> Ah, you documented it here, sorry, I missed that.
>

If there's another spot we should document this, then happy to do so as
well. I didn't see much about this subsystem under Documentation/.

> But still, why ';'?
>

Honestly, I don't know why, but I was thinking that ';' was the
traditional $PATH separator at the time. I'll change it to ':'. Expect
a v2 soon!

Thanks,
--
Jeff Layton <jlayton@xxxxxxxxxx>