linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Felipe Balbi <balbi@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>, Felipe Balbi <balbi@ti.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-usb@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH 1/3] usb: phy: generic: use forward declarations instead of #includes
Date: Wed, 3 Feb 2016 12:46:34 -0600	[thread overview]
Message-ID: <20160203184634.GD10879@localhost> (raw)
In-Reply-To: <87io25psit.fsf@ti.com>

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

  reply	other threads:[~2016-02-03 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160203184634.GD10879@localhost \
    --to=helgaas@kernel.org \
    --cc=balbi@kernel.org \
    --cc=balbi@ti.com \
    --cc=bhelgaas@google.com \
    --cc=gnurou@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).