mtd: concat: use container_of_const() in CONCAT()

CONCAT() currently recovers the enclosing struct mtd_concat by casting
its embedded struct mtd_info pointer. This assumes mtd remains the first
member of the structure.

Use container_of_const() with the named member to make the relationship
explicit and preserve any const qualifier.

Suggested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
Harshit Mogalapalli 2026-09-24 14:14:11 -07:00 committed by Miquel Raynal
parent c4f64a86a2
commit 2e566a6830

View File

@ -31,7 +31,7 @@
* Given a pointer to the MTD object in the mtd_concat structure,
* we can retrieve the pointer to that structure with this macro.
*/
#define CONCAT(x) ((struct mtd_concat *)(x))
#define CONCAT(x) container_of_const(x, struct mtd_concat, mtd)
/*
* MTD methods which look up the relevant subdevice, translate the