mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] block: follow links before check if cdev_is_block_partition
Date: Wed, 23 Jul 2025 17:55:45 +0200	[thread overview]
Message-ID: <20250723155545.682170-1-m.felsch@pengutronix.de> (raw)

cdev_is_block_partition() fails if a cdev is passed which is a
parition-link. Most of our barebox code is link-aware by resolving the
links first.

Make it more user-friendly and resolve the possible cdev parttion link
first before performing the actual check.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 include/block.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/block.h b/include/block.h
index 5ce3eb7d7838..a5a2dcf58995 100644
--- a/include/block.h
+++ b/include/block.h
@@ -107,6 +107,7 @@ static inline bool cdev_is_block_device(const struct cdev *cdev)
 
 static inline bool cdev_is_block_partition(const struct cdev *cdev)
 {
+	cdev = cdev_readlink(cdev);
 	return cdev_is_block_device(cdev) && cdev_is_partition(cdev);
 }
 
-- 
2.39.5




             reply	other threads:[~2025-07-23 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 15:55 Marco Felsch [this message]
2025-07-24 11:28 ` Ahmad Fatoum

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=20250723155545.682170-1-m.felsch@pengutronix.de \
    --to=m.felsch@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