diff options
author | Chao Xie <chao.xie@marvell.com> | 2013-01-24 01:38:30 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-01-24 14:11:34 -0500 |
commit | 449d04a977f63e6218d88312f9bd3cb53fb5d30b (patch) | |
tree | 8e0eef406184057c7bf15c78e547fdaaa4a7c259 | |
parent | ab592a74a5519d9de2af3003a721cfe0c6684b8a (diff) |
usb: gadget: mv_udc: fix the value of tranceiver
usally we will use udc->tranceiver == NULL or
udc->tranceiver != NULL.
So when failed to get the udc->tranceiver by usb_get_phy(), we
directly set udc->tranceiver to be NULL.
Then the source code will not need macro IS_ERR_OR_NULL() for
udc->tranceiver judgement. It can reduce the line size and make
the judgement simple.
Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/mv_udc_core.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c index ba6b4fbaad09..67d72f97a09b 100644 --- a/drivers/usb/gadget/mv_udc_core.c +++ b/drivers/usb/gadget/mv_udc_core.c | |||
@@ -1394,7 +1394,7 @@ static int mv_udc_start(struct usb_gadget *gadget, | |||
1394 | 1394 | ||
1395 | spin_unlock_irqrestore(&udc->lock, flags); | 1395 | spin_unlock_irqrestore(&udc->lock, flags); |
1396 | 1396 | ||
1397 | if (!IS_ERR_OR_NULL(udc->transceiver)) { | 1397 | if (udc->transceiver) { |
1398 | retval = otg_set_peripheral(udc->transceiver->otg, | 1398 | retval = otg_set_peripheral(udc->transceiver->otg, |
1399 | &udc->gadget); | 1399 | &udc->gadget); |
1400 | if (retval) { | 1400 | if (retval) { |
@@ -2174,9 +2174,14 @@ static int mv_udc_probe(struct platform_device *pdev) | |||
2174 | udc->dev = pdev; | 2174 | udc->dev = pdev; |
2175 | 2175 | ||
2176 | #ifdef CONFIG_USB_OTG_UTILS | 2176 | #ifdef CONFIG_USB_OTG_UTILS |
2177 | if (pdata->mode == MV_USB_MODE_OTG) | 2177 | if (pdata->mode == MV_USB_MODE_OTG) { |
2178 | udc->transceiver = devm_usb_get_phy(&pdev->dev, | 2178 | udc->transceiver = devm_usb_get_phy(&pdev->dev, |
2179 | USB_PHY_TYPE_USB2); | 2179 | USB_PHY_TYPE_USB2); |
2180 | if (IS_ERR_OR_NULL(udc->transceiver)) { | ||
2181 | udc->transceiver = NULL; | ||
2182 | return -ENODEV; | ||
2183 | } | ||
2184 | } | ||
2180 | #endif | 2185 | #endif |
2181 | 2186 | ||
2182 | udc->clknum = pdata->clknum; | 2187 | udc->clknum = pdata->clknum; |
@@ -2319,7 +2324,7 @@ static int mv_udc_probe(struct platform_device *pdev) | |||
2319 | eps_init(udc); | 2324 | eps_init(udc); |
2320 | 2325 | ||
2321 | /* VBUS detect: we can disable/enable clock on demand.*/ | 2326 | /* VBUS detect: we can disable/enable clock on demand.*/ |
2322 | if (!IS_ERR_OR_NULL(udc->transceiver)) | 2327 | if (udc->transceiver) |
2323 | udc->clock_gating = 1; | 2328 | udc->clock_gating = 1; |
2324 | else if (pdata->vbus) { | 2329 | else if (pdata->vbus) { |
2325 | udc->clock_gating = 1; | 2330 | udc->clock_gating = 1; |
@@ -2386,7 +2391,7 @@ static int mv_udc_suspend(struct device *dev) | |||
2386 | udc = dev_get_drvdata(dev); | 2391 | udc = dev_get_drvdata(dev); |
2387 | 2392 | ||
2388 | /* if OTG is enabled, the following will be done in OTG driver*/ | 2393 | /* if OTG is enabled, the following will be done in OTG driver*/ |
2389 | if (!IS_ERR_OR_NULL(udc->transceiver)) | 2394 | if (udc->transceiver) |
2390 | return 0; | 2395 | return 0; |
2391 | 2396 | ||
2392 | if (udc->pdata->vbus && udc->pdata->vbus->poll) | 2397 | if (udc->pdata->vbus && udc->pdata->vbus->poll) |
@@ -2421,7 +2426,7 @@ static int mv_udc_resume(struct device *dev) | |||
2421 | udc = dev_get_drvdata(dev); | 2426 | udc = dev_get_drvdata(dev); |
2422 | 2427 | ||
2423 | /* if OTG is enabled, the following will be done in OTG driver*/ | 2428 | /* if OTG is enabled, the following will be done in OTG driver*/ |
2424 | if (!IS_ERR_OR_NULL(udc->transceiver)) | 2429 | if (udc->transceiver) |
2425 | return 0; | 2430 | return 0; |
2426 | 2431 | ||
2427 | if (!udc->clock_gating) { | 2432 | if (!udc->clock_gating) { |