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

From: Thierry Reding
Date: Mon Feb 05 2018 - 12:59:24 EST


On Mon, Feb 05, 2018 at 09:42:21AM -0800, Linus Torvalds wrote:
> On Mon, Feb 5, 2018 at 4:54 AM, Thierry Reding <thierry.reding@xxxxxxxxx> wrote:
> >
> > 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

Attachment: signature.asc
Description: PGP signature