Skip to contentSkip to conversation

Cleanup io.h

PATCH In review Raag Jadav 3 participants 14 messages Feb 27, 2025 – Mar 3, 2025

Subsystems (4)
lore
Share & tools
lore

Raag Jadav

author
#0 lore raw

v3 cover Cleanup io.h

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

v2: Fix sparc build errors
v3: Fix nios2 build errors and re-order patches

Raag Jadav (2):
drm/draw: include missing headers
io.h: drop unused headers

 drivers/gpu/drm/drm_draw.c | 2 ++
 include/linux/io.h         | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

base-commit: b8c38ccb2ca52b9a38cfeb9f89abab5d6e713221

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v3 1/2 drm/draw: include missing headers

Include headers for the symbols directly used in this file instead of relying on intermediate headers.

---
 drivers/gpu/drm/drm_draw.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_draw.c +2 -0
index cb2ad12bce57..385eb5e10047 100644
@@ -5,6 +5,8 @@
  */
 
 #include <linux/bits.h>
+#include <linux/bug.h>
+#include <linux/export.h>
 #include <linux/iosys-map.h>
 #include <linux/types.h>
 
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v3 2/2 io.h: drop unused headers

In reply to Raag Jadav

Drop unused headers and type declaration from io.h.

---
 include/linux/io.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/io.h +0 -3
index 40cb2de73f5e..6a6bc4d46d0a 100644
@@ -9,13 +9,10 @@
 #include <linux/sizes.h>
 #include <linux/types.h>
 #include <linux/init.h>
-#include <linux/bug.h>
-#include <linux/err.h>
 #include <asm/io.h>
 #include <asm/page.h>
 
 struct device;
-struct resource;
 
 #ifndef __iowrite32_copy
 void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
Signature · 1 line
2.34.1
#3 lore raw
In reply to Raag Jadav
Quoted 9 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Quoted 6 lines

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

Quoted 6 lines
Quoted 3 lines

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Arnd

author
#5 lore raw
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Probably because the immutable tag is already in -next?

Raag

#6 lore raw
Quoted 19 lines · Raag Jadav
Quoted 18 lines · Arnd Bergmann
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Probably because the immutable tag is already in -next?

Is there any?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
Quoted 20 lines · Andy Shevchenko
Quoted 19 lines · Raag Jadav
Quoted 18 lines · Arnd Bergmann
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Probably because the immutable tag is already in -next?

Is there any?

Ah, you mean devres related?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#8 lore raw
Quoted 24 lines · Andy Shevchenko
Quoted 23 lines · Andy Shevchenko
Quoted 22 lines · Raag Jadav
Quoted 21 lines · Arnd Bergmann
Quoted 19 lines · Andy Shevchenko
Quoted 9 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Quoted 6 lines

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I've applied it yesterday and not seen any regression reports so far.

Probably because the immutable tag is already in -next?

Is there any?

Ah, you mean devres related?

Yeah, couldn't find it on Arnd's tree and I'm not sure if this series works without it.

Raag

#9 lore raw
Quoted 27 lines · Raag Jadav
Quoted 26 lines · Andy Shevchenko
Quoted 25 lines · Andy Shevchenko
Quoted 24 lines · Raag Jadav
Quoted 22 lines · Arnd Bergmann
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

Quoted 6 lines
Quoted 3 lines

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Probably because the immutable tag is already in -next?

Is there any?

Ah, you mean devres related?

Yeah, couldn't find it on Arnd's tree and I'm not sure if this series works without it.

But err.h is included in the io.h, no? Or did I misunderstand the point?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#10 lore raw
Quoted 30 lines · Andy Shevchenko
Quoted 29 lines · Raag Jadav
Quoted 28 lines · Andy Shevchenko
Quoted 27 lines · Andy Shevchenko
Quoted 25 lines · Raag Jadav
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Probably because the immutable tag is already in -next?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Is there any?

Ah, you mean devres related?

Yeah, couldn't find it on Arnd's tree and I'm not sure if this series works without it.

But err.h is included in the io.h, no? Or did I misunderstand the point?

First patch on the immutable tag moves IOMEM_ERR_PTR() to err.h and here we're dropping err.h from io.h. So without the tag this series will probably break IOMEM_ERR_PTR().

Raag

#11 lore raw
Quoted 35 lines · Raag Jadav
Quoted 34 lines · Andy Shevchenko
Quoted 33 lines · Raag Jadav
Quoted 31 lines · Andy Shevchenko
Quoted 20 lines · Andy Shevchenko
Quoted 19 lines · Raag Jadav
Quoted 18 lines · Arnd Bergmann
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Raag Jadav

This series attempts to cleanup io.h with "include what you use" approach. This depends on changes available on immutable tag[1].

