mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/3] bbu: detect devices when devicefile has no /dev/ prefix as well
Date: Thu, 11 Dec 2025 16:18:14 +0100	[thread overview]
Message-ID: <20251211151820.3726093-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2025-12-11 15:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 15:18 Ahmad Fatoum [this message]
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

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=20251211151820.3726093-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox