From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 2/2] nvmem: Drop now unnecessary partition quirk
Date: Mon, 02 Jun 2025 10:51:32 +0200 [thread overview]
Message-ID: <20250602-cdev-part-fixes-v1-2-814d9aa195ed@pengutronix.de> (raw)
In-Reply-To: <20250602-cdev-part-fixes-v1-0-814d9aa195ed@pengutronix.de>
The nvmem core uses container_of() on the cdev to retrieve its driver
data. For partitions the nvmem core tried to retrieve the master cdev
first. This is no longer necessary since the devfs-core now passes the
master cdev as context pointer and not the partition cdev.
This also fixes a bug when a partition was partitioned again. In this
case we would have to iterate upwards until we find the master cdev
instead of doing only one level.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/nvmem/core.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 38dfb2cf2d1f5dcd49be0d24f8c9e16f5963507b..fd3c39fd8e431e8ec392feede933986306e0484a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -61,10 +61,7 @@ static ssize_t nvmem_cdev_read(struct cdev *cdev, void *buf, size_t count,
struct nvmem_device *nvmem;
ssize_t retlen;
- if (cdev->master)
- nvmem = container_of(cdev->master, struct nvmem_device, cdev);
- else
- nvmem = container_of(cdev, struct nvmem_device, cdev);
+ nvmem = container_of(cdev, struct nvmem_device, cdev);
dev_dbg(cdev->dev, "read ofs: 0x%08llx count: 0x%08zx\n",
offset, count);
@@ -80,10 +77,7 @@ static ssize_t nvmem_cdev_write(struct cdev *cdev, const void *buf, size_t count
struct nvmem_device *nvmem;
ssize_t retlen;
- if (cdev->master)
- nvmem = container_of(cdev->master, struct nvmem_device, cdev);
- else
- nvmem = container_of(cdev, struct nvmem_device, cdev);
+ nvmem = container_of(cdev, struct nvmem_device, cdev);
dev_dbg(cdev->dev, "write ofs: 0x%08llx count: 0x%08zx\n",
offset, count);
--
2.39.5
next prev parent reply other threads:[~2025-06-02 8:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 8:51 [PATCH 0/2] cdev partition fix Sascha Hauer
2025-06-02 8:51 ` [PATCH 1/2] cdev: pass master cdev to cdev ops Sascha Hauer
2025-06-02 9:03 ` Ahmad Fatoum
2025-06-02 10:12 ` Sascha Hauer
2025-06-02 10:20 ` Ahmad Fatoum
2025-06-02 8:51 ` Sascha Hauer [this message]
2025-06-02 12:30 ` [PATCH 0/2] cdev partition fix 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=20250602-cdev-part-fixes-v1-2-814d9aa195ed@pengutronix.de \
--to=s.hauer@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