Skip to contentSkip to conversation

pinctrl: Implicit inclusion fallout fixes

PATCH New Thierry Reding 3 participants 9 messages Feb 5, 2018

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

cover pinctrl: Implicit inclusion fallout fixes

From: Thierry Reding <[email protected]>

Hi Linus,

these are two patches to fix build errors I've run into that are fallout from your removal of the pinctrl/devinfo.h include from device.h. I sure can imagine that there are more like this, but these seem to be the common ones, judging by my own build tests and the kernel-build-reports mailing list.

I'm sending these to you directly because I think it makes sense for you to apply these on top of 23c35f48f5fb ("pinctrl: remove include file from <linux/device.h>") rather than have these go in through their respective maintainer trees, so that the build gets fixed as quickly as possible.

Thierry

Thierry Reding (2):
drm/rockchip: lvds: Explicitly include pinctrl headers
mmc: meson-gx-mmc: Explicitly include pinctr/consumer.h

 drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 ++
 drivers/mmc/host/meson-gx-mmc.c          | 1 +
 2 files changed, 3 insertions(+)
Signature · 1 line
2.15.1
#1 lore raw

PATCH 1/2 drm/rockchip: lvds: Explicitly include pinctrl headers

From: Thierry Reding <[email protected]>

The Rockchip LVDS driver fails to build after commit 23c35f48f5fb ("pinctrl: remove include file from <linux/device.h>") because it relies on the pinctrl/consumer.h and pinctrl/devinfo.h being pulled in by the device.h header implicitly.

Include these headers explicitly to avoid the build failure.

---
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/rockchip/rockchip_lvds.c +2 -0
index 84911bdc27d1..cd1e1d1edc1d 100644
@@ -25,6 +25,8 @@
 #include <linux/clk.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/devinfo.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
Signature · 1 line
2.15.1
#2 lore raw

PATCH 2/2 mmc: meson-gx-mmc: Explicitly include pinctr/consumer.h

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The Meson GX MMC driver fails to build after commit 23c35f48f5fb ("pinctrl: remove include file from <linux/device.h>") because it relies on the pinctrl/consumer.h being pulled in by the device.h header implicitly.

Include the header explicitly to avoid the build failure.

---
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/meson-gx-mmc.c +1 -0
index 32a6a228cd12..22438ebfe4e6 100644
@@ -37,6 +37,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/interrupt.h>
 #include <linux/bitfield.h>
+#include <linux/pinctrl/consumer.h>
 
 #define DRIVER_NAME "meson-gx-mmc"
 
Signature · 1 line
2.15.1
#3 lore raw

PATCH 1/1 net: mediatek: Explicitly include pinctrl headers

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The Mediatek ethernet driver fails to build after commit 23c35f48f5fb ("pinctrl: remove include file from <linux/device.h>") because it relies on the pinctrl/consumer.h and pinctrl/devinfo.h being pulled in by the device.h header implicitly.

Include these headers explicitly to avoid the build failure.

---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 -0
index 29826dd15204..9e74c165f3ca 100644
@@ -23,6 +23,8 @@
 #include <linux/reset.h>
 #include <linux/tcp.h>
 #include <linux/interrupt.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/devinfo.h>
 
 #include "mtk_eth_soc.h"
 
Signature · 1 line
2.15.1
#4 lore raw

Re: [PATCH] net: mediatek: Explicitly include pinctrl headers

Quoted 2 lines · Thierry Reding

Include these headers explicitly to avoid the build failure.

I don't think you need to include *both*.

<linux/device.h> used to include just <linux/pinctrl/devinfo.h>.

I'll edit your patches to include just that. <linux/pinctrl/consumer.h> will come in automatically through it.

Linus

#5 lore raw

Re: [PATCH] net: mediatek: Explicitly include pinctrl headers

Quoted 10 lines · Linus Torvalds
Quoted 2 lines · Thierry Reding

Include these headers explicitly to avoid the build failure.

I don't think you need to include *both*.

<linux/device.h> used to include just <linux/pinctrl/devinfo.h>.

I'll edit your patches to include just that. <linux/pinctrl/consumer.h> will come in automatically through it.

I was trying to avoid any implicit inclusion, but looking at pinctrl/devinfo.h it has a comment right above the pinctrl/consumer.h include that makes it clear that pinctrl/devinfo.h is the consumer of pinctrl for the core, so I guess the implicit include is fine here.

I do question, though, if drivers have any business including this pinctrl/devinfo.h in the first place. For the Mediatek ethernet it seems like selecting the default state is redundant (the core should already have taken care of that, and the driver never selects a different state anywhere).

The same is true of drm/rockchip, which also only seems to select a state which the pinctrl core should've selected by default already. See arch/arm/boot/dts/rk3288.dtsi which sets up the "lcdc" state as the only state for the LVDS output.

Anyway, I think going with the pinctrl/devinfo.h include only is fine for now. If it turns out that the Mediatek ethernet and Rockchip LVDS drivers can just omit the bits fiddling with struct dev_pin_info, we can swap out the pinctrl/devinfo.h include for pinctrl/consumer.h at that time.

LinusW: what are your thoughts on the struct dev_pin_info usage by these drivers? Does their code seem redundant to you, too?

Thierry

#6 lore raw

Re: [PATCH] net: mediatek: Explicitly include pinctrl headers

Quoted 8 lines · Thierry Reding

Anyway, I think going with the pinctrl/devinfo.h include only is fine for now. If it turns out that the Mediatek ethernet and Rockchip LVDS drivers can just omit the bits fiddling with struct dev_pin_info, we can swap out the pinctrl/devinfo.h include for pinctrl/consumer.h at that time.

LinusW: what are your thoughts on the struct dev_pin_info usage by these drivers? Does their code seem redundant to you, too?

I don't think they should use struct dev_pin_info at all, that thing is for the device core only.

I like to think that <linux/pinctrl/consumer.h> is for drivers that explicitly grab and control pin control states so this driver should only include <linux/pinctrl/consumer.h>.

Torvalds: can you do it like that instead? Either way will make the compile work again, we can also tidy it up later. (i.e. I will grep for includes of pinctrl/dev_info.h and replace it with consumer.h) at some point.

It wasn't pretty that these drivers were relying on implicit #includes in the first place so either is anyway prettier than what it used to look like.

In a way I kind of like this sideffect even if it broke some compiles.

Yours,
Linus Walleij

#7 lore raw

Re: [PATCH] net: mediatek: Explicitly include pinctrl headers

Quoted 14 lines · Linus Walleij
Quoted 8 lines · Thierry Reding

Anyway, I think going with the pinctrl/devinfo.h include only is fine for now. If it turns out that the Mediatek ethernet and Rockchip LVDS drivers can just omit the bits fiddling with struct dev_pin_info, we can swap out the pinctrl/devinfo.h include for pinctrl/consumer.h at that time.

LinusW: what are your thoughts on the struct dev_pin_info usage by these drivers? Does their code seem redundant to you, too?

I don't think they should use struct dev_pin_info at all, that thing is for the device core only.

Quoted 8 lines

I like to think that <linux/pinctrl/consumer.h> is for drivers that explicitly grab and control pin control states so this driver should only include <linux/pinctrl/consumer.h>.

Torvalds: can you do it like that instead? Either way will make the compile work again, we can also tidy it up later. (i.e. I will grep for includes of pinctrl/dev_info.h and replace it with consumer.h) at some point.

That won't work, unfortunately, because these drivers actually try to dereference pointers to struct dev_pin_info and hence need that include for the structure's definition. Those are the only two drivers I can see that access this structure directly (other than the device core).

Thierry

#8 lore raw

Re: [PATCH] net: mediatek: Explicitly include pinctrl headers

Quoted 24 lines · Thierry Reding
Quoted 14 lines · Linus Walleij
Quoted 8 lines · Thierry Reding

Anyway, I think going with the pinctrl/devinfo.h include only is fine for now. If it turns out that the Mediatek ethernet and Rockchip LVDS drivers can just omit the bits fiddling with struct dev_pin_info, we can swap out the pinctrl/devinfo.h include for pinctrl/consumer.h at that time.

LinusW: what are your thoughts on the struct dev_pin_info usage by these drivers? Does their code seem redundant to you, too?

I don't think they should use struct dev_pin_info at all, that thing is for the device core only.

Quoted 8 lines

I like to think that <linux/pinctrl/consumer.h> is for drivers that explicitly grab and control pin control states so this driver should only include <linux/pinctrl/consumer.h>.

Torvalds: can you do it like that instead? Either way will make the compile work again, we can also tidy it up later. (i.e. I will grep for includes of pinctrl/dev_info.h and replace it with consumer.h) at some point.

Quoted 4 lines

That won't work, unfortunately, because these drivers actually try to dereference pointers to struct dev_pin_info and hence need that include for the structure's definition. Those are the only two drivers I can see that access this structure directly (other than the device core).

Grrr OK I thought I was aiming for encapsulation here but then what can I do, sigh.

Yours,
Linus Walleij