Message ID | 20171208133934.18038-1-linus.walleij@linaro.org |
---|---|
State | New |
Headers | show |
Series | i2c: Include GPIO consumer header in main include | expand |
On Fri, Dec 08, 2017 at 02:39:34PM +0100, Linus Walleij wrote: > It seems most users of <linux/i2c.h> pick up their > dependency of <linux/gpio/consumer.h> from other paths but > that is not a universal law, so include the header > explicitly so we have struct gpio_desc available. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Not sure. Having GPIOs is not really a requirement for I2C. I tend to think drivers using it should include this explicitly?
On Fri, Dec 08, 2017 at 02:39:34PM +0100, Linus Walleij wrote: > It seems most users of <linux/i2c.h> pick up their > dependency of <linux/gpio/consumer.h> from other paths but > that is not a universal law, so include the header > explicitly so we have struct gpio_desc available. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> I still think drivers needing GPIO should include it explicitly. So, NAK until further arguments arrive...
On Mon, Jan 15, 2018 at 7:03 PM, Wolfram Sang <wsa@the-dreams.de> wrote: > On Fri, Dec 08, 2017 at 02:39:34PM +0100, Linus Walleij wrote: >> It seems most users of <linux/i2c.h> pick up their >> dependency of <linux/gpio/consumer.h> from other paths but >> that is not a universal law, so include the header >> explicitly so we have struct gpio_desc available. >> >> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > > I still think drivers needing GPIO should include it explicitly. > So, NAK until further arguments arrive... What I mean is that they must be doing that currently since this file uses struct gpio_desc (for recovert), else the build would fail. So that is why I think it should be made explicit. Another option is to just forward-declare struct gpio_desc; Yours, Linus Walleij
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 5d7f3c1853ae..8b968c44ddfa 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -34,6 +34,7 @@ #include <linux/irqdomain.h> /* for Host Notify IRQ */ #include <linux/of.h> /* for struct device_node */ #include <linux/swab.h> /* for swab16 */ +#include <linux/gpio/consumer.h> #include <uapi/linux/i2c.h> extern struct bus_type i2c_bus_type;
It seems most users of <linux/i2c.h> pick up their dependency of <linux/gpio/consumer.h> from other paths but that is not a universal law, so include the header explicitly so we have struct gpio_desc available. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- include/linux/i2c.h | 1 + 1 file changed, 1 insertion(+) -- 2.14.3