[PATCH 1/3] mtd: spi-nor: explicitly include <linux/of.h>

Tudor Ambarus posted 3 patches 11 months, 1 week ago
[PATCH 1/3] mtd: spi-nor: explicitly include <linux/of.h>
Posted by Tudor Ambarus 11 months, 1 week ago
The core driver is using of_property_read_bool() and relies on implicit
inclusion of <linux/of.h>, which comes from <linux/mtd/mtd.h>.

It is good practice to directly include all headers used, it avoids
implicit dependencies and spurious breakage if someone rearranges
headers and causes the implicit include to vanish.

Include the missing header.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/mtd/spi-nor/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index c9b970f35c6b23a962011ee3c543ee9f4df711d5..1091c83294fa33393f27f914efb254da7a7524a2 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -17,6 +17,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/spi-nor.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/regulator/consumer.h>
 #include <linux/sched/task_stack.h>

-- 
2.34.1
Re: [PATCH 1/3] mtd: spi-nor: explicitly include <linux/of.h>
Posted by Miquel Raynal 11 months, 1 week ago
On 07/03/2025 at 09:09:05 +02, Tudor Ambarus <tudor.ambarus@linaro.org> wrote:

> The core driver is using of_property_read_bool() and relies on implicit
> inclusion of <linux/of.h>, which comes from <linux/mtd/mtd.h>.
>
> It is good practice to directly include all headers used, it avoids
> implicit dependencies and spurious breakage if someone rearranges
> headers and causes the implicit include to vanish.
>
> Include the missing header.
>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl