Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1324584 > unrolled thread
| Started by | Bjorn Helgaas <bhelgaas@google.com> |
|---|---|
| First post | 2016-02-02 21:10 +0100 |
| Last post | 2016-02-03 19:50 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas <bhelgaas@google.com> - 2016-02-02 21:10 +0100
Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Felipe Balbi <balbi@kernel.org> - 2016-02-03 19:20 +0100
Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas <helgaas@kernel.org> - 2016-02-03 19:50 +0100
| From | Bjorn Helgaas <bhelgaas@google.com> |
|---|---|
| Date | 2016-02-02 21:10 +0100 |
| Subject | [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes |
| Message-ID | <qXPqW-8iU-17@gated-at.bofh.it> |
In include/linux/usb/usb_phy_generic.h, use a forward declaration for
struct gpio_desc instead of including linux/gpio/consumer.h.
Of the files that include usb_phy_generic.h, only
drivers/usb/phy/phy-generic.c uses the gpiod_*() interfaces from
linux/gpio/consumer.h, so include consumer.h explicitly there.
This is a little more efficient and ensures that users of the gpiod
interfaces include linux/gpio/consumer.h directly rather than getting it
accidentally via linux/usb/usb_phy_generic.h.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/usb/phy/phy-generic.c | 1 +
include/linux/usb/usb_phy_generic.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 5320cb8..2c1349e 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -36,6 +36,7 @@
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include "phy-generic.h"
diff --git a/include/linux/usb/usb_phy_generic.h b/include/linux/usb/usb_phy_generic.h
index c13632d5..45c20060 100644
--- a/include/linux/usb/usb_phy_generic.h
+++ b/include/linux/usb/usb_phy_generic.h
@@ -2,7 +2,8 @@
#define __LINUX_USB_NOP_XCEIV_H
#include <linux/usb/otg.h>
-#include <linux/gpio/consumer.h>
+
+struct gpio_desc;
struct usb_phy_generic_platform_data {
enum usb_phy_type type;
[toc] | [next] | [standalone]
| From | Felipe Balbi <balbi@kernel.org> |
|---|---|
| Date | 2016-02-03 19:20 +0100 |
| Subject | Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes |
| Message-ID | <qYac3-5uj-53@gated-at.bofh.it> |
| In reply to | #1324584 |
[Multipart message — attachments visible in raw view] — view raw
Bjorn Helgaas <bhelgaas@google.com> writes: > In include/linux/usb/usb_phy_generic.h, use a forward declaration for > struct gpio_desc instead of including linux/gpio/consumer.h. > > Of the files that include usb_phy_generic.h, only > drivers/usb/phy/phy-generic.c uses the gpiod_*() interfaces from > linux/gpio/consumer.h, so include consumer.h explicitly there. > > This is a little more efficient and ensures that users of the gpiod > interfaces include linux/gpio/consumer.h directly rather than getting it > accidentally via linux/usb/usb_phy_generic.h. > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > --- > drivers/usb/phy/phy-generic.c | 1 + > include/linux/usb/usb_phy_generic.h | 3 ++- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > index 5320cb8..2c1349e 100644 > --- a/drivers/usb/phy/phy-generic.c > +++ b/drivers/usb/phy/phy-generic.c > @@ -36,6 +36,7 @@ > #include <linux/of.h> > #include <linux/of_gpio.h> > #include <linux/gpio.h> > +#include <linux/gpio/consumer.h> > #include <linux/delay.h> > > #include "phy-generic.h" > diff --git a/include/linux/usb/usb_phy_generic.h b/include/linux/usb/usb_phy_generic.h > index c13632d5..45c20060 100644 > --- a/include/linux/usb/usb_phy_generic.h > +++ b/include/linux/usb/usb_phy_generic.h > @@ -2,7 +2,8 @@ > #define __LINUX_USB_NOP_XCEIV_H > > #include <linux/usb/otg.h> > -#include <linux/gpio/consumer.h> > + > +struct gpio_desc; then someone decides to rename struct gpio_desc and this just becomes yet another place to fix. Why is this any better than just including the header ? -- balbi
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2016-02-03 19:50 +0100 |
| Subject | Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes |
| Message-ID | <qYaF5-5Ec-33@gated-at.bofh.it> |
| In reply to | #1325800 |
[-cc Mark] On Wed, Feb 03, 2016 at 08:18:02PM +0200, Felipe Balbi wrote: > Bjorn Helgaas <bhelgaas@google.com> writes: > > In include/linux/usb/usb_phy_generic.h, use a forward declaration for > > struct gpio_desc instead of including linux/gpio/consumer.h. > > > > Of the files that include usb_phy_generic.h, only > > drivers/usb/phy/phy-generic.c uses the gpiod_*() interfaces from > > linux/gpio/consumer.h, so include consumer.h explicitly there. > > > > This is a little more efficient and ensures that users of the gpiod > > interfaces include linux/gpio/consumer.h directly rather than getting it > > accidentally via linux/usb/usb_phy_generic.h. > > > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > > --- > > drivers/usb/phy/phy-generic.c | 1 + > > include/linux/usb/usb_phy_generic.h | 3 ++- > > 2 files changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > > index 5320cb8..2c1349e 100644 > > --- a/drivers/usb/phy/phy-generic.c > > +++ b/drivers/usb/phy/phy-generic.c > > @@ -36,6 +36,7 @@ > > #include <linux/of.h> > > #include <linux/of_gpio.h> > > #include <linux/gpio.h> > > +#include <linux/gpio/consumer.h> > > #include <linux/delay.h> > > > > #include "phy-generic.h" > > diff --git a/include/linux/usb/usb_phy_generic.h b/include/linux/usb/usb_phy_generic.h > > index c13632d5..45c20060 100644 > > --- a/include/linux/usb/usb_phy_generic.h > > +++ b/include/linux/usb/usb_phy_generic.h > > @@ -2,7 +2,8 @@ > > #define __LINUX_USB_NOP_XCEIV_H > > > > #include <linux/usb/otg.h> > > -#include <linux/gpio/consumer.h> > > + > > +struct gpio_desc; > > then someone decides to rename struct gpio_desc and this just becomes > yet another place to fix. Why is this any better than just including the > header ? You're right. The advantage is that the includers of usb_phy_generic.h that don't use gpiod_*() functions no longer need to include linux/gpio/consumer.h, so they build faster. It's a minor advantage in this case because not very many files include usb_phy_generic.h. Bjorn
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web