mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] bbu: detect devices when devicefile has no /dev/ prefix as well
@ 2025-12-11 15:18 Ahmad Fatoum
  2025-12-11 15:18 ` [PATCH 2/3] treewide: replace open-coded variants of devpath_to_name Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-12-11 15:18 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-15 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-11 15:18 [PATCH 1/3] bbu: detect devices when devicefile has no /dev/ prefix as well Ahmad Fatoum
2025-12-11 15:18 ` [PATCH 2/3] treewide: replace open-coded variants of devpath_to_name Ahmad Fatoum
2025-12-11 15:18 ` [PATCH 3/3] fs: implement new resolve_fsdevice_path helper Ahmad Fatoum
2025-12-15 10:18 ` [PATCH 1/3] bbu: detect devices when devicefile has no /dev/ prefix as well Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox