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


Groups > linux.kernel > #1486340

Re: [PATCH 05/15] usb: chipidea: imx: Change switch order

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH 05/15] usb: chipidea: imx: Change switch order
Date 2016-09-19 12:40 +0200
Message-ID <sj49s-4fU-39@gated-at.bofh.it> (permalink)
References <sj3Q5-498-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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


Thread

[PATCH 05/15] usb: chipidea: imx: Change switch order Fabien Lahoudere <fabien.lahoudere@collabora.co.uk> - 2016-09-19 12:20 +0200
  Re: [PATCH 05/15] usb: chipidea: imx: Change switch order Fabien Lahoudere <fabien.lahoudere@collabora.co.uk> - 2016-09-19 12:30 +0200
  Re: [PATCH 05/15] usb: chipidea: imx: Change switch order Joe Perches <joe@perches.com> - 2016-09-19 12:40 +0200

csiph-web