Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316980
b: refs/heads/master
c: ded017e
h: refs/heads/master
v: v3
  • Loading branch information
Kishon Vijay Abraham I authored and Felipe Balbi committed Jul 2, 2012
1 parent a36a287 commit c86738d
Show file tree
Hide file tree
Showing 26 changed files with 97 additions and 78 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8a3efa3a363720687d21228d6b23b988a223bbb
refs/heads/master: ded017ee6c7b90f7356bd8488f8af1c10ba90490
2 changes: 1 addition & 1 deletion trunk/drivers/power/ab8500_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
}

di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
if (!di->usb_phy) {
if (IS_ERR_OR_NULL(di->usb_phy)) {
dev_err(di->dev, "failed to get usb transceiver\n");
ret = -EINVAL;
goto free_usb;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/power/isp1704_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
return -ENOMEM;

isp->phy = usb_get_phy(USB_PHY_TYPE_USB2);
if (!isp->phy)
if (IS_ERR_OR_NULL(isp->phy))
goto fail0;

isp->dev = &pdev->dev;
Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/power/pda_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ static int pda_power_probe(struct platform_device *pdev)

#ifdef CONFIG_USB_OTG_UTILS
transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
if (transceiver && !pdata->is_usb_online) {
pdata->is_usb_online = otg_is_usb_online;
}
if (transceiver && !pdata->is_ac_online) {
pdata->is_ac_online = otg_is_ac_online;
if (!IS_ERR_OR_NULL(transceiver)) {
if (!pdata->is_usb_online)
pdata->is_usb_online = otg_is_usb_online;
if (!pdata->is_ac_online)
pdata->is_ac_online = otg_is_ac_online;
}
#endif

Expand Down Expand Up @@ -373,7 +373,7 @@ static int pda_power_probe(struct platform_device *pdev)
}

#ifdef CONFIG_USB_OTG_UTILS
if (transceiver && pdata->use_otg_notifier) {
if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier) {
otg_nb.notifier_call = otg_handle_notification;
ret = usb_register_notifier(transceiver, &otg_nb);
if (ret) {
Expand Down Expand Up @@ -408,7 +408,7 @@ static int pda_power_probe(struct platform_device *pdev)
if (pdata->is_ac_online && ac_irq)
free_irq(ac_irq->start, &pda_psy_ac);
#ifdef CONFIG_USB_OTG_UTILS
if (transceiver)
if (!IS_ERR_OR_NULL(transceiver))
usb_put_phy(transceiver);
#endif
ac_irq_failed:
Expand Down Expand Up @@ -443,7 +443,7 @@ static int pda_power_remove(struct platform_device *pdev)
if (pdata->is_ac_online)
power_supply_unregister(&pda_psy_ac);
#ifdef CONFIG_USB_OTG_UTILS
if (transceiver)
if (!IS_ERR_OR_NULL(transceiver))
usb_put_phy(transceiver);
#endif
if (ac_draw) {
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/power/twl4030_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/i2c/twl.h>
Expand Down Expand Up @@ -480,7 +481,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
INIT_WORK(&bci->work, twl4030_bci_usb_work);

bci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
if (bci->transceiver != NULL) {
if (!IS_ERR_OR_NULL(bci->transceiver)) {
bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
usb_register_notifier(bci->transceiver, &bci->usb_nb);
}
Expand All @@ -507,7 +508,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
return 0;

fail_unmask_interrupts:
if (bci->transceiver != NULL) {
if (!IS_ERR_OR_NULL(bci->transceiver)) {
usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
usb_put_phy(bci->transceiver);
}
Expand Down Expand Up @@ -538,7 +539,7 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev)
twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff,
TWL4030_INTERRUPTS_BCIIMR2A);

if (bci->transceiver != NULL) {
if (!IS_ERR_OR_NULL(bci->transceiver)) {
usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
usb_put_phy(bci->transceiver);
}
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/usb/chipidea/udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/dmapool.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/module.h>
Expand Down Expand Up @@ -1712,7 +1713,7 @@ static int udc_start(struct ci13xxx *udc)
if (retval)
goto unreg_device;

if (udc->transceiver) {
if (!IS_ERR_OR_NULL(udc->transceiver)) {
retval = otg_set_peripheral(udc->transceiver->otg,
&udc->gadget);
if (retval)
Expand All @@ -1729,7 +1730,7 @@ static int udc_start(struct ci13xxx *udc)
return retval;

remove_trans:
if (udc->transceiver) {
if (!IS_ERR_OR_NULL(udc->transceiver)) {
otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
usb_put_phy(udc->transceiver);
}
Expand All @@ -1740,7 +1741,7 @@ static int udc_start(struct ci13xxx *udc)
unreg_device:
device_unregister(&udc->gadget.dev);
put_transceiver:
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
usb_put_phy(udc->transceiver);
free_pools:
dma_pool_destroy(udc->td_pool);
Expand Down Expand Up @@ -1772,7 +1773,7 @@ static void udc_stop(struct ci13xxx *udc)
dma_pool_destroy(udc->td_pool);
dma_pool_destroy(udc->qh_pool);

if (udc->transceiver) {
if (!IS_ERR_OR_NULL(udc->transceiver)) {
otg_set_peripheral(udc->transceiver->otg, NULL);
usb_put_phy(udc->transceiver);
}
Expand Down
15 changes: 8 additions & 7 deletions trunk/drivers/usb/gadget/fsl_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/ioport.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/list.h>
Expand Down Expand Up @@ -1229,7 +1230,7 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA)
struct fsl_udc *udc;

udc = container_of(gadget, struct fsl_udc, gadget);
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
return usb_phy_set_power(udc->transceiver, mA);
return -ENOTSUPP;
}
Expand Down Expand Up @@ -1983,13 +1984,13 @@ static int fsl_start(struct usb_gadget_driver *driver,
goto out;
}

if (udc_controller->transceiver) {
if (!IS_ERR_OR_NULL(udc_controller->transceiver)) {
/* Suspend the controller until OTG enable it */
udc_controller->stopped = 1;
printk(KERN_INFO "Suspend udc for OTG auto detect\n");

/* connect to bus through transceiver */
if (udc_controller->transceiver) {
if (!IS_ERR_OR_NULL(udc_controller->transceiver)) {
retval = otg_set_peripheral(
udc_controller->transceiver->otg,
&udc_controller->gadget);
Expand Down Expand Up @@ -2030,7 +2031,7 @@ static int fsl_stop(struct usb_gadget_driver *driver)
if (!driver || driver != udc_controller->driver || !driver->unbind)
return -EINVAL;

if (udc_controller->transceiver)
if (!IS_ERR_OR_NULL(udc_controller->transceiver))
otg_set_peripheral(udc_controller->transceiver->otg, NULL);

/* stop DR, disable intr */
Expand Down Expand Up @@ -2456,7 +2457,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
#ifdef CONFIG_USB_OTG
if (pdata->operating_mode == FSL_USB2_DR_OTG) {
udc_controller->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
if (!udc_controller->transceiver) {
if (IS_ERR_OR_NULL(udc_controller->transceiver)) {
ERR("Can't find OTG driver!\n");
ret = -ENODEV;
goto err_kfree;
Expand Down Expand Up @@ -2540,7 +2541,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
goto err_free_irq;
}

if (!udc_controller->transceiver) {
if (IS_ERR_OR_NULL(udc_controller->transceiver)) {
/* initialize usb hw reg except for regs for EP,
* leave usbintr reg untouched */
dr_controller_setup(udc_controller);
Expand All @@ -2564,7 +2565,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
if (ret < 0)
goto err_free_irq;

if (udc_controller->transceiver)
if (!IS_ERR_OR_NULL(udc_controller->transceiver))
udc_controller->gadget.is_otg = 1;

/* setup QH and epctrl for ep0 */
Expand Down
13 changes: 7 additions & 6 deletions trunk/drivers/usb/gadget/mv_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/list.h>
Expand Down Expand Up @@ -1381,7 +1382,7 @@ static int mv_udc_start(struct usb_gadget_driver *driver,
return retval;
}

if (udc->transceiver) {
if (!IS_ERR_OR_NULL(udc->transceiver)) {
retval = otg_set_peripheral(udc->transceiver->otg,
&udc->gadget);
if (retval) {
Expand Down Expand Up @@ -2107,7 +2108,7 @@ static int __devexit mv_udc_remove(struct platform_device *dev)
* then vbus irq will not be requested in udc driver.
*/
if (udc->pdata && udc->pdata->vbus
&& udc->clock_gating && udc->transceiver == NULL)
&& udc->clock_gating && IS_ERR_OR_NULL(udc->transceiver))
free_irq(udc->pdata->vbus->irq, &dev->dev);

/* free memory allocated in probe */
Expand Down Expand Up @@ -2325,7 +2326,7 @@ static int __devinit mv_udc_probe(struct platform_device *dev)
eps_init(udc);

/* VBUS detect: we can disable/enable clock on demand.*/
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
udc->clock_gating = 1;
else if (pdata->vbus) {
udc->clock_gating = 1;
Expand Down Expand Up @@ -2369,7 +2370,7 @@ static int __devinit mv_udc_probe(struct platform_device *dev)

err_unregister:
if (udc->pdata && udc->pdata->vbus
&& udc->clock_gating && udc->transceiver == NULL)
&& udc->clock_gating && IS_ERR_OR_NULL(udc->transceiver))
free_irq(pdata->vbus->irq, &dev->dev);
device_unregister(&udc->gadget.dev);
err_free_irq:
Expand Down Expand Up @@ -2404,7 +2405,7 @@ static int mv_udc_suspend(struct device *_dev)
struct mv_udc *udc = the_controller;

/* if OTG is enabled, the following will be done in OTG driver*/
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
return 0;

if (udc->pdata->vbus && udc->pdata->vbus->poll)
Expand Down Expand Up @@ -2437,7 +2438,7 @@ static int mv_udc_resume(struct device *_dev)
int retval;

/* if OTG is enabled, the following will be done in OTG driver*/
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
return 0;

if (!udc->clock_gating) {
Expand Down
25 changes: 13 additions & 12 deletions trunk/drivers/usb/gadget/omap_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/usb/otg.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/prefetch.h>

#include <asm/byteorder.h>
Expand Down Expand Up @@ -1211,7 +1212,7 @@ static int omap_wakeup(struct usb_gadget *gadget)

/* NOTE: non-OTG systems may use SRP TOO... */
} else if (!(udc->devstat & UDC_ATT)) {
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
retval = otg_start_srp(udc->transceiver->otg);
}
spin_unlock_irqrestore(&udc->lock, flags);
Expand Down Expand Up @@ -1343,7 +1344,7 @@ static int omap_vbus_draw(struct usb_gadget *gadget, unsigned mA)
struct omap_udc *udc;

udc = container_of(gadget, struct omap_udc, gadget);
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
return usb_phy_set_power(udc->transceiver, mA);
return -EOPNOTSUPP;
}
Expand Down Expand Up @@ -1792,12 +1793,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
if (devstat & UDC_ATT) {
udc->gadget.speed = USB_SPEED_FULL;
VDBG("connect\n");
if (!udc->transceiver)
if (IS_ERR_OR_NULL(udc->transceiver))
pullup_enable(udc);
// if (driver->connect) call it
} else if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
udc->gadget.speed = USB_SPEED_UNKNOWN;
if (!udc->transceiver)
if (IS_ERR_OR_NULL(udc->transceiver))
pullup_disable(udc);
DBG("disconnect, gadget %s\n",
udc->driver->driver.name);
Expand Down Expand Up @@ -1837,12 +1838,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
udc->driver->suspend(&udc->gadget);
spin_lock(&udc->lock);
}
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
usb_phy_set_suspend(
udc->transceiver, 1);
} else {
VDBG("resume\n");
if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
usb_phy_set_suspend(
udc->transceiver, 0);
if (udc->gadget.speed == USB_SPEED_FULL
Expand Down Expand Up @@ -2154,7 +2155,7 @@ static int omap_udc_start(struct usb_gadget_driver *driver,
omap_writew(UDC_IRQ_SRC_MASK, UDC_IRQ_SRC);

/* connect to bus through transceiver */
if (udc->transceiver) {
if (!IS_ERR_OR_NULL(udc->transceiver)) {
status = otg_set_peripheral(udc->transceiver->otg,
&udc->gadget);
if (status < 0) {
Expand Down Expand Up @@ -2201,7 +2202,7 @@ static int omap_udc_stop(struct usb_gadget_driver *driver)
if (machine_without_vbus_sense())
omap_vbus_session(&udc->gadget, 0);

if (udc->transceiver)
if (!IS_ERR_OR_NULL(udc->transceiver))
(void) otg_set_peripheral(udc->transceiver->otg, NULL);
else
pullup_disable(udc);
Expand Down Expand Up @@ -2866,7 +2867,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
* but not having one probably means no VBUS detection.
*/
xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (xceiv)
if (!IS_ERR_OR_NULL(xceiv))
type = xceiv->label;
else if (config->otg) {
DBG("OTG requires external transceiver!\n");
Expand Down Expand Up @@ -2898,7 +2899,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
case 16:
case 19:
case 25:
if (!xceiv) {
if (IS_ERR_OR_NULL(xceiv)) {
DBG("external transceiver not registered!\n");
type = "unknown";
}
Expand Down Expand Up @@ -3010,7 +3011,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
udc = NULL;

cleanup0:
if (xceiv)
if (!IS_ERR_OR_NULL(xceiv))
usb_put_phy(xceiv);

if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) {
Expand Down Expand Up @@ -3040,7 +3041,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
udc->done = &done;

pullup_disable(udc);
if (udc->transceiver) {
if (!IS_ERR_OR_NULL(udc->transceiver)) {
usb_put_phy(udc->transceiver);
udc->transceiver = NULL;
}
Expand Down
Loading

0 comments on commit c86738d

Please sign in to comment.