diff mbox series

pwm: Explicitly include correct DT includes

Message ID 20230714174852.4062251-1-robh@kernel.org
State Handled Elsewhere
Headers show
Series pwm: Explicitly include correct DT includes | expand

Commit Message

Rob Herring (Arm) July 14, 2023, 5:48 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/pwm/core.c               | 1 +
 drivers/pwm/pwm-apple.c          | 1 +
 drivers/pwm/pwm-atmel-hlcdc.c    | 1 +
 drivers/pwm/pwm-atmel-tcb.c      | 3 +--
 drivers/pwm/pwm-atmel.c          | 1 -
 drivers/pwm/pwm-berlin.c         | 1 +
 drivers/pwm/pwm-cros-ec.c        | 1 +
 drivers/pwm/pwm-fsl-ftm.c        | 3 +--
 drivers/pwm/pwm-hibvt.c          | 2 +-
 drivers/pwm/pwm-imx1.c           | 1 -
 drivers/pwm/pwm-jz4740.c         | 2 +-
 drivers/pwm/pwm-lp3943.c         | 1 +
 drivers/pwm/pwm-lpc18xx-sct.c    | 1 +
 drivers/pwm/pwm-mediatek.c       | 1 -
 drivers/pwm/pwm-meson.c          | 1 -
 drivers/pwm/pwm-microchip-core.c | 2 +-
 drivers/pwm/pwm-mtk-disp.c       | 1 -
 drivers/pwm/pwm-pxa.c            | 1 +
 drivers/pwm/pwm-sifive.c         | 1 +
 drivers/pwm/pwm-sl28cpld.c       | 1 +
 drivers/pwm/pwm-sprd.c           | 1 +
 drivers/pwm/pwm-sun4i.c          | 1 -
 drivers/pwm/pwm-sunplus.c        | 1 +
 drivers/pwm/pwm-tegra.c          | 1 -
 drivers/pwm/pwm-tiecap.c         | 2 +-
 drivers/pwm/pwm-tiehrpwm.c       | 2 +-
 drivers/pwm/pwm-visconti.c       | 2 +-
 drivers/pwm/pwm-vt8500.c         | 5 +----
 28 files changed, 21 insertions(+), 21 deletions(-)

Comments

Tzung-Bi Shih July 17, 2023, 4:01 a.m. UTC | #1
On Fri, Jul 14, 2023 at 11:48:50AM -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>

For pwm-cros-ec.c:
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Uwe Kleine-König July 17, 2023, 7:43 a.m. UTC | #2
On Fri, Jul 14, 2023 at 11:48:50AM -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.

so the eventual goal here is to prepare for:

 - drop #include <linux/of_device.h> from include/linux/of_platform.h
 - drop #include <linux/of.h> from include/linux/of_device.h
 - drop #include <linux/of_platform.h> from include/linux/of_device.h
 - drop #include <linux/platform_device.h> from include/linux/of_device.h
 - drop #include <linux/platform_device.h> from include/linux/of_platform.h

> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/pwm/core.c               | 1 +
>  drivers/pwm/pwm-apple.c          | 1 +
>  drivers/pwm/pwm-atmel-hlcdc.c    | 1 +
>  drivers/pwm/pwm-atmel-tcb.c      | 3 +--
>  drivers/pwm/pwm-atmel.c          | 1 -
>  drivers/pwm/pwm-berlin.c         | 1 +
>  drivers/pwm/pwm-cros-ec.c        | 1 +
>  drivers/pwm/pwm-fsl-ftm.c        | 3 +--
>  drivers/pwm/pwm-hibvt.c          | 2 +-
>  drivers/pwm/pwm-imx1.c           | 1 -
>  drivers/pwm/pwm-jz4740.c         | 2 +-
>  drivers/pwm/pwm-lp3943.c         | 1 +
>  drivers/pwm/pwm-lpc18xx-sct.c    | 1 +
>  drivers/pwm/pwm-mediatek.c       | 1 -
>  drivers/pwm/pwm-meson.c          | 1 -
>  drivers/pwm/pwm-microchip-core.c | 2 +-
>  drivers/pwm/pwm-mtk-disp.c       | 1 -
>  drivers/pwm/pwm-pxa.c            | 1 +
>  drivers/pwm/pwm-sifive.c         | 1 +
>  drivers/pwm/pwm-sl28cpld.c       | 1 +
>  drivers/pwm/pwm-sprd.c           | 1 +
>  drivers/pwm/pwm-sun4i.c          | 1 -
>  drivers/pwm/pwm-sunplus.c        | 1 +
>  drivers/pwm/pwm-tegra.c          | 1 -
>  drivers/pwm/pwm-tiecap.c         | 2 +-
>  drivers/pwm/pwm-tiehrpwm.c       | 2 +-
>  drivers/pwm/pwm-visconti.c       | 2 +-
>  drivers/pwm/pwm-vt8500.c         | 5 +----
>  28 files changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index 3dacceaef4a9..d37617c60eae 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -8,6 +8,7 @@
>  
>  #include <linux/acpi.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  #include <linux/pwm.h>
>  #include <linux/radix-tree.h>
>  #include <linux/list.h>

This file includes neither of_device.h nor of_platform.h and up to now
gets of.h via <linux/pwm.h>.

What is your plan for <linux/pwm.h>'s include? I think it would only need

	struct of_phandle_args;

to replace that. (But that would need another patch like this one, as
then e.g. drivers/pwm/pwm-sl28cpld.c fails to compile because
device_property_read_u32() is undeclared. It would need to #include
<linux/property.h> which now it gets transitively via <linux/of.h>.)

If <linux/pwm.h> is planed to continue #including <linux/of.h>, the
explicit include here isn't necessary (and probably elsewhere).

I don't care much either way, but maybe your quest would be a bit
simpler if you only touch files that include the two files you want to
modify?

*shrug*, this patch is still an improvement so:

Acked-by: Uwe Kleine-Köng <u.kleine-koenig@pengutronix.de>

Another thing I wonder is: How did you identify the files that need
these includes. I guess you have a list of types for each header and
search for files that use any of the types but doesn't include the
respecitve header? I wonder if tracking this type -> header mapping in
machine readable form somewhere would be nice, to e.g. make checkpatch
warn if a file uses struct of_node but only gets it by chance?

Best regards
Uwe
Rob Herring (Arm) July 17, 2023, 3:59 p.m. UTC | #3
On Mon, Jul 17, 2023 at 1:44 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> On Fri, Jul 14, 2023 at 11:48:50AM -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.
>
> so the eventual goal here is to prepare for:
>
>  - drop #include <linux/of_device.h> from include/linux/of_platform.h
>  - drop #include <linux/of.h> from include/linux/of_device.h
>  - drop #include <linux/of_platform.h> from include/linux/of_device.h
>  - drop #include <linux/platform_device.h> from include/linux/of_device.h
>  - drop #include <linux/platform_device.h> from include/linux/of_platform.h

Yes.

> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> >  drivers/pwm/core.c               | 1 +
> >  drivers/pwm/pwm-apple.c          | 1 +
> >  drivers/pwm/pwm-atmel-hlcdc.c    | 1 +
> >  drivers/pwm/pwm-atmel-tcb.c      | 3 +--
> >  drivers/pwm/pwm-atmel.c          | 1 -
> >  drivers/pwm/pwm-berlin.c         | 1 +
> >  drivers/pwm/pwm-cros-ec.c        | 1 +
> >  drivers/pwm/pwm-fsl-ftm.c        | 3 +--
> >  drivers/pwm/pwm-hibvt.c          | 2 +-
> >  drivers/pwm/pwm-imx1.c           | 1 -
> >  drivers/pwm/pwm-jz4740.c         | 2 +-
> >  drivers/pwm/pwm-lp3943.c         | 1 +
> >  drivers/pwm/pwm-lpc18xx-sct.c    | 1 +
> >  drivers/pwm/pwm-mediatek.c       | 1 -
> >  drivers/pwm/pwm-meson.c          | 1 -
> >  drivers/pwm/pwm-microchip-core.c | 2 +-
> >  drivers/pwm/pwm-mtk-disp.c       | 1 -
> >  drivers/pwm/pwm-pxa.c            | 1 +
> >  drivers/pwm/pwm-sifive.c         | 1 +
> >  drivers/pwm/pwm-sl28cpld.c       | 1 +
> >  drivers/pwm/pwm-sprd.c           | 1 +
> >  drivers/pwm/pwm-sun4i.c          | 1 -
> >  drivers/pwm/pwm-sunplus.c        | 1 +
> >  drivers/pwm/pwm-tegra.c          | 1 -
> >  drivers/pwm/pwm-tiecap.c         | 2 +-
> >  drivers/pwm/pwm-tiehrpwm.c       | 2 +-
> >  drivers/pwm/pwm-visconti.c       | 2 +-
> >  drivers/pwm/pwm-vt8500.c         | 5 +----
> >  28 files changed, 21 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > index 3dacceaef4a9..d37617c60eae 100644
> > --- a/drivers/pwm/core.c
> > +++ b/drivers/pwm/core.c
> > @@ -8,6 +8,7 @@
> >
> >  #include <linux/acpi.h>
> >  #include <linux/module.h>
> > +#include <linux/of.h>
> >  #include <linux/pwm.h>
> >  #include <linux/radix-tree.h>
> >  #include <linux/list.h>
>
> This file includes neither of_device.h nor of_platform.h and up to now
> gets of.h via <linux/pwm.h>.

Indeed.

> What is your plan for <linux/pwm.h>'s include? I think it would only need
>
>         struct of_phandle_args;

Here's what I'm testing with:

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 04ae1d9073a7..5a59a7d53be8 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -4,8 +4,10 @@

 #include <linux/err.h>
 #include <linux/mutex.h>
-#include <linux/of.h>

+struct device;
+struct fwnode_handle;
+struct of_phandle_args;
 struct pwm_chip;

 /**

>
> to replace that. (But that would need another patch like this one, as
> then e.g. drivers/pwm/pwm-sl28cpld.c fails to compile because
> device_property_read_u32() is undeclared. It would need to #include
> <linux/property.h> which now it gets transitively via <linux/of.h>.)

property.h is added in this patch, so it should be okay?

> If <linux/pwm.h> is planed to continue #including <linux/of.h>, the
> explicit include here isn't necessary (and probably elsewhere).

I would like to drop including of.h, but probably not this cycle.
Either way, I thought kernel best practice was to not rely on implicit
includes.

BTW, linux/i2c.h is another source of lots of implicit of.h includes.
That one looks like we can't get rid of.

> I don't care much either way, but maybe your quest would be a bit
> simpler if you only touch files that include the two files you want to
> modify?

Yes, that's how it started. I kind of decided it wasn't worth trying
to split things up by every separate reason explicit includes were not
correct.

>
> *shrug*, this patch is still an improvement so:
>
> Acked-by: Uwe Kleine-Köng <u.kleine-koenig@pengutronix.de>
>
> Another thing I wonder is: How did you identify the files that need
> these includes. I guess you have a list of types for each header and
> search for files that use any of the types but doesn't include the
> respecitve header? I wonder if tracking this type -> header mapping in
> machine readable form somewhere would be nice, to e.g. make checkpatch
> warn if a file uses struct of_node but only gets it by chance?

It's been less automated than I'd like. It's been a lot of grepping
with a list of symbols the headers provide. For example, I get all the
files including of_device.h and then get the ones with no symbols from
of_device.h. And then do a manual review of what are the correct
headers for the file. And then run thru builds and fix all the issues.

Rob
Nobuhiro Iwamatsu July 17, 2023, 10:39 p.m. UTC | #4
Hi,

> -----Original Message-----
> From: Rob Herring <robh@kernel.org>
> Sent: Saturday, July 15, 2023 2:49 AM
> To: Thierry Reding <thierry.reding@gmail.com>; Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de>; Hector Martin <marcan@marcan.st>;
> Sven Peter <sven@svenpeter.dev>; Alyssa Rosenzweig
> <alyssa@rosenzweig.io>; Nicolas Ferre <nicolas.ferre@microchip.com>;
> Alexandre Belloni <alexandre.belloni@bootlin.com>; Claudiu Beznea
> <claudiu.beznea@microchip.com>; Benson Leung <bleung@chromium.org>;
> Guenter Roeck <groeck@chromium.org>; Shawn Guo
> <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; NXP Linux Team <linux-imx@nxp.com>; Paul
> Cercueil <paul@crapouillou.net>; Vladimir Zapolskiy <vz@mleia.com>; Neil
> Armstrong <neil.armstrong@linaro.org>; Kevin Hilman
> <khilman@baylibre.com>; Jerome Brunet <jbrunet@baylibre.com>; Martin
> Blumenstingl <martin.blumenstingl@googlemail.com>; Conor Dooley
> <conor.dooley@microchip.com>; Daire McNamara
> <daire.mcnamara@microchip.com>; Matthias Brugger
> <matthias.bgg@gmail.com>; AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com>; Palmer Dabbelt
> <palmer@dabbelt.com>; Paul Walmsley <paul.walmsley@sifive.com>;
> Michael Walle <michael@walle.cc>; Orson Zhai <orsonzhai@gmail.com>;
> Baolin Wang <baolin.wang@linux.alibaba.com>; Chunyan Zhang
> <zhang.lyra@gmail.com>; Chen-Yu Tsai <wens@csie.org>; Jernej Skrabec
> <jernej.skrabec@gmail.com>; Samuel Holland <samuel@sholland.org>;
> Hammer Hsieh <hammerh0314@gmail.com>; Jonathan Hunter
> <jonathanh@nvidia.com>; iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT
> ○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>
> Cc: devicetree@vger.kernel.org; linux-pwm@vger.kernel.org;
> linux-kernel@vger.kernel.org; asahi@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; chrome-platform@lists.linux.dev;
> linux-mips@vger.kernel.org; linux-amlogic@lists.infradead.org;
> linux-riscv@lists.infradead.org; linux-mediatek@lists.infradead.org;
> linux-sunxi@lists.linux.dev; linux-tegra@vger.kernel.org
> Subject: [PATCH] pwm: 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.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

For drivers/pwm/pwm-visconti.c:
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

Best regards,
  Nobuhiro
Thierry Reding July 20, 2023, 2:41 p.m. UTC | #5
On Fri, 14 Jul 2023 11:48:50 -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.
> 
> [...]

Applied, thanks!

[1/1] pwm: Explicitly include correct DT includes
      commit: 8d171282110fcde89bb4289c4010a15aca5cec95

Best regards,
patchwork-bot+chrome-platform@kernel.org Sept. 11, 2023, 4:31 a.m. UTC | #6
Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Thierry Reding <thierry.reding@gmail.com>:

On Fri, 14 Jul 2023 11:48:50 -0600 you 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.
> 
> [...]

Here is the summary with links:
  - pwm: Explicitly include correct DT includes
    https://git.kernel.org/chrome-platform/c/0a41b0c5d97a

You are awesome, thank you!
patchwork-bot+chrome-platform@kernel.org Sept. 11, 2023, 4:49 a.m. UTC | #7
Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Thierry Reding <thierry.reding@gmail.com>:

On Fri, 14 Jul 2023 11:48:50 -0600 you 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.
> 
> [...]

Here is the summary with links:
  - pwm: Explicitly include correct DT includes
    https://git.kernel.org/chrome-platform/c/0a41b0c5d97a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 3dacceaef4a9..d37617c60eae 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -8,6 +8,7 @@ 
 
 #include <linux/acpi.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/pwm.h>
 #include <linux/radix-tree.h>
 #include <linux/list.h>
diff --git a/drivers/pwm/pwm-apple.c b/drivers/pwm/pwm-apple.c
index a38a62edd713..8e7d67fb5fbe 100644
--- a/drivers/pwm/pwm-apple.c
+++ b/drivers/pwm/pwm-apple.c
@@ -12,6 +12,7 @@ 
  * - When APPLE_PWM_CTRL is set to 0, the output is constant low
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index 96a709a9d49a..3c42061e721a 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -10,6 +10,7 @@ 
 #include <linux/delay.h>
 #include <linux/mfd/atmel-hlcdc.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/regmap.h>
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 4a116dc44f6e..563162d660d8 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -19,8 +19,7 @@ 
 #include <linux/mfd/syscon.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
-#include <linux/of_device.h>
-#include <linux/of_irq.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <soc/at91/atmel_tcb.h>
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index 5f7d286871cf..4b243c0e8490 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -25,7 +25,6 @@ 
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c
index 0c5992a046b2..0971c666afd1 100644
--- a/drivers/pwm/pwm-berlin.c
+++ b/drivers/pwm/pwm-berlin.c
@@ -13,6 +13,7 @@ 
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
index 74e863aa1d8d..7f7e4e892930 100644
--- a/drivers/pwm/pwm-cros-ec.c
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -6,6 +6,7 @@ 
  */
 
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_data/cros_ec_commands.h>
 #include <linux/platform_data/cros_ec_proto.h>
 #include <linux/platform_device.h>
diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c
index 5caadbd6194e..b7c6045c5d08 100644
--- a/drivers/pwm/pwm-fsl-ftm.c
+++ b/drivers/pwm/pwm-fsl-ftm.c
@@ -11,8 +11,7 @@ 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
-#include <linux/of_address.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c
index b95df1a96127..f7ba6fe9a349 100644
--- a/drivers/pwm/pwm-hibvt.c
+++ b/drivers/pwm/pwm-hibvt.c
@@ -10,7 +10,7 @@ 
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/reset.h>
diff --git a/drivers/pwm/pwm-imx1.c b/drivers/pwm/pwm-imx1.c
index 1f2eb1c8ff6c..0651983bed19 100644
--- a/drivers/pwm/pwm-imx1.c
+++ b/drivers/pwm/pwm-imx1.c
@@ -14,7 +14,6 @@ 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 3b7067f6cd0d..ef1293f2a897 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -15,7 +15,7 @@ 
 #include <linux/mfd/ingenic-tcu.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/regmap.h>
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
index 35675e4058c6..a931d3f7a3fc 100644
--- a/drivers/pwm/pwm-lp3943.c
+++ b/drivers/pwm/pwm-lp3943.c
@@ -10,6 +10,7 @@ 
 #include <linux/err.h>
 #include <linux/mfd/lp3943.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index b9bf5b366f4b..9ff6311bd472 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -22,6 +22,7 @@ 
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
index 7a51d210a877..6adb0ed01906 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -14,7 +14,6 @@ 
 #include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 22f54db3ae8e..25519cddc2a9 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -37,7 +37,6 @@ 
 #include <linux/math64.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
diff --git a/drivers/pwm/pwm-microchip-core.c b/drivers/pwm/pwm-microchip-core.c
index 8750b57684a9..e7525c98105e 100644
--- a/drivers/pwm/pwm-microchip-core.c
+++ b/drivers/pwm/pwm-microchip-core.c
@@ -37,7 +37,7 @@ 
 #include <linux/math.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 
diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 2401b6733241..a83bd6e18b07 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -11,7 +11,6 @@ 
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index 762429d5647f..c8314053bcb0 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -15,6 +15,7 @@ 
  *   input clock (PWMCR_SD is set) and the output is driven to inactive.
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c
index ae49d67ab2b1..3743b2de4597 100644
--- a/drivers/pwm/pwm-sifive.c
+++ b/drivers/pwm/pwm-sifive.c
@@ -13,6 +13,7 @@ 
  */
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-sl28cpld.c b/drivers/pwm/pwm-sl28cpld.c
index e64900ad4ba1..d497e87f5e03 100644
--- a/drivers/pwm/pwm-sl28cpld.c
+++ b/drivers/pwm/pwm-sl28cpld.c
@@ -38,6 +38,7 @@ 
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/pwm.h>
 #include <linux/regmap.h>
 
diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
index d43a6fa3f4e0..1499c8c1fe37 100644
--- a/drivers/pwm/pwm-sprd.c
+++ b/drivers/pwm/pwm-sprd.c
@@ -7,6 +7,7 @@ 
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/math64.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index a8790a8fc53e..c84fcf1a13dc 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -17,7 +17,6 @@ 
 #include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/reset.h>
diff --git a/drivers/pwm/pwm-sunplus.c b/drivers/pwm/pwm-sunplus.c
index d6ebe9f03b35..7705c7b86c3a 100644
--- a/drivers/pwm/pwm-sunplus.c
+++ b/drivers/pwm/pwm-sunplus.c
@@ -23,6 +23,7 @@ 
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
index 5810abf66e2a..a169a34e0778 100644
--- a/drivers/pwm/pwm-tegra.c
+++ b/drivers/pwm/pwm-tegra.c
@@ -41,7 +41,6 @@ 
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/pm_opp.h>
 #include <linux/pwm.h>
 #include <linux/platform_device.h>
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index 109449956307..8c94b266c1b2 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -12,7 +12,7 @@ 
 #include <linux/clk.h>
 #include <linux/pm_runtime.h>
 #include <linux/pwm.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 
 /* ECAP registers and bits definitions */
 #define CAP1			0x08
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index bb3959ace6b4..ecbfd7e954ec 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -12,7 +12,7 @@ 
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/pm_runtime.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 
 /* EHRPWM registers and bits definitions */
 
diff --git a/drivers/pwm/pwm-visconti.c b/drivers/pwm/pwm-visconti.c
index e3fb79b3e2a7..7f7591a2384c 100644
--- a/drivers/pwm/pwm-visconti.c
+++ b/drivers/pwm/pwm-visconti.c
@@ -21,7 +21,7 @@ 
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index d2c48fd98706..6d46db51daac 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -6,6 +6,7 @@ 
  * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
@@ -18,10 +19,6 @@ 
 
 #include <asm/div64.h>
 
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/of_address.h>
-
 /*
  * SoC architecture allocates register space for 4 PWMs but only
  * 2 are currently implemented.