[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1474281135.1954.22.camel@perches.com>
Date: Mon, 19 Sep 2016 03:32:15 -0700
From: Joe Perches <joe@...ches.com>
To: Fabien Lahoudere <fabien.lahoudere@...labora.co.uk>,
hzpeterchen@...il.com
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 05/15] usb: chipidea: imx: Change switch order
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...
Powered by blists - more mailing lists