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 2/3] treewide: replace open-coded variants of devpath_to_name
Date: Thu, 11 Dec 2025 16:18:15 +0100	[thread overview]
Message-ID: <20251211151820.3726093-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251211151820.3726093-1-a.fatoum@pengutronix.de>

Instead of opencoding this at multiple places, use the helper we have
for it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/findmnt.c        | 2 +-
 common/bootscan.c         | 2 +-
 common/imx-bbu-nand-fcb.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/commands/findmnt.c b/commands/findmnt.c
index a531b1a95a83..b1c323ebbff2 100644
--- a/commands/findmnt.c
+++ b/commands/findmnt.c
@@ -92,7 +92,7 @@ static int do_findmnt(int argc, char *argv[])
 				continue;
 
 			backingstore = target->backingstore;
-			backingstore += str_has_prefix(backingstore, "/dev/");
+			backingstore = devpath_to_name(backingstore);
 
 			if (streq_ptr(backingstore, cdev->name)) {
 				print_header(&header_printed);
diff --git a/common/bootscan.c b/common/bootscan.c
index 813d6d242a08..faaceaa22152 100644
--- a/common/bootscan.c
+++ b/common/bootscan.c
@@ -145,7 +145,7 @@ static int boot_scan_devicename(struct bootscanner *scanner,
 	pr_debug("%s(%s): %s\n", __func__, scanner->name, devname);
 
 	/* Support both boot /dev/disk0.rootfs and boot disk0.rootfs */
-	devname += str_has_prefix(devname, "/dev/");
+	devname = devpath_to_name(devname);
 
 	device_detect_by_name(devname);
 
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 7593cd27fec9..0ca5782a702e 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -1232,7 +1232,7 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
 	}
 
 	/* Support both boot /dev/nand0.barebox and boot nand0.barebox */
-	devname += str_has_prefix(devname, "/dev/");
+	devname = devpath_to_name(devname);
 
 	device_detect_by_name(devname);
 
-- 
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 [PATCH 1/3] bbu: detect devices when devicefile has no /dev/ prefix as well Ahmad Fatoum
2025-12-11 15:18 ` Ahmad Fatoum [this message]
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-2-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