usb: chipidea: usbmisc_imx: Move the reading of USB_PHY_CTRL
authorFabio Estevam <fabio.estevam@freescale.com>
Wed, 26 Nov 2014 05:44:25 +0000 (13:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Nov 2014 17:28:11 +0000 (09:28 -0800)
If 'evdo' property is not defined, then reading the MX25_USB_PHY_CTRL_OFFSET
register is an unneeded operation.

Move the reading of MX25_USB_PHY_CTRL_OFFSET inside the 'evdo' if block code,
where it is actually used.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/usbmisc_imx.c

index 926c997ef3106be1b2a887cbc362f444cceb43e3..29200ebdd3570587186655ed34c47839ced7a775 100644 (file)
@@ -117,10 +117,9 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
        if (data->index > 2)
                return -EINVAL;
 
-       reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET;
-
        if (data->evdo) {
                spin_lock_irqsave(&usbmisc->lock, flags);
+               reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET;
                val = readl(reg);
                writel(val | MX25_BM_EXTERNAL_VBUS_DIVIDER, reg);
                spin_unlock_irqrestore(&usbmisc->lock, flags);