aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/pxa27x_udc.c
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2012-06-26 08:10:32 -0400
committerFelipe Balbi <balbi@ti.com>2012-07-02 03:40:49 -0400
commitded017ee6c7b90f7356bd8488f8af1c10ba90490 (patch)
tree1ed1612aa13f24e1aa8480fb497d2a0311fae9cc /drivers/usb/gadget/pxa27x_udc.c
parentb8a3efa3a363720687d21228d6b23b988a223bbb (diff)
usb: phy: fix return value check of usb_get_phy
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence fixed all the callers of usb_get_phy to check for this error condition instead of relying on a non-zero value as success condition. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/pxa27x_udc.c')
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 8f744aab9628..644b4305cb99 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/list.h> 19#include <linux/list.h>
@@ -1573,7 +1574,7 @@ static int should_enable_udc(struct pxa_udc *udc)
1573 int put_on; 1574 int put_on;
1574 1575
1575 put_on = ((udc->pullup_on) && (udc->driver)); 1576 put_on = ((udc->pullup_on) && (udc->driver));
1576 put_on &= ((udc->vbus_sensed) || (!udc->transceiver)); 1577 put_on &= ((udc->vbus_sensed) || (IS_ERR_OR_NULL(udc->transceiver)));
1577 return put_on; 1578 return put_on;
1578} 1579}
1579 1580
@@ -1594,7 +1595,7 @@ static int should_disable_udc(struct pxa_udc *udc)
1594 int put_off; 1595 int put_off;
1595 1596
1596 put_off = ((!udc->pullup_on) || (!udc->driver)); 1597 put_off = ((!udc->pullup_on) || (!udc->driver));
1597 put_off |= ((!udc->vbus_sensed) && (udc->transceiver)); 1598 put_off |= ((!udc->vbus_sensed) && (!IS_ERR_OR_NULL(udc->transceiver)));
1598 return put_off; 1599 return put_off;
1599} 1600}
1600 1601
@@ -1665,7 +1666,7 @@ static int pxa_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
1665 struct pxa_udc *udc; 1666 struct pxa_udc *udc;
1666 1667
1667 udc = to_gadget_udc(_gadget); 1668 udc = to_gadget_udc(_gadget);
1668 if (udc->transceiver) 1669 if (!IS_ERR_OR_NULL(udc->transceiver))
1669 return usb_phy_set_power(udc->transceiver, mA); 1670 return usb_phy_set_power(udc->transceiver, mA);
1670 return -EOPNOTSUPP; 1671 return -EOPNOTSUPP;
1671} 1672}
@@ -1834,7 +1835,7 @@ static int pxa27x_udc_start(struct usb_gadget_driver *driver,
1834 dev_dbg(udc->dev, "registered gadget driver '%s'\n", 1835 dev_dbg(udc->dev, "registered gadget driver '%s'\n",
1835 driver->driver.name); 1836 driver->driver.name);
1836 1837
1837 if (udc->transceiver) { 1838 if (!IS_ERR_OR_NULL(udc->transceiver)) {
1838 retval = otg_set_peripheral(udc->transceiver->otg, 1839 retval = otg_set_peripheral(udc->transceiver->otg,
1839 &udc->gadget); 1840 &udc->gadget);
1840 if (retval) { 1841 if (retval) {
@@ -1908,7 +1909,7 @@ static int pxa27x_udc_stop(struct usb_gadget_driver *driver)
1908 dev_info(udc->dev, "unregistered gadget driver '%s'\n", 1909 dev_info(udc->dev, "unregistered gadget driver '%s'\n",
1909 driver->driver.name); 1910 driver->driver.name);
1910 1911
1911 if (udc->transceiver) 1912 if (!IS_ERR_OR_NULL(udc->transceiver))
1912 return otg_set_peripheral(udc->transceiver->otg, NULL); 1913 return otg_set_peripheral(udc->transceiver->otg, NULL);
1913 return 0; 1914 return 0;
1914} 1915}