2024-02-05 10:10:24

by Tudor Ambarus

[permalink] [raw]
Subject: [PATCH] mtd: flashchip: explicitly include <linux/wait.h>

While reviewing the hyperbus sfdp proposal the following problem was
noticed:

In file included from ./include/linux/mtd/gen_probe.h:10,
from drivers/mtd/hyperbus/hyperbus-sfdp.c:6:
/include/linux/mtd/flashchip.h:77:9: error: unknown type name ‘wait_queue_head_t’
77 | wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
| ^~~~~~~~~~~~~~~~~

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.

Explicitly include <linux/wait.h> in include/linux/mtd/flashchip.

Signed-off-by: Tudor Ambarus <[email protected]>
---
include/linux/mtd/flashchip.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index c04f690871ca..9798c1a1d3b6 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -13,6 +13,7 @@
*/
#include <linux/sched.h>
#include <linux/mutex.h>
+#include <linux/wait.h>

typedef enum {
FL_READY,
--
2.34.1



2024-02-05 14:26:32

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH] mtd: flashchip: explicitly include <linux/wait.h>

On Mon, 2024-02-05 at 10:09:55 UTC, Tudor Ambarus wrote:
> While reviewing the hyperbus sfdp proposal the following problem was
> noticed:
>
> In file included from ./include/linux/mtd/gen_probe.h:10,
> from drivers/mtd/hyperbus/hyperbus-sfdp.c:6:
> ./include/linux/mtd/flashchip.h:77:9: error: unknown type name ‘wait_queue_head_t’
> 77 | wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
> | ^~~~~~~~~~~~~~~~~
>
> 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.
>
> Explicitly include <linux/wait.h> in include/linux/mtd/flashchip.
>
> Signed-off-by: Tudor Ambarus <[email protected]>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel