aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/at91_udc.c14
-rw-r--r--drivers/usb/host/ohci-at91.c12
2 files changed, 13 insertions, 13 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index ac41f71bf9ca..143a7256b598 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1748,7 +1748,7 @@ static int __init at91udc_probe(struct platform_device *pdev)
1748 1748
1749 /* rm9200 needs manual D+ pullup; off by default */ 1749 /* rm9200 needs manual D+ pullup; off by default */
1750 if (cpu_is_at91rm9200()) { 1750 if (cpu_is_at91rm9200()) {
1751 if (udc->board.pullup_pin <= 0) { 1751 if (gpio_is_valid(udc->board.pullup_pin)) {
1752 DBG("no D+ pullup?\n"); 1752 DBG("no D+ pullup?\n");
1753 retval = -ENODEV; 1753 retval = -ENODEV;
1754 goto fail0; 1754 goto fail0;
@@ -1815,7 +1815,7 @@ static int __init at91udc_probe(struct platform_device *pdev)
1815 DBG("request irq %d failed\n", udc->udp_irq); 1815 DBG("request irq %d failed\n", udc->udp_irq);
1816 goto fail1; 1816 goto fail1;
1817 } 1817 }
1818 if (udc->board.vbus_pin > 0) { 1818 if (gpio_is_valid(udc->board.vbus_pin)) {
1819 retval = gpio_request(udc->board.vbus_pin, "udc_vbus"); 1819 retval = gpio_request(udc->board.vbus_pin, "udc_vbus");
1820 if (retval < 0) { 1820 if (retval < 0) {
1821 DBG("request vbus pin failed\n"); 1821 DBG("request vbus pin failed\n");
@@ -1859,10 +1859,10 @@ static int __init at91udc_probe(struct platform_device *pdev)
1859 INFO("%s version %s\n", driver_name, DRIVER_VERSION); 1859 INFO("%s version %s\n", driver_name, DRIVER_VERSION);
1860 return 0; 1860 return 0;
1861fail4: 1861fail4:
1862 if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled) 1862 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled)
1863 free_irq(udc->board.vbus_pin, udc); 1863 free_irq(udc->board.vbus_pin, udc);
1864fail3: 1864fail3:
1865 if (udc->board.vbus_pin > 0) 1865 if (gpio_is_valid(udc->board.vbus_pin))
1866 gpio_free(udc->board.vbus_pin); 1866 gpio_free(udc->board.vbus_pin);
1867fail2: 1867fail2:
1868 free_irq(udc->udp_irq, udc); 1868 free_irq(udc->udp_irq, udc);
@@ -1897,7 +1897,7 @@ static int __exit at91udc_remove(struct platform_device *pdev)
1897 1897
1898 device_init_wakeup(&pdev->dev, 0); 1898 device_init_wakeup(&pdev->dev, 0);
1899 remove_debug_file(udc); 1899 remove_debug_file(udc);
1900 if (udc->board.vbus_pin > 0) { 1900 if (gpio_is_valid(udc->board.vbus_pin)) {
1901 free_irq(udc->board.vbus_pin, udc); 1901 free_irq(udc->board.vbus_pin, udc);
1902 gpio_free(udc->board.vbus_pin); 1902 gpio_free(udc->board.vbus_pin);
1903 } 1903 }
@@ -1941,7 +1941,7 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg)
1941 enable_irq_wake(udc->udp_irq); 1941 enable_irq_wake(udc->udp_irq);
1942 1942
1943 udc->active_suspend = wake; 1943 udc->active_suspend = wake;
1944 if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && wake) 1944 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled && wake)
1945 enable_irq_wake(udc->board.vbus_pin); 1945 enable_irq_wake(udc->board.vbus_pin);
1946 return 0; 1946 return 0;
1947} 1947}
@@ -1951,7 +1951,7 @@ static int at91udc_resume(struct platform_device *pdev)
1951 struct at91_udc *udc = platform_get_drvdata(pdev); 1951 struct at91_udc *udc = platform_get_drvdata(pdev);
1952 unsigned long flags; 1952 unsigned long flags;
1953 1953
1954 if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && 1954 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled &&
1955 udc->active_suspend) 1955 udc->active_suspend)
1956 disable_irq_wake(udc->board.vbus_pin); 1956 disable_irq_wake(udc->board.vbus_pin);
1957 1957
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 95a9fec38e89..5df0b0e3392b 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -223,7 +223,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
223 if (port < 0 || port >= 2) 223 if (port < 0 || port >= 2)
224 return; 224 return;
225 225
226 if (pdata->vbus_pin[port] <= 0) 226 if (!gpio_is_valid(pdata->vbus_pin[port]))
227 return; 227 return;
228 228
229 gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); 229 gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable);
@@ -234,7 +234,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
234 if (port < 0 || port >= 2) 234 if (port < 0 || port >= 2)
235 return -EINVAL; 235 return -EINVAL;
236 236
237 if (pdata->vbus_pin[port] <= 0) 237 if (!gpio_is_valid(pdata->vbus_pin[port]))
238 return -EINVAL; 238 return -EINVAL;
239 239
240 return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; 240 return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted;
@@ -465,7 +465,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
465 465
466 if (pdata) { 466 if (pdata) {
467 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 467 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
468 if (pdata->vbus_pin[i] <= 0) 468 if (!gpio_is_valid(pdata->vbus_pin[i]))
469 continue; 469 continue;
470 gpio_request(pdata->vbus_pin[i], "ohci_vbus"); 470 gpio_request(pdata->vbus_pin[i], "ohci_vbus");
471 ohci_at91_usb_set_power(pdata, i, 1); 471 ohci_at91_usb_set_power(pdata, i, 1);
@@ -474,7 +474,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
474 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { 474 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) {
475 int ret; 475 int ret;
476 476
477 if (pdata->overcurrent_pin[i] <= 0) 477 if (!gpio_is_valid(pdata->overcurrent_pin[i]))
478 continue; 478 continue;
479 gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); 479 gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent");
480 480
@@ -499,14 +499,14 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
499 499
500 if (pdata) { 500 if (pdata) {
501 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 501 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
502 if (pdata->vbus_pin[i] <= 0) 502 if (!gpio_is_valid(pdata->vbus_pin[i]))
503 continue; 503 continue;
504 ohci_at91_usb_set_power(pdata, i, 0); 504 ohci_at91_usb_set_power(pdata, i, 0);
505 gpio_free(pdata->vbus_pin[i]); 505 gpio_free(pdata->vbus_pin[i]);
506 } 506 }
507 507
508 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { 508 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) {
509 if (pdata->overcurrent_pin[i] <= 0) 509 if (!gpio_is_valid(pdata->overcurrent_pin[i]))
510 continue; 510 continue;
511 free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); 511 free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev);
512 gpio_free(pdata->overcurrent_pin[i]); 512 gpio_free(pdata->overcurrent_pin[i]);