diff options
Diffstat (limited to 'drivers/usb/gadget/pxa27x_udc.c')
-rw-r--r-- | drivers/usb/gadget/pxa27x_udc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 98acb3ab9e17..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 | } |
@@ -2464,7 +2465,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev) | |||
2464 | 2465 | ||
2465 | udc->dev = &pdev->dev; | 2466 | udc->dev = &pdev->dev; |
2466 | udc->mach = pdev->dev.platform_data; | 2467 | udc->mach = pdev->dev.platform_data; |
2467 | udc->transceiver = usb_get_transceiver(); | 2468 | udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
2468 | 2469 | ||
2469 | gpio = udc->mach->gpio_pullup; | 2470 | gpio = udc->mach->gpio_pullup; |
2470 | if (gpio_is_valid(gpio)) { | 2471 | if (gpio_is_valid(gpio)) { |
@@ -2543,7 +2544,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev) | |||
2543 | if (gpio_is_valid(gpio)) | 2544 | if (gpio_is_valid(gpio)) |
2544 | gpio_free(gpio); | 2545 | gpio_free(gpio); |
2545 | 2546 | ||
2546 | usb_put_transceiver(udc->transceiver); | 2547 | usb_put_phy(udc->transceiver); |
2547 | 2548 | ||
2548 | udc->transceiver = NULL; | 2549 | udc->transceiver = NULL; |
2549 | platform_set_drvdata(_dev, NULL); | 2550 | platform_set_drvdata(_dev, NULL); |