diff mbox series

macintosh: Explicitly include correct DT includes

Message ID 20230714174654.4058898-1-robh@kernel.org
State Accepted
Commit 233d687d1b78080ee79f67356327e0e0e50ef6f5
Headers show
Series macintosh: Explicitly include correct DT includes | expand

Commit Message

Rob Herring (Arm) July 14, 2023, 5:46 p.m. UTC
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.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/macintosh/ams/ams.h              |  1 -
 drivers/macintosh/smu.c                  |  1 +
 drivers/macintosh/therm_adt746x.c        |  2 ++
 drivers/macintosh/therm_windtunnel.c     | 22 ++++++++++++----------
 drivers/macintosh/windfarm_lm75_sensor.c |  4 ++--
 5 files changed, 17 insertions(+), 13 deletions(-)

Comments

Guenter Roeck Aug. 31, 2023, 2:04 p.m. UTC | #1
On Fri, Jul 14, 2023 at 11:46:54AM -0600, Rob Herring wrote:
> 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.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

This patch results in the following build error.

Building powerpc:ppc32_allmodconfig ... failed
--------------
Error log:
drivers/macintosh/ams/ams-input.c: In function 'ams_input_enable':
drivers/macintosh/ams/ams-input.c:68:45: error: invalid use of undefined type 'struct platform_device'
   68 |         input->dev.parent = &ams_info.of_dev->dev;
      |                                             ^~
drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
drivers/macintosh/ams/ams-input.c:146:51: error: invalid use of undefined type 'struct platform_device'
  146 |         return device_create_file(&ams_info.of_dev->dev, &dev_attr_joystick);
      |                                                   ^~
drivers/macintosh/ams/ams-input.c: In function 'ams_input_exit':
drivers/macintosh/ams/ams-input.c:151:44: error: invalid use of undefined type 'struct platform_device'
  151 |         device_remove_file(&ams_info.of_dev->dev, &dev_attr_joystick);
      |                                            ^~
drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
drivers/macintosh/ams/ams-input.c:147:1: error: control reaches end of non-void function 

Bisect log attached.

Guenter

---
# bad: [b97d64c722598ffed42ece814a2cb791336c6679] Merge tag '6.6-rc-smb3-client-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6
# good: [1c59d383390f970b891b503b7f79b63a02db2ec5] Merge tag 'linux-kselftest-nolibc-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
git bisect start 'HEAD' '1c59d383390f'
# good: [53ea7f624fb91074c2f9458832ed74975ee5d64c] Merge tag 'xfs-6.6-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
git bisect good 53ea7f624fb91074c2f9458832ed74975ee5d64c
# good: [4fb0dacb78c6a041bbd38ddd998df806af5c2c69] Merge tag 'sound-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
git bisect good 4fb0dacb78c6a041bbd38ddd998df806af5c2c69
# good: [05c618f39089d977b0c3dc1105cb6cd5fc53cd01] arm64: dts: use capital "OR" for multiple licenses in SPDX
git bisect good 05c618f39089d977b0c3dc1105cb6cd5fc53cd01
# bad: [4a3b1007eeb26b2bb7ae4d734cc8577463325165] Merge tag 'pinctrl-v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
git bisect bad 4a3b1007eeb26b2bb7ae4d734cc8577463325165
# good: [47ca50600efcf994adb62a9a4e75c77d91bd0781] Merge tag 'soc-defconfig-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect good 47ca50600efcf994adb62a9a4e75c77d91bd0781
# good: [8f447694c23a432b2e9cfe67fb2651f8f6655bfd] Merge tag 'devicetree-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
git bisect good 8f447694c23a432b2e9cfe67fb2651f8f6655bfd
# good: [cd40a1ffddc963e69884a713d8704edd98035861] Merge tag 'qcom-pinctrl-6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt into devel
git bisect good cd40a1ffddc963e69884a713d8704edd98035861
# good: [82a65f0844852cec6a70ac05c7d8edb0586c851c] Merge tag 'intel-pinctrl-v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into devel
git bisect good 82a65f0844852cec6a70ac05c7d8edb0586c851c
# bad: [ef2a0b7cdbc5b84f7b3f6573b7687e72bede0964] Merge tag 'devicetree-header-cleanups-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
git bisect bad ef2a0b7cdbc5b84f7b3f6573b7687e72bede0964
# bad: [233d687d1b78080ee79f67356327e0e0e50ef6f5] macintosh: Explicitly include correct DT includes
git bisect bad 233d687d1b78080ee79f67356327e0e0e50ef6f5
# good: [6303d0693f7d6c44bb6eb0b29c906ee28156dd28] clocksource: Explicitly include correct DT includes
git bisect good 6303d0693f7d6c44bb6eb0b29c906ee28156dd28
# good: [32bc7297d855608fcb13af62a95739a079b4f8e2] hte: Explicitly include correct DT includes
git bisect good 32bc7297d855608fcb13af62a95739a079b4f8e2
# first bad commit: [233d687d1b78080ee79f67356327e0e0e50ef6f5] macintosh: Explicitly include correct DT includes
Randy Dunlap Aug. 31, 2023, 3:15 p.m. UTC | #2
On 8/31/23 07:04, Guenter Roeck wrote:
> On Fri, Jul 14, 2023 at 11:46:54AM -0600, Rob Herring wrote:
>> 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.
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
> 
> This patch results in the following build error.
> 
> Building powerpc:ppc32_allmodconfig ... failed
> --------------
> Error log:
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_enable':
> drivers/macintosh/ams/ams-input.c:68:45: error: invalid use of undefined type 'struct platform_device'
>    68 |         input->dev.parent = &ams_info.of_dev->dev;
>       |                                             ^~
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
> drivers/macintosh/ams/ams-input.c:146:51: error: invalid use of undefined type 'struct platform_device'
>   146 |         return device_create_file(&ams_info.of_dev->dev, &dev_attr_joystick);
>       |                                                   ^~
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_exit':
> drivers/macintosh/ams/ams-input.c:151:44: error: invalid use of undefined type 'struct platform_device'
>   151 |         device_remove_file(&ams_info.of_dev->dev, &dev_attr_joystick);
>       |                                            ^~
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
> drivers/macintosh/ams/ams-input.c:147:1: error: control reaches end of non-void function 
> 
> Bisect log attached.

Hi Guenter,
I posted a patch for this 2 days ago and Michael Ellerman just did a pull request
to Linus with the fix.
diff mbox series

Patch

diff --git a/drivers/macintosh/ams/ams.h b/drivers/macintosh/ams/ams.h
index 2c159c8844c1..e053c1515460 100644
--- a/drivers/macintosh/ams/ams.h
+++ b/drivers/macintosh/ams/ams.h
@@ -8,7 +8,6 @@ 
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <linux/of_device.h>
 
 enum ams_irq {
 	AMS_IRQ_FREEFALL = 0x01,
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 5183a00529f5..b2b78a53e532 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -37,6 +37,7 @@ 
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/sched/signal.h>
 
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 53ea56b286f9..00693741f744 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -25,7 +25,9 @@ 
 #include <linux/kthread.h>
 #include <linux/moduleparam.h>
 #include <linux/freezer.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/platform_device.h>
 
 #include <asm/machdep.h>
 #include <asm/io.h>
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 18a982454321..52289de15058 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -1,9 +1,9 @@ 
-/* 
+/*
  *   Creation Date: <2003/03/14 20:54:13 samuel>
  *   Time-stamp: <2004/03/20 14:20:59 samuel>
- *   
+ *
  *	<therm_windtunnel.c>
- *	
+ *
  *	The G4 "windtunnel" has a single fan controlled by an
  *	ADM1030 fan controller and a DS1775 thermostat.
  *
@@ -20,11 +20,11 @@ 
  *   Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se)
  *
  *   Loosely based upon 'thermostat.c' written by Benjamin Herrenschmidt
- *   
+ *
  *   This program is free software; you can redistribute it and/or
  *   modify it under the terms of the GNU General Public License
  *   as published by the Free Software Foundation
- *   
+ *
  */
 
 #include <linux/types.h>
@@ -36,7 +36,9 @@ 
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/kthread.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/platform_device.h>
 
 #include <asm/machdep.h>
 #include <asm/io.h>
@@ -48,10 +50,10 @@ 
 static struct {
 	volatile int		running;
 	struct task_struct	*poll_task;
-	
+
 	struct mutex	 	lock;
 	struct platform_device	*of_dev;
-	
+
 	struct i2c_client	*thermostat;
 	struct i2c_client	*fan;
 
@@ -127,7 +129,7 @@  write_reg( struct i2c_client *cl, int reg, int data, int len )
 	tmp[1] = (len == 1) ? data : (data >> 8);
 	tmp[2] = data;
 	len++;
-	
+
 	if( i2c_master_send(cl, tmp, len) != len )
 		return -ENODEV;
 	return 0;
@@ -369,7 +371,7 @@  attach_fan( struct i2c_client *cl )
 }
 
 static int
-attach_thermostat( struct i2c_client *cl ) 
+attach_thermostat( struct i2c_client *cl )
 {
 	int hyst_temp, os_temp, temp;
 
@@ -378,7 +380,7 @@  attach_thermostat( struct i2c_client *cl )
 
 	if( (temp=read_reg(cl, 0, 2)) < 0 )
 		goto out;
-	
+
 	/* temperature sanity check */
 	if( temp < 0x1600 || temp > 0x3c00 )
 		goto out;
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index 48dbdb2bda15..6b26e0f92105 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -14,7 +14,7 @@ 
 #include <linux/init.h>
 #include <linux/wait.h>
 #include <linux/i2c.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <asm/machdep.h>
 #include <asm/io.h>
 #include <asm/sections.h>
@@ -128,7 +128,7 @@  static int wf_lm75_probe(struct i2c_client *client)
 		name = "cpu-inlet-temp-1";
 	else
 		return -ENXIO;
- 	
+
 
 	lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
 	if (lm == NULL)