summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ohci-at91.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-08-10 17:23:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-15 02:57:43 +0300
commite4df92279fd9e01532f65e5ba397877799ed6252 (patch)
treeb4272d512aafde8160cee6284b28ea8cf7c90f36 /drivers/usb/host/ohci-at91.c
parentbd73bfcd44c0bdcf6efa238e5b21bdbf0778d6ce (diff)
downloadlinux-e4df92279fd9e01532f65e5ba397877799ed6252.tar.xz
USB: host: ohci-at91: merge loops in ohci_hcd_at91_drv_probe
ohci_hcd_at91_drv_probe() has four at91_for_each_port. They can be merged into two loops without changing the driver behaviour. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ohci-at91.c')
-rw-r--r--drivers/usb/host/ohci-at91.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index cdd91c551c7b..342ffd140122 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -477,33 +477,21 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
pdata->ports = ports;
at91_for_each_port(i) {
- gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
- pdata->vbus_pin[i] = gpio;
- if (!gpio_is_valid(gpio))
- continue;
- pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
- }
-
- at91_for_each_port(i)
- pdata->overcurrent_pin[i] =
- of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
-
- pdev->dev.platform_data = pdata;
-
- at91_for_each_port(i) {
/*
* do not configure PIO if not in relation with
* real USB port on board
*/
if (i >= pdata->ports) {
pdata->vbus_pin[i] = -EINVAL;
- pdata->overcurrent_pin[i] = -EINVAL;
- break;
+ continue;
}
- if (!gpio_is_valid(pdata->vbus_pin[i]))
+ gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i,
+ &flags);
+ pdata->vbus_pin[i] = gpio;
+ if (!gpio_is_valid(gpio))
continue;
- gpio = pdata->vbus_pin[i];
+ pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
ret = gpio_request(gpio, "ohci_vbus");
if (ret) {
@@ -525,6 +513,14 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
}
at91_for_each_port(i) {
+ if (i >= pdata->ports) {
+ pdata->overcurrent_pin[i] = -EINVAL;
+ continue;
+ }
+
+ pdata->overcurrent_pin[i] =
+ of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
+
if (!gpio_is_valid(pdata->overcurrent_pin[i]))
continue;
gpio = pdata->overcurrent_pin[i];
@@ -556,6 +552,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
}
}
+ pdev->dev.platform_data = pdata;
+
device_init_wakeup(&pdev->dev, 1);
return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
}