]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mtd: rawnand: qcom: embed nand_controller into qcom_nand_controller
authorRosen Penev <rosenp@gmail.com>
Mon, 25 May 2026 22:04:40 +0000 (15:04 -0700)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 27 May 2026 09:10:21 +0000 (11:10 +0200)
commit7fbdbc7d028a20a78b7d28a9510a216c76b5fbfd
treed43b8a7eacc8f322c7eba18290b0d3a83379beae
parent8e4531667d718e2e9b193928cf9b2497fa0d01ef
mtd: rawnand: qcom: embed nand_controller into qcom_nand_controller

The qcom_nand_controller had a struct nand_controller *controller
pointer that was assigned to (struct nand_controller *)&nandc[1],
with the allocation oversized by sizeof(*controller) to make room.
get_qcom_nand_controller() then walked backwards from chip->controller
using sizeof()-based arithmetic to recover the enclosing nandc.

Embed the nand_controller directly into qcom_nand_controller and use
container_of() in get_qcom_nand_controller(). The header now needs
the full rawnand.h definition rather than a forward declaration.

Assisted-by: Claude:Opus-4.7
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/qcom_nandc.c
include/linux/mtd/nand-qpic-common.h