[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150810143623.GD31059@saruman.tx.rr.com>
Date: Mon, 10 Aug 2015 09:36:23 -0500
From: Felipe Balbi <balbi@...com>
To: Alan Stern <stern@...land.harvard.edu>
CC: Ramneek Mehresh <ramneek.mehresh@...escale.com>,
<linux-kernel@...r.kernel.org>, <balbi@...com>,
<gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
Li Yang <leoli@...escale.com>
Subject: Re: [PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host
driver
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@...escale.com>
> > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@...escale.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
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists