devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Rob Herring <robh@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	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>,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	chrome-platform@lists.linux.dev, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
	linux-mips@vger.kernel.org, linux-mediatek@lists.infradead.org,
	asahi@lists.linux.dev, linux-tegra@vger.kernel.org,
	linux-amlogic@lists.infradead.org,
	linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pwm: Explicitly include correct DT includes
Date: Mon, 17 Jul 2023 09:43:52 +0200	[thread overview]
Message-ID: <20230717074352.dz3ex7fwi77loayc@pengutronix.de> (raw)
In-Reply-To: <20230714174852.4062251-1-robh@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 4184 bytes --]

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2023-07-17  7:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 17:48 [PATCH] pwm: Explicitly include correct DT includes Rob Herring
2023-07-17  4:01 ` Tzung-Bi Shih
2023-07-17  7:43 ` Uwe Kleine-König [this message]
2023-07-17 15:59   ` Rob Herring
2023-07-17 22:39 ` nobuhiro1.iwamatsu
2023-07-20 14:41 ` Thierry Reding
2023-09-11  4:31 ` patchwork-bot+chrome-platform
2023-09-11  4:49 ` patchwork-bot+chrome-platform

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230717074352.dz3ex7fwi77loayc@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alyssa@rosenzweig.io \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=asahi@lists.linux.dev \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=claudiu.beznea@microchip.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=groeck@chromium.org \
    --cc=hammerh0314@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=michael@walle.cc \
    --cc=neil.armstrong@linaro.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=orsonzhai@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paul@crapouillou.net \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=samuel@sholland.org \
    --cc=shawnguo@kernel.org \
    --cc=sven@svenpeter.dev \
    --cc=thierry.reding@gmail.com \
    --cc=vz@mleia.com \
    --cc=wens@csie.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).