[PATCH v2] mtd: spi-nor: explicitly include <linux/math64.h>

Tudor Ambarus posted 1 patch 9 months, 3 weeks ago
drivers/mtd/spi-nor/otp.c | 1 +
drivers/mtd/spi-nor/swp.c | 1 +
2 files changed, 2 insertions(+)
[PATCH v2] mtd: spi-nor: explicitly include <linux/math64.h>
Posted by Tudor Ambarus 9 months, 3 weeks ago
swp and otp drivers use div_u64 and div64_u64 and rely on implicit
inclusion of <linux/math64.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>
---
Changes in v2:
- fix typo in commit message s/if/of/.
- Link to v1: https://lore.kernel.org/r/20250223-snor-math64-v1-1-8c7653111356@linaro.org
---
 drivers/mtd/spi-nor/otp.c | 1 +
 drivers/mtd/spi-nor/swp.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/mtd/spi-nor/otp.c b/drivers/mtd/spi-nor/otp.c
index 9a729aa3452d..7d0b145d78d8 100644
--- a/drivers/mtd/spi-nor/otp.c
+++ b/drivers/mtd/spi-nor/otp.c
@@ -6,6 +6,7 @@
  */
 
 #include <linux/log2.h>
+#include <linux/math64.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/spi-nor.h>
 
diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c
index e48c3cff247a..9c9328478d8a 100644
--- a/drivers/mtd/spi-nor/swp.c
+++ b/drivers/mtd/spi-nor/swp.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2005, Intec Automation Inc.
  * Copyright (C) 2014, Freescale Semiconductor, Inc.
  */
+#include <linux/math64.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/spi-nor.h>
 

---
base-commit: 03e7bb864d9a9efca02743d4a9fab8f3d0b00407
change-id: 20250223-snor-math64-8d8d6db27a42

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@linaro.org>
Re: [PATCH v2] mtd: spi-nor: explicitly include <linux/math64.h>
Posted by Tudor Ambarus 9 months, 2 weeks ago
On Sun, 23 Feb 2025 06:51:10 +0000, Tudor Ambarus wrote:
> swp and otp drivers use div_u64 and div64_u64 and rely on implicit
> inclusion of <linux/math64.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.
> 
> [...]

Applied, thanks!

[1/1] mtd: spi-nor: explicitly include <linux/math64.h>
      https://git.kernel.org/mtd/c/93020292fea7

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@linaro.org>
Re: [PATCH v2] mtd: spi-nor: explicitly include <linux/math64.h>
Posted by Pratyush Yadav 9 months, 3 weeks ago
On Sun, Feb 23 2025, Tudor Ambarus wrote:

> swp and otp drivers use div_u64 and div64_u64 and rely on implicit
> inclusion of <linux/math64.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: Pratyush Yadav <pratyush@kernel.org>

-- 
Regards,
Pratyush Yadav