[PATCH 1/3] bbu: detect devices when devicefile has no /dev/ prefix as well
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Dec 11 07:18:14 PST 2025
Functions like imx6_bbu_internal_mmcboot_register_handler() are called
with devicefile either being the cdev name or with a full path.
There is no harm in trying to detect the devicefile in the former case
as well, so do it unconditionally and simplify the function as a result.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/bbu.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/common/bbu.c b/common/bbu.c
index 39db87e823d9..00d415bcf826 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -43,27 +43,19 @@ void bbu_append_handlers_to_file_list(struct file_list *files)
struct bbu_handler *handler;
list_for_each_entry(handler, &bbu_image_handlers, list) {
- const char *cdevname, *devpath;
- char *buf = NULL;
+ const char *devicefile;
struct stat s;
- devpath = handler->devicefile;
+ devicefile = handler->devicefile;
- if (strstarts(devpath, "/dev/")) {
- cdevname = devpath_to_name(devpath);
- device_detect_by_name(cdevname);
+ device_detect_by_name(devpath_to_name(devicefile));
- devpath = buf = basprintf("/dev/%s", cdevname);
- }
-
- if (stat(devpath, &s) == 0) {
- append_bbu_entry(handler->name, devpath, files);
+ if (stat(devicefile, &s) == 0) {
+ append_bbu_entry(handler->name, devicefile, files);
} else {
pr_info("Skipping handler bbu-%s: %s unavailable\n",
- handler->name, devpath);
+ handler->name, devicefile);
}
-
- free(buf);
}
}
--
2.47.3
More information about the barebox
mailing list