Although this series is too trivial in the grand scheme of things, it is still a tiny step towards untangling core headers. I have success results from LKP for this series but there can still be corner cases. So perhaps we can queue this on a temporary branch which we can use to submit fixes in case of fallout.

Future plan is to use the excellent analysis[2][3] by Arnd to cleanup other headers.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
[3] https://lore.kernel.org/r/[email protected]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I believe Arnd can take it through his tree for headers as DRM part is Acked already.

I've applied it yesterday and not seen any regression reports so far.

Probably because the immutable tag is already in -next?

Is there any?

Ah, you mean devres related?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Yeah, couldn't find it on Arnd's tree and I'm not sure if this series works without it.

But err.h is included in the io.h, no? Or did I misunderstand the point?

First patch on the immutable tag moves IOMEM_ERR_PTR() to err.h and here we're dropping err.h from io.h. So without the tag this series will probably break IOMEM_ERR_PTR().

I see, I think it might be due to some other includes that make this happen. Whatever, I assume that Arnd heavily tested this anyway, so it's good to go independently on the immutable tag..

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#12 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Raag Jadav
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Ah, you mean devres related?

Yeah, couldn't find it on Arnd's tree and I'm not sure if this series works without it.

But err.h is included in the io.h, no? Or did I misunderstand the point?

Quoted 7 lines
Quoted 3 lines

First patch on the immutable tag moves IOMEM_ERR_PTR() to err.h and here we're dropping err.h from io.h. So without the tag this series will probably break IOMEM_ERR_PTR().

I see, I think it might be due to some other includes that make this happen. Whatever, I assume that Arnd heavily tested this anyway, so it's good to go independently on the immutable tag..

I see that err.h gets included through at least linux/string.h, linux/logic_pio.h and (depending on the architecture architectures) asm/page.h, so there is no huge risk of something breaking here ;-)

Ideally all of the above should be removed here, but to do it right, the linux/pgtable.h dependency needs to also be replaced with a smaller pgprot_t specific one, which takes a bit of cross-platform work as the definition is not in a consistent place at the moment.

The change below still builds fine, and that likely indicates that the same headers are still included from either asm/io.h or asm/pgtable.h on the architectures I'm testing.

Arnd

----

include/asm-generic/io.h +2 -2
index 402020b23423..60a162591072 100644
@@ -7,16 +7,16 @@
 #ifndef __ASM_GENERIC_IO_H
 #define __ASM_GENERIC_IO_H
 
-#include <asm/page.h> /* I/O is all done through memory accesses */
-#include <linux/string.h> /* for memset() and memcpy() */
 #include <linux/sizes.h>
 #include <linux/types.h>
 #include <linux/instruction_pointer.h>
+#include <linux/compiler.h>
 
 #ifdef CONFIG_GENERIC_IOMAP
 #include <asm-generic/iomap.h>
 #endif
 
+#include <asm/byteorder.h>
 #include <asm/mmiowb.h>
 #include <asm-generic/pci_iomap.h>
 
include/linux/logic_pio.h +3 -1
index 8f1a9408302f..a83286bf13ab 100644
@@ -8,7 +8,9 @@
 #ifndef __LINUX_LOGIC_PIO_H
 #define __LINUX_LOGIC_PIO_H
 
-#include <linux/fwnode.h>
+#include <linux/types.h>
+
+struct fwnode_handle;
 
 enum {
        LOGIC_PIO_INDIRECT,             /* Indirect IO flag */
#13 lore raw
Quoted 27 lines · Arnd Bergmann
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Raag Jadav
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Ah, you mean devres related?

Yeah, couldn't find it on Arnd's tree and I'm not sure if this series works without it.

But err.h is included in the io.h, no? Or did I misunderstand the point?

Quoted 7 lines
Quoted 3 lines

First patch on the immutable tag moves IOMEM_ERR_PTR() to err.h and here we're dropping err.h from io.h. So without the tag this series will probably break IOMEM_ERR_PTR().

I see, I think it might be due to some other includes that make this happen. Whatever, I assume that Arnd heavily tested this anyway, so it's good to go independently on the immutable tag..

I see that err.h gets included through at least linux/string.h, linux/logic_pio.h and (depending on the architecture architectures) asm/page.h, so there is no huge risk of something breaking here ;-)

Ideally all of the above should be removed here, but to do it right, the linux/pgtable.h dependency needs to also be replaced with a smaller pgprot_t specific one, which takes a bit of cross-platform work as the definition is not in a consistent place at the moment.

Quoted 3 lines

The change below still builds fine, and that likely indicates that the same headers are still included from either asm/io.h or asm/pgtable.h on the architectures I'm testing.

Sounds even better. Can you submit a formal patch that other CIs will have a chance to go through this?

Signature · 2 lines
With Best Regards,
Andy Shevchenko