[PATCH v6 2/6] misc: fs_loader: reorganize and split to FS loader and FW UCLASS
Simon Glass
sjg at chromium.org
Sat Apr 11 16:56:54 CEST 2026
Hi Christian,
On 2026-04-09T13:32:56, Christian Marangi <ansuelsmth at gmail.com> wrote:
> misc: fs_loader: reorganize and split to FS loader and FW UCLASS
>
> In preparation to the introduction of variant of the FS loader,
> reorganize and split the driver to generic fw_loader UCLASS and
> specific fs_loader function. Create a dedicated directory for the loader
> and move the internal structs and functions to a dedicated header file.
> While at it also drop some redundant check and rename some variables as we
> are updating the code for the UCLASS rework.
>
> This will permit to reuse all the property and logic of FS loader
> with container that are not exactly a readable filesystem.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
>
> drivers/misc/Kconfig | 5 +
> drivers/misc/Makefile | 2 +-
> drivers/misc/fs_loader.c | 328 ------------------------------
> drivers/misc/fw_loader/Makefile | 4 +
> drivers/misc/fw_loader/fs_loader.c | 186 +++++++++++++++++
> drivers/misc/fw_loader/fw_loader-uclass.c | 147 +++++++++++++
> drivers/misc/fw_loader/internal.h | 73 +++++++
> include/dm/uclass-id.h | 2 +-
> include/fs_loader.h | 47 +----
> include/fw_loader.h | 19 ++
> 10 files changed, 438 insertions(+), 375 deletions(-)
> diff --git a/drivers/misc/fw_loader/fw_loader-uclass.c b/drivers/misc/fw_loader/fw_loader-uclass.c
> new file mode 100644
> @@ -0,0 +1,147 @@
> +UCLASS_DRIVER(fw_loader) = {
> + .id = UCLASS_FIRMWARE_LOADER,
> + .name = "fw_loader",
> + .pre_probe = fw_loader_pre_probe,
> + .per_device_plat_auto = sizeof(struct device_plat),
> + .per_device_auto = sizeof(struct firmware),
> +};
The uclass uses per_device_auto but the code uses
dev_get_uclass_priv() to access it. Please can you use priv_auto in
the driver, or per_device_auto with dev_get_uclass_auto() in the code.
I suspect you meant the latter.
> diff --git a/drivers/misc/fw_loader/fw_loader-uclass.c b/drivers/misc/fw_loader/fw_loader-uclass.c
> @@ -0,0 +1,147 @@
> +static int fw_loader_pre_probe(struct udevice *dev)
> +{
> + struct device_plat *plat = dev_get_uclass_plat(dev);
> + ofnode fw_loader_node;
> + int ret;
> +
> + if (!IS_ENABLED(CONFIG_DM))
> + return 0;
The IS_ENABLED(CONFIG_DM) check is not needed since this code is
inside a uclass — driver model must be enabled for this to compile or
run.
Regards,
Simon
More information about the U-Boot
mailing list