diff options
author | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2009-03-24 10:45:20 -0400 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-03-26 09:58:59 -0400 |
commit | 472a6786b071ea88144e09eeb9b2a77549d98e75 (patch) | |
tree | cdfdec8e168257f9d10884f6243fe04d2f36372c /drivers/usb | |
parent | b2a49ed0083ec5f51e9e0ed2e739b9b6259e330c (diff) |
atmel-usba-udc: use gpio_is_valid() to check vbus_pin I/O line
This patch will convert to use gpio_is_valid() to check the vbus_pin
platform data. It will also default to -ENODEV if no vbus_pin is
defined.
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 65b03e3445a1..ee7ebb674416 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -319,7 +319,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc) | |||
319 | 319 | ||
320 | static int vbus_is_present(struct usba_udc *udc) | 320 | static int vbus_is_present(struct usba_udc *udc) |
321 | { | 321 | { |
322 | if (udc->vbus_pin != -1) | 322 | if (gpio_is_valid(udc->vbus_pin)) |
323 | return gpio_get_value(udc->vbus_pin); | 323 | return gpio_get_value(udc->vbus_pin); |
324 | 324 | ||
325 | /* No Vbus detection: Assume always present */ | 325 | /* No Vbus detection: Assume always present */ |
@@ -1821,7 +1821,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
1821 | DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); | 1821 | DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); |
1822 | 1822 | ||
1823 | udc->vbus_prev = 0; | 1823 | udc->vbus_prev = 0; |
1824 | if (udc->vbus_pin != -1) | 1824 | if (gpio_is_valid(udc->vbus_pin)) |
1825 | enable_irq(gpio_to_irq(udc->vbus_pin)); | 1825 | enable_irq(gpio_to_irq(udc->vbus_pin)); |
1826 | 1826 | ||
1827 | /* If Vbus is present, enable the controller and wait for reset */ | 1827 | /* If Vbus is present, enable the controller and wait for reset */ |
@@ -1852,7 +1852,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1852 | if (driver != udc->driver || !driver->unbind) | 1852 | if (driver != udc->driver || !driver->unbind) |
1853 | return -EINVAL; | 1853 | return -EINVAL; |
1854 | 1854 | ||
1855 | if (udc->vbus_pin != -1) | 1855 | if (gpio_is_valid(udc->vbus_pin)) |
1856 | disable_irq(gpio_to_irq(udc->vbus_pin)); | 1856 | disable_irq(gpio_to_irq(udc->vbus_pin)); |
1857 | 1857 | ||
1858 | spin_lock_irqsave(&udc->lock, flags); | 1858 | spin_lock_irqsave(&udc->lock, flags); |
@@ -1910,7 +1910,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1910 | udc->pdev = pdev; | 1910 | udc->pdev = pdev; |
1911 | udc->pclk = pclk; | 1911 | udc->pclk = pclk; |
1912 | udc->hclk = hclk; | 1912 | udc->hclk = hclk; |
1913 | udc->vbus_pin = -1; | 1913 | udc->vbus_pin = -ENODEV; |
1914 | 1914 | ||
1915 | ret = -ENOMEM; | 1915 | ret = -ENOMEM; |
1916 | udc->regs = ioremap(regs->start, regs->end - regs->start + 1); | 1916 | udc->regs = ioremap(regs->start, regs->end - regs->start + 1); |
@@ -1996,7 +1996,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1996 | goto err_device_add; | 1996 | goto err_device_add; |
1997 | } | 1997 | } |
1998 | 1998 | ||
1999 | if (pdata->vbus_pin >= 0) { | 1999 | if (gpio_is_valid(pdata->vbus_pin)) { |
2000 | if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { | 2000 | if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { |
2001 | udc->vbus_pin = pdata->vbus_pin; | 2001 | udc->vbus_pin = pdata->vbus_pin; |
2002 | 2002 | ||
@@ -2005,7 +2005,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
2005 | "atmel_usba_udc", udc); | 2005 | "atmel_usba_udc", udc); |
2006 | if (ret) { | 2006 | if (ret) { |
2007 | gpio_free(udc->vbus_pin); | 2007 | gpio_free(udc->vbus_pin); |
2008 | udc->vbus_pin = -1; | 2008 | udc->vbus_pin = -ENODEV; |
2009 | dev_warn(&udc->pdev->dev, | 2009 | dev_warn(&udc->pdev->dev, |
2010 | "failed to request vbus irq; " | 2010 | "failed to request vbus irq; " |
2011 | "assuming always on\n"); | 2011 | "assuming always on\n"); |
@@ -2051,7 +2051,7 @@ static int __exit usba_udc_remove(struct platform_device *pdev) | |||
2051 | usba_ep_cleanup_debugfs(&usba_ep[i]); | 2051 | usba_ep_cleanup_debugfs(&usba_ep[i]); |
2052 | usba_cleanup_debugfs(udc); | 2052 | usba_cleanup_debugfs(udc); |
2053 | 2053 | ||
2054 | if (udc->vbus_pin != -1) | 2054 | if (gpio_is_valid(udc->vbus_pin)) |
2055 | gpio_free(udc->vbus_pin); | 2055 | gpio_free(udc->vbus_pin); |
2056 | 2056 | ||
2057 | free_irq(udc->irq, udc); | 2057 | free_irq(udc->irq, udc); |