mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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:
parent
c4f64a86a2
commit
2e566a6830
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user