Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204331

Re: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host driver

From Felipe Balbi <balbi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host driver
Date 2015-08-10 16:40 +0200
Message-ID <pVWp4-FY-1@gated-at.bofh.it> (permalink)
References <pUWAO-24q-7@gated-at.bofh.it> <pUWAN-24q-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, Aug 07, 2015 at 04:33:33PM -0400, Alan Stern wrote:
> On Wed, 15 Jul 2015, Ramneek Mehresh wrote:
> 
> > Add workqueue to add/remove host driver (outside
> > interrupt context) upon each id change.
> > 
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> > ---
> >  drivers/usb/host/ehci-fsl.c | 83 ++++++++++++++++++++++++++++++++++-----------
> >  drivers/usb/host/ehci-fsl.h | 20 +++++++++++
> >  2 files changed, 84 insertions(+), 19 deletions(-)
> > 
> > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
> > index 5352e74..81e4bf5 100644
> > --- a/drivers/usb/host/ehci-fsl.c
> > +++ b/drivers/usb/host/ehci-fsl.c
> > @@ -44,6 +44,34 @@
> >  
> >  static struct hc_driver __read_mostly fsl_ehci_hc_driver;
> >  
> > +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE)
> 
> You've got these #if lines all over the place.  They look ugly and make
> the code hard to read.  Consider removing them.  Or even if you can't
> remove them entirely, removing most of them would help.
> 
> Also, instead of testing both CONFIG_FSL_USB2_OTG and
> CONFIG_FSL_USB2_OTG_MODULE, how about testing a single symbol?  For 
> example:
> 
> #if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE)
> #define CHANGE_HCD 1
> #else
> #define CHANGE_HCD 0
> #endif
> 
> Then all you need later on is "#if CHANGE_HCD".  Or if it's inside a 
> code block, just "if (CHANGE_HCD)".

what about IS_ENABLED() ?

if (IS_ENABLED(CONFIG_FSL_USB2_OTG)) {
	foo();
} else {
	bar();
}

-- 
balbi

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host  driver Alan Stern <stern@rowland.harvard.edu> - 2015-08-07 22:40 +0200
  RE: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host  driver Ramneek Mehresh <ramneek.mehresh@freescale.com> - 2015-08-10 11:40 +0200
    RE: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host  driver Alan Stern <stern@rowland.harvard.edu> - 2015-08-10 16:50 +0200
      RE: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host  driver Ramneek Mehresh <ramneek.mehresh@freescale.com> - 2015-08-10 17:40 +0200
        Re: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host driver Fabio Estevam <festevam@gmail.com> - 2015-08-10 17:50 +0200
  Re: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host  driver Felipe Balbi <balbi@ti.com> - 2015-08-10 16:40 +0200

csiph-web