All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] USB: PHY: minor include cleanups
@ 2016-02-02 20:02 Bjorn Helgaas
  2016-02-02 20:02 ` [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 20:02 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Alexandre Courbot, Greg Kroah-Hartman, Linus Walleij, linux-usb,
	Liam Girdwood, linux-kernel, linux-gpio, Mark Brown

Remove some gpio and regulator #includes when they can be replaced by
trivial forward struct declarations.  Also move a linux/gpio/consumer.h
#include from a header to the single .c files that uses it.

---

Bjorn Helgaas (3):
      usb: phy: generic: use forward declarations instead of #includes
      usb: phy: generic: use forward declarations instead of #includes
      usb: phy: phy-am335x: remove include of regulator/consumer.h


 drivers/pci/pcie/pme.c              |    4 +++-
 drivers/usb/phy/phy-am335x.c        |    1 -
 drivers/usb/phy/phy-generic.c       |    1 +
 drivers/usb/phy/phy-generic.h       |    5 +++--
 include/linux/usb/usb_phy_generic.h |    3 ++-
 5 files changed, 9 insertions(+), 5 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes
  2016-02-02 20:02 [PATCH 0/3] USB: PHY: minor include cleanups Bjorn Helgaas
@ 2016-02-02 20:02 ` Bjorn Helgaas
  2016-02-03 18:18   ` Felipe Balbi
  2016-02-02 20:02 ` [PATCH 2/3] " Bjorn Helgaas
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 20:02 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Alexandre Courbot, Greg Kroah-Hartman, Linus Walleij, linux-usb,
	Liam Girdwood, linux-kernel, linux-gpio, Mark Brown

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;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] usb: phy: generic: use forward declarations instead of #includes
  2016-02-02 20:02 [PATCH 0/3] USB: PHY: minor include cleanups Bjorn Helgaas
  2016-02-02 20:02 ` [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas
@ 2016-02-02 20:02 ` Bjorn Helgaas
  2016-02-02 20:02 ` [PATCH 3/3] usb: phy: phy-am335x: remove include of regulator/consumer.h Bjorn Helgaas
  2016-02-02 20:43 ` [PATCH 0/3] USB: PHY: minor include cleanups Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 20:02 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Alexandre Courbot, Greg Kroah-Hartman, Linus Walleij, linux-usb,
	Liam Girdwood, linux-kernel, linux-gpio, Mark Brown

In drivers/usb/phy/phy-generic.h, use forward declarations for struct
regulator and struct gpio_desc instead of including
linux/regulator/consumer.h and linux/gpio/consumer.h.

phy-generic.c is included three places (phy-am335x.c, phy-generic.c,
phy-keystone.c).  Of these, phy-am335x.c and phy-generic.c already include
regulator/consumer.h and phy-keystone.c doesn't need it; only phy-generic.c
uses gpiod_*() interfaces, and it already includes gpio/consumer.h.

This is a little more efficient and ensures that users of the regulator and
gpio interfaces include the relevant header files directly rather than
accidentally getting them via drivers/usb/phy/phy-generic.h.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/usb/phy/phy-generic.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/phy/phy-generic.h b/drivers/usb/phy/phy-generic.h
index 0d0eadd..cc4f1bd 100644
--- a/drivers/usb/phy/phy-generic.h
+++ b/drivers/usb/phy/phy-generic.h
@@ -2,8 +2,9 @@
 #define _PHY_GENERIC_H_
 
 #include <linux/usb/usb_phy_generic.h>
-#include <linux/gpio/consumer.h>
-#include <linux/regulator/consumer.h>
+
+struct regulator;
+struct gpio_desc;
 
 struct usb_phy_generic {
 	struct usb_phy phy;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] usb: phy: phy-am335x: remove include of regulator/consumer.h
  2016-02-02 20:02 [PATCH 0/3] USB: PHY: minor include cleanups Bjorn Helgaas
  2016-02-02 20:02 ` [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas
  2016-02-02 20:02 ` [PATCH 2/3] " Bjorn Helgaas
@ 2016-02-02 20:02 ` Bjorn Helgaas
  2016-02-02 20:43 ` [PATCH 0/3] USB: PHY: minor include cleanups Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 20:02 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Alexandre Courbot, Greg Kroah-Hartman, Linus Walleij, linux-usb,
	Liam Girdwood, linux-kernel, linux-gpio, Mark Brown

phy-am335x.c doesn't use any interfaces from linux/regulator/consumer.h, so
stop including it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/usb/phy/phy-am335x.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c
index 39b424f..a262a43 100644
--- a/drivers/usb/phy/phy-am335x.c
+++ b/drivers/usb/phy/phy-am335x.c
@@ -5,7 +5,6 @@
 #include <linux/usb/usb_phy_generic.h>
 #include <linux/slab.h>
 #include <linux/clk.h>
-#include <linux/regulator/consumer.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/usb/of.h>

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] USB: PHY: minor include cleanups
  2016-02-02 20:02 [PATCH 0/3] USB: PHY: minor include cleanups Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2016-02-02 20:02 ` [PATCH 3/3] usb: phy: phy-am335x: remove include of regulator/consumer.h Bjorn Helgaas
@ 2016-02-02 20:43 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-02-02 20:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Felipe Balbi, Alexandre Courbot, Greg Kroah-Hartman,
	Linus Walleij, linux-usb, Liam Girdwood, linux-kernel,
	linux-gpio

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

On Tue, Feb 02, 2016 at 02:02:30PM -0600, Bjorn Helgaas wrote:
> Remove some gpio and regulator #includes when they can be replaced by
> trivial forward struct declarations.  Also move a linux/gpio/consumer.h
> #include from a header to the single .c files that uses it.

Please don't CC me on patches just for simple work on users of the
regulator API - if there's some regulator specific input needed then of
course that's fine but if it's just normal API user stuff there's no
need.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes
  2016-02-02 20:02 ` [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas
@ 2016-02-03 18:18   ` Felipe Balbi
  2016-02-03 18:46     ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2016-02-03 18:18 UTC (permalink / raw)
  To: Bjorn Helgaas, Felipe Balbi
  Cc: Alexandre Courbot, Greg Kroah-Hartman, Linus Walleij, linux-usb,
	Liam Girdwood, linux-kernel, linux-gpio, Mark Brown

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

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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes
  2016-02-03 18:18   ` Felipe Balbi
@ 2016-02-03 18:46     ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-02-03 18:46 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Bjorn Helgaas, Felipe Balbi, Alexandre Courbot,
	Greg Kroah-Hartman, Linus Walleij, linux-usb, Liam Girdwood,
	linux-kernel, linux-gpio

[-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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-03 18:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 20:02 [PATCH 0/3] USB: PHY: minor include cleanups Bjorn Helgaas
2016-02-02 20:02 ` [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes Bjorn Helgaas
2016-02-03 18:18   ` Felipe Balbi
2016-02-03 18:46     ` Bjorn Helgaas
2016-02-02 20:02 ` [PATCH 2/3] " Bjorn Helgaas
2016-02-02 20:02 ` [PATCH 3/3] usb: phy: phy-am335x: remove include of regulator/consumer.h Bjorn Helgaas
2016-02-02 20:43 ` [PATCH 0/3] USB: PHY: minor include cleanups Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.