Skip to contentSkip to conversation

pwm: pxa: Explicitly include correct DT includes

PATCH Applied Rob Herring 3 participants 4 messages Oct 9, 2023 – Oct 12, 2023 PWM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: pxa: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes.

---
 drivers/pwm/pwm-pxa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-pxa.c +1 -1
index 1e475ed10180..78b04e017c49 100644
@@ -24,7 +24,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/pwm.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 
 #include <asm/div64.h>
 
Signature · 1 line
2.42.0
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Rob Herring

The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes.

---
 drivers/pwm/pwm-pxa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-pxa.c +0 -0
index 1e475ed10180..78b04e017c49 100644

drivers/pwm/pwm-pxa.c line 27

Quoted 5 lines
drivers/pwm/pwm-pxa.c +1 -1
@@ -24,7 +24,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/pwm.h>
-#include <linux/of_device.h>
+#include <linux/of.h>

Even without both headers the driver compiles fine as linux/pwm.h includes of.h.

I think we should do:

include/linux/pwm.h +1 -1
index d2f9f690a9c1..9e35970ca2ab 100644
@@ -4,8 +4,8 @@
 
 #include <linux/err.h>
 #include <linux/mutex.h>
-#include <linux/of.h>
 
+struct of_phandle_args;
 struct pwm_chip;
 
 /**

drivers/pmw/* compiles fine with this change.

Other than that:

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#3 lore raw
In reply to Rob Herring
Quoted 10 lines · Rob Herring

The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes.

[...]

Applied, thanks!

[1/1] pwm: pxa: Explicitly include correct DT includes

      commit: 1d1d7ed2fb47b83496bb708eca0974a2741eb8ca

Best regards,

Signature · 1 line
Thierry Reding <[email protected]>
#2 lore raw
In reply to Uwe Kleine-König
Quoted 16 lines · Uwe Kleine-König
Quoted 14 lines · Rob Herring

The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes.

---
 drivers/pwm/pwm-pxa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/pwm/pwm-pxa.c line 27

Quoted 10 lines
drivers/pwm/pwm-pxa.c +1 -1
index 1e475ed10180..78b04e017c49 100644
@@ -24,7 +24,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/pwm.h>
-#include <linux/of_device.h>
+#include <linux/of.h>

Even without both headers the driver compiles fine as linux/pwm.h includes of.h.

Yes, that's just one of several:

 include/linux/pm_domain.h  | 4 +++-
 include/linux/remoteproc.h | 3 ++-
 include/linux/thermal.h    | 4 +++-
 include/linux/cpu_cooling.h                | 1 -
 include/linux/fsl/bestcomm/bestcomm_priv.h | 1 -
 include/linux/mailbox_client.h             | 4 ++--
 include/linux/mailbox_controller.h         | 2 +-
 include/linux/phy/phy.h                    | 5 +++--
 include/linux/pwm.h                        | 4 +++-
 include/net/dsa.h                          | 2 +-
Quoted 8 lines

I think we should do:

include/linux/pwm.h +0 -0
index d2f9f690a9c1..9e35970ca2ab 100644

include/linux/pwm.h line 8

Quoted 6 lines
include/linux/pwm.h +1 -1
@@ -4,8 +4,8 @@
 
 #include <linux/err.h>
 #include <linux/mutex.h>
-#include <linux/of.h>
 
+struct of_phandle_args;

Also used in the header:

+struct device;
+struct fwnode_handle;

Quoted 5 lines
include/linux/pwm.h +0 -0
 struct pwm_chip;
 
 /**

drivers/pmw/* compiles fine with this change.

Agreed in what I tested so far.

But I'm running out of gas on doing more of this, so once I get of_device.h and of_platform.h detangled, I'm probably done for a while at least. IOW, feel free to submit a patch for pwm.h.

Quoted 4 lines

Other than that:

Thanks!

Rob