diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-09-19 03:32:23 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-11-29 10:46:17 -0500 |
commit | 8a7a49d18b6bc0a5fd6f356b09ef3d649c7f9010 (patch) | |
tree | c93b0c7a0c18c416aa0764208ccfcd4cfe6c9271 /drivers | |
parent | 1d6dc0683d434c084ac067220c3e58d058c434a1 (diff) |
ARM: at91/ohci: use gpio_is_valid to check the gpio
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 12 |
1 files changed, 6 insertions, 6 deletions
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]); |