[PATCH 2/2] nvmem: Drop now unnecessary partition quirk
Sascha Hauer
s.hauer at pengutronix.de
Mon Jun 2 01:51:32 PDT 2025
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 at 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
More information about the barebox
mailing list