From: Joe Perches <joe@perches.com>
To: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>,
hzpeterchen@gmail.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/15] usb: chipidea: imx: Change switch order
Date: Mon, 19 Sep 2016 03:32:15 -0700 [thread overview]
Message-ID: <1474281135.1954.22.camel@perches.com> (raw)
In-Reply-To: <1474280295-17503-1-git-send-email-fabien.lahoudere@collabora.co.uk>
On Mon, 2016-09-19 at 12:18 +0200, Fabien Lahoudere wrote:
> Each USB controller have different behaviour, so in order to avoid to have
> several "swicth(data->index)" and lock/unlock, we prefer to get the index
> and then test for features if they exist for this index.
[]
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
[]
> @@ -199,31 +199,45 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
> val |= MX53_USB_PLL_DIV_24_MHZ;
> writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET);
>
> - if (data->disable_oc) {
> - spin_lock_irqsave(&usbmisc->lock, flags);
> - switch (data->index) {
> + spin_lock_irqsave(&usbmisc->lock, flags);
> +
> + switch (data->index) {
> case 0:
> - reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
> - val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
> + if (data->disable_oc) {
> + reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
> + val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
> + if (reg && val)
> + writel(val, reg);
> + }
> break;
It'd be nicer to unindent the switches case blocks one level too.
switch (case->index){
case 0:
etc...
prev parent reply other threads:[~2016-09-19 10:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 10:18 Fabien Lahoudere
2016-09-19 10:23 ` Fabien Lahoudere
2016-09-19 10:32 ` Joe Perches [this message]
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=1474281135.1954.22.camel@perches.com \
--to=joe@perches.com \
--cc=fabien.lahoudere@collabora.co.uk \
--cc=hzpeterchen@gmail.com \
--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
Powered by JetHome