aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-27 17:07:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-27 17:07:31 -0400
commit752e69555d107853043cb9405250c9387b26e708 (patch)
tree5614a210da5793a05044e3683f78be7991837bee /drivers/usb
parentf2e0ae93cc81cb56ed32722da7b7246a24940f90 (diff)
parent0f2aa8caeaa043f6cbe6281eb72efba5ff860904 (diff)
Merge tag 'usb-for-v3.12-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v3.12 merge window (part 2) Here's a set of important fixes for v3.12 merge window which have been pending in the mailing list for quite some time. We have use-after-free fixes, signedness fixes, more of HAS_DMA dependencies, fixes for NULL pointer deferences, build fixes and some other fixes to the musb driver caused by recent patches. Patches are quite small and contain valuable fixes which will give us a much better -rc1 release. Please consider merging Signed-of-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/core.c1
-rw-r--r--drivers/usb/gadget/Kconfig5
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c10
-rw-r--r--drivers/usb/gadget/configfs.c4
-rw-r--r--drivers/usb/gadget/f_fs.c2
-rw-r--r--drivers/usb/gadget/inode.c4
-rw-r--r--drivers/usb/musb/musb_cppi41.c4
-rw-r--r--drivers/usb/musb/musb_dsps.c61
-rw-r--r--drivers/usb/musb/musb_gadget.c15
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/ux500_dma.c4
-rw-r--r--drivers/usb/phy/phy-am335x-control.c4
-rw-r--r--drivers/usb/phy/phy-fsl-usb.h2
-rw-r--r--drivers/usb/phy/phy-fsm-usb.c2
-rw-r--r--drivers/usb/phy/phy-omap-usb2.c7
15 files changed, 79 insertions, 48 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 577af1b237f2..474162e9d01d 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -33,7 +33,6 @@
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/of.h> 34#include <linux/of.h>
35 35
36#include <linux/usb/otg.h>
37#include <linux/usb/ch9.h> 36#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h> 37#include <linux/usb/gadget.h>
39#include <linux/usb/of.h> 38#include <linux/usb/of.h>
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index bddd7ede5455..30e2dd8a1f2c 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -187,7 +187,7 @@ config USB_FSL_USB2
187 187
188config USB_FUSB300 188config USB_FUSB300
189 tristate "Faraday FUSB300 USB Peripheral Controller" 189 tristate "Faraday FUSB300 USB Peripheral Controller"
190 depends on !PHYS_ADDR_T_64BIT 190 depends on !PHYS_ADDR_T_64BIT && HAS_DMA
191 help 191 help
192 Faraday usb device controller FUSB300 driver 192 Faraday usb device controller FUSB300 driver
193 193
@@ -244,6 +244,7 @@ config USB_PXA25X_SMALL
244 244
245config USB_R8A66597 245config USB_R8A66597
246 tristate "Renesas R8A66597 USB Peripheral Controller" 246 tristate "Renesas R8A66597 USB Peripheral Controller"
247 depends on HAS_DMA
247 help 248 help
248 R8A66597 is a discrete USB host and peripheral controller chip that 249 R8A66597 is a discrete USB host and peripheral controller chip that
249 supports both full and high speed USB 2.0 data transfers. 250 supports both full and high speed USB 2.0 data transfers.
@@ -385,7 +386,7 @@ config USB_NET2272
385 386
386config USB_NET2272_DMA 387config USB_NET2272_DMA
387 boolean "Support external DMA controller" 388 boolean "Support external DMA controller"
388 depends on USB_NET2272 389 depends on USB_NET2272 && HAS_DMA
389 help 390 help
390 The NET2272 part can optionally support an external DMA 391 The NET2272 part can optionally support an external DMA
391 controller, but your board has to have support in the 392 controller, but your board has to have support in the
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 40d23384b716..2cb52e0438df 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1772,7 +1772,7 @@ out:
1772static int atmel_usba_start(struct usb_gadget *gadget, 1772static int atmel_usba_start(struct usb_gadget *gadget,
1773 struct usb_gadget_driver *driver) 1773 struct usb_gadget_driver *driver)
1774{ 1774{
1775 int ret = 0; 1775 int ret;
1776 struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget); 1776 struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget);
1777 unsigned long flags; 1777 unsigned long flags;
1778 1778
@@ -1784,11 +1784,11 @@ static int atmel_usba_start(struct usb_gadget *gadget,
1784 1784
1785 ret = clk_prepare_enable(udc->pclk); 1785 ret = clk_prepare_enable(udc->pclk);
1786 if (ret) 1786 if (ret)
1787 goto out; 1787 return ret;
1788 ret = clk_prepare_enable(udc->hclk); 1788 ret = clk_prepare_enable(udc->hclk);
1789 if (ret) { 1789 if (ret) {
1790 clk_disable_unprepare(udc->pclk); 1790 clk_disable_unprepare(udc->pclk);
1791 goto out; 1791 return ret;
1792 } 1792 }
1793 1793
1794 DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); 1794 DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name);
@@ -1804,11 +1804,9 @@ static int atmel_usba_start(struct usb_gadget *gadget,
1804 usba_writel(udc, CTRL, USBA_ENABLE_MASK); 1804 usba_writel(udc, CTRL, USBA_ENABLE_MASK);
1805 usba_writel(udc, INT_ENB, USBA_END_OF_RESET); 1805 usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
1806 } 1806 }
1807
1808out:
1809 spin_unlock_irqrestore(&udc->lock, flags); 1807 spin_unlock_irqrestore(&udc->lock, flags);
1810 1808
1811 return ret; 1809 return 0;
1812} 1810}
1813 1811
1814static int atmel_usba_stop(struct usb_gadget *gadget, 1812static int atmel_usba_stop(struct usb_gadget *gadget,
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 80e7f75a56c7..8f0d6141e5e6 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -859,8 +859,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
859 list_for_each_entry_safe(f, tmp, &cfg->func_list, list) { 859 list_for_each_entry_safe(f, tmp, &cfg->func_list, list) {
860 list_del(&f->list); 860 list_del(&f->list);
861 ret = usb_add_function(c, f); 861 ret = usb_add_function(c, f);
862 if (ret) 862 if (ret) {
863 list_add(&f->list, &cfg->func_list);
863 goto err_purge_funcs; 864 goto err_purge_funcs;
865 }
864 } 866 }
865 usb_ep_autoconfig_reset(cdev->gadget); 867 usb_ep_autoconfig_reset(cdev->gadget);
866 } 868 }
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index f394f295d63d..1a66c5baa0d1 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1417,8 +1417,8 @@ static void functionfs_unbind(struct ffs_data *ffs)
1417 usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req); 1417 usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);
1418 ffs->ep0req = NULL; 1418 ffs->ep0req = NULL;
1419 ffs->gadget = NULL; 1419 ffs->gadget = NULL;
1420 ffs_data_put(ffs);
1421 clear_bit(FFS_FL_BOUND, &ffs->flags); 1420 clear_bit(FFS_FL_BOUND, &ffs->flags);
1421 ffs_data_put(ffs);
1422 } 1422 }
1423} 1423}
1424 1424
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 570c005062ab..465ef8e2cc91 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1270,10 +1270,6 @@ dev_release (struct inode *inode, struct file *fd)
1270 dev->buf = NULL; 1270 dev->buf = NULL;
1271 put_dev (dev); 1271 put_dev (dev);
1272 1272
1273 /* other endpoints were all decoupled from this device */
1274 spin_lock_irq(&dev->lock);
1275 dev->state = STATE_DEV_DISABLED;
1276 spin_unlock_irq(&dev->lock);
1277 return 0; 1273 return 0;
1278} 1274}
1279 1275
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index e64701d15401..ae959746f77f 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -150,8 +150,10 @@ static void cppi41_dma_callback(void *private_data)
150 remain_bytes, 150 remain_bytes,
151 direction, 151 direction,
152 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 152 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
153 if (WARN_ON(!dma_desc)) 153 if (WARN_ON(!dma_desc)) {
154 spin_unlock_irqrestore(&musb->lock, flags);
154 return; 155 return;
156 }
155 157
156 dma_desc->callback = cppi41_dma_callback; 158 dma_desc->callback = cppi41_dma_callback;
157 dma_desc->callback_param = channel; 159 dma_desc->callback_param = channel;
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 4ffbaace7913..4047cbb91bac 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -44,6 +44,7 @@
44#include <linux/of_device.h> 44#include <linux/of_device.h>
45#include <linux/of_address.h> 45#include <linux/of_address.h>
46#include <linux/of_irq.h> 46#include <linux/of_irq.h>
47#include <linux/usb/of.h>
47 48
48#include "musb_core.h" 49#include "musb_core.h"
49 50
@@ -230,6 +231,8 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
230 glue->last_timer = jiffies; 231 glue->last_timer = jiffies;
231 return; 232 return;
232 } 233 }
234 if (musb->port_mode == MUSB_PORT_MODE_HOST)
235 return;
233 236
234 if (time_after(glue->last_timer, timeout) && 237 if (time_after(glue->last_timer, timeout) &&
235 timer_pending(&glue->timer)) { 238 timer_pending(&glue->timer)) {
@@ -313,7 +316,6 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
313 jiffies + wrp->poll_seconds * HZ); 316 jiffies + wrp->poll_seconds * HZ);
314 WARNING("VBUS error workaround (delay coming)\n"); 317 WARNING("VBUS error workaround (delay coming)\n");
315 } else if (drvvbus) { 318 } else if (drvvbus) {
316 musb->is_active = 1;
317 MUSB_HST_MODE(musb); 319 MUSB_HST_MODE(musb);
318 musb->xceiv->otg->default_a = 1; 320 musb->xceiv->otg->default_a = 1;
319 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; 321 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
@@ -361,8 +363,8 @@ static int dsps_musb_init(struct musb *musb)
361 return -EINVAL; 363 return -EINVAL;
362 364
363 reg_base = devm_ioremap_resource(dev, r); 365 reg_base = devm_ioremap_resource(dev, r);
364 if (!musb->ctrl_base) 366 if (IS_ERR(reg_base))
365 return -EINVAL; 367 return PTR_ERR(reg_base);
366 musb->ctrl_base = reg_base; 368 musb->ctrl_base = reg_base;
367 369
368 /* NOP driver needs change if supporting dual instance */ 370 /* NOP driver needs change if supporting dual instance */
@@ -425,35 +427,51 @@ static int get_int_prop(struct device_node *dn, const char *s)
425 return val; 427 return val;
426} 428}
427 429
430static int get_musb_port_mode(struct device *dev)
431{
432 enum usb_dr_mode mode;
433
434 mode = of_usb_get_dr_mode(dev->of_node);
435 switch (mode) {
436 case USB_DR_MODE_HOST:
437 return MUSB_PORT_MODE_HOST;
438
439 case USB_DR_MODE_PERIPHERAL:
440 return MUSB_PORT_MODE_GADGET;
441
442 case USB_DR_MODE_UNKNOWN:
443 case USB_DR_MODE_OTG:
444 default:
445 return MUSB_PORT_MODE_DUAL_ROLE;
446 };
447}
448
428static int dsps_create_musb_pdev(struct dsps_glue *glue, 449static int dsps_create_musb_pdev(struct dsps_glue *glue,
429 struct platform_device *parent) 450 struct platform_device *parent)
430{ 451{
431 struct musb_hdrc_platform_data pdata; 452 struct musb_hdrc_platform_data pdata;
432 struct resource resources[2]; 453 struct resource resources[2];
454 struct resource *res;
433 struct device *dev = &parent->dev; 455 struct device *dev = &parent->dev;
434 struct musb_hdrc_config *config; 456 struct musb_hdrc_config *config;
435 struct platform_device *musb; 457 struct platform_device *musb;
436 struct device_node *dn = parent->dev.of_node; 458 struct device_node *dn = parent->dev.of_node;
437 struct device_node *child_node;
438 int ret; 459 int ret;
439 460
440 child_node = of_get_child_by_name(dn, "usb");
441 if (!child_node)
442 return -EINVAL;
443
444 memset(resources, 0, sizeof(resources)); 461 memset(resources, 0, sizeof(resources));
445 ret = of_address_to_resource(child_node, 0, &resources[0]); 462 res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc");
446 if (ret) { 463 if (!res) {
447 dev_err(dev, "failed to get memory.\n"); 464 dev_err(dev, "failed to get memory.\n");
448 return ret; 465 return -EINVAL;
449 } 466 }
467 resources[0] = *res;
450 468
451 ret = of_irq_to_resource(child_node, 0, &resources[1]); 469 res = platform_get_resource_byname(parent, IORESOURCE_IRQ, "mc");
452 if (ret == 0) { 470 if (!res) {
453 dev_err(dev, "failed to get irq.\n"); 471 dev_err(dev, "failed to get irq.\n");
454 ret = -EINVAL; 472 return -EINVAL;
455 return ret;
456 } 473 }
474 resources[1] = *res;
457 475
458 /* allocate the child platform device */ 476 /* allocate the child platform device */
459 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); 477 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
@@ -465,7 +483,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
465 musb->dev.parent = dev; 483 musb->dev.parent = dev;
466 musb->dev.dma_mask = &musb_dmamask; 484 musb->dev.dma_mask = &musb_dmamask;
467 musb->dev.coherent_dma_mask = musb_dmamask; 485 musb->dev.coherent_dma_mask = musb_dmamask;
468 musb->dev.of_node = of_node_get(child_node); 486 musb->dev.of_node = of_node_get(dn);
469 487
470 glue->musb = musb; 488 glue->musb = musb;
471 489
@@ -485,11 +503,12 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
485 pdata.config = config; 503 pdata.config = config;
486 pdata.platform_ops = &dsps_ops; 504 pdata.platform_ops = &dsps_ops;
487 505
488 config->num_eps = get_int_prop(child_node, "num-eps"); 506 config->num_eps = get_int_prop(dn, "mentor,num-eps");
489 config->ram_bits = get_int_prop(child_node, "ram-bits"); 507 config->ram_bits = get_int_prop(dn, "mentor,ram-bits");
490 pdata.mode = get_int_prop(child_node, "port-mode"); 508 pdata.mode = get_musb_port_mode(dev);
491 pdata.power = get_int_prop(child_node, "power"); 509 /* DT keeps this entry in mA, musb expects it as per USB spec */
492 config->multipoint = of_property_read_bool(child_node, "multipoint"); 510 pdata.power = get_int_prop(dn, "mentor,power") / 2;
511 config->multipoint = of_property_read_bool(dn, "mentor,multipoint");
493 512
494 ret = platform_device_add_data(musb, &pdata, sizeof(pdata)); 513 ret = platform_device_add_data(musb, &pdata, sizeof(pdata));
495 if (ret) { 514 if (ret) {
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 4376f51f5ef1..9a08679d204d 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -76,13 +76,21 @@ static inline void map_dma_buffer(struct musb_request *request,
76 return; 76 return;
77 77
78 if (request->request.dma == DMA_ADDR_INVALID) { 78 if (request->request.dma == DMA_ADDR_INVALID) {
79 request->request.dma = dma_map_single( 79 dma_addr_t dma_addr;
80 int ret;
81
82 dma_addr = dma_map_single(
80 musb->controller, 83 musb->controller,
81 request->request.buf, 84 request->request.buf,
82 request->request.length, 85 request->request.length,
83 request->tx 86 request->tx
84 ? DMA_TO_DEVICE 87 ? DMA_TO_DEVICE
85 : DMA_FROM_DEVICE); 88 : DMA_FROM_DEVICE);
89 ret = dma_mapping_error(musb->controller, dma_addr);
90 if (ret)
91 return;
92
93 request->request.dma = dma_addr;
86 request->map_state = MUSB_MAPPED; 94 request->map_state = MUSB_MAPPED;
87 } else { 95 } else {
88 dma_sync_single_for_device(musb->controller, 96 dma_sync_single_for_device(musb->controller,
@@ -1804,6 +1812,8 @@ err:
1804 1812
1805void musb_gadget_cleanup(struct musb *musb) 1813void musb_gadget_cleanup(struct musb *musb)
1806{ 1814{
1815 if (musb->port_mode == MUSB_PORT_MODE_HOST)
1816 return;
1807 usb_del_gadget_udc(&musb->g); 1817 usb_del_gadget_udc(&musb->g);
1808} 1818}
1809 1819
@@ -1929,7 +1939,8 @@ static int musb_gadget_stop(struct usb_gadget *g,
1929 stop_activity(musb, driver); 1939 stop_activity(musb, driver);
1930 otg_set_peripheral(musb->xceiv->otg, NULL); 1940 otg_set_peripheral(musb->xceiv->otg, NULL);
1931 1941
1932 dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); 1942 dev_dbg(musb->controller, "unregistering driver %s\n",
1943 driver ? driver->function : "(removed)");
1933 1944
1934 musb->is_active = 0; 1945 musb->is_active = 0;
1935 musb->gadget_driver = NULL; 1946 musb->gadget_driver = NULL;
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index a9695f5a92fb..9a2b8c85f19a 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2628,6 +2628,8 @@ int musb_host_alloc(struct musb *musb)
2628 2628
2629void musb_host_cleanup(struct musb *musb) 2629void musb_host_cleanup(struct musb *musb)
2630{ 2630{
2631 if (musb->port_mode == MUSB_PORT_MODE_GADGET)
2632 return;
2631 usb_remove_hcd(musb->hcd); 2633 usb_remove_hcd(musb->hcd);
2632 musb->hcd = NULL; 2634 musb->hcd = NULL;
2633} 2635}
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index e51dd9b88e71..3700e9713258 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -333,7 +333,9 @@ static int ux500_dma_controller_start(struct ux500_dma_controller *controller)
333 if (!ux500_channel->dma_chan) 333 if (!ux500_channel->dma_chan)
334 ux500_channel->dma_chan = 334 ux500_channel->dma_chan =
335 dma_request_channel(mask, 335 dma_request_channel(mask,
336 data->dma_filter, 336 data ?
337 data->dma_filter :
338 NULL,
337 param_array[ch_num]); 339 param_array[ch_num]);
338 340
339 if (!ux500_channel->dma_chan) { 341 if (!ux500_channel->dma_chan) {
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c
index 759754521426..22cf07d62e4c 100644
--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -42,8 +42,8 @@ static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, bool on)
42 reg = AM335X_USB1_CTRL; 42 reg = AM335X_USB1_CTRL;
43 break; 43 break;
44 default: 44 default:
45 __WARN(); 45 WARN_ON(1);
46 return; 46 return;
47 } 47 }
48 48
49 val = readl(usb_ctrl->phy_reg + reg); 49 val = readl(usb_ctrl->phy_reg + reg);
diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h
index ca266280895d..e1859b8ef567 100644
--- a/drivers/usb/phy/phy-fsl-usb.h
+++ b/drivers/usb/phy/phy-fsl-usb.h
@@ -15,7 +15,7 @@
15 * 675 Mass Ave, Cambridge, MA 02139, USA. 15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */ 16 */
17 17
18#include "otg_fsm.h" 18#include "phy-fsm-usb.h"
19#include <linux/usb/otg.h> 19#include <linux/usb/otg.h>
20#include <linux/ioctl.h> 20#include <linux/ioctl.h>
21 21
diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c
index c520b3548e7c..7f4596606e18 100644
--- a/drivers/usb/phy/phy-fsm-usb.c
+++ b/drivers/usb/phy/phy-fsm-usb.c
@@ -29,7 +29,7 @@
29#include <linux/usb/gadget.h> 29#include <linux/usb/gadget.h>
30#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
31 31
32#include "phy-otg-fsm.h" 32#include "phy-fsm-usb.h"
33 33
34/* Change USB protocol when there is a protocol change */ 34/* Change USB protocol when there is a protocol change */
35static int otg_set_protocol(struct otg_fsm *fsm, int protocol) 35static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/usb/phy/phy-omap-usb2.c
index 844ab68f08d0..d266861d24f7 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/usb/phy/phy-omap-usb2.c
@@ -98,8 +98,8 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
98 98
99static int omap_usb2_suspend(struct usb_phy *x, int suspend) 99static int omap_usb2_suspend(struct usb_phy *x, int suspend)
100{ 100{
101 u32 ret;
102 struct omap_usb *phy = phy_to_omapusb(x); 101 struct omap_usb *phy = phy_to_omapusb(x);
102 int ret;
103 103
104 if (suspend && !phy->is_suspended) { 104 if (suspend && !phy->is_suspended) {
105 omap_control_usb_phy_power(phy->control_dev, 0); 105 omap_control_usb_phy_power(phy->control_dev, 0);
@@ -108,8 +108,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
108 } else if (!suspend && phy->is_suspended) { 108 } else if (!suspend && phy->is_suspended) {
109 ret = pm_runtime_get_sync(phy->dev); 109 ret = pm_runtime_get_sync(phy->dev);
110 if (ret < 0) { 110 if (ret < 0) {
111 dev_err(phy->dev, "get_sync failed with err %d\n", 111 dev_err(phy->dev, "get_sync failed with err %d\n", ret);
112 ret);
113 return ret; 112 return ret;
114 } 113 }
115 omap_control_usb_phy_power(phy->control_dev, 1); 114 omap_control_usb_phy_power(phy->control_dev, 1);
@@ -209,9 +208,9 @@ static int omap_usb2_runtime_suspend(struct device *dev)
209 208
210static int omap_usb2_runtime_resume(struct device *dev) 209static int omap_usb2_runtime_resume(struct device *dev)
211{ 210{
212 u32 ret = 0;
213 struct platform_device *pdev = to_platform_device(dev); 211 struct platform_device *pdev = to_platform_device(dev);
214 struct omap_usb *phy = platform_get_drvdata(pdev); 212 struct omap_usb *phy = platform_get_drvdata(pdev);
213 int ret;
215 214
216 ret = clk_enable(phy->wkupclk); 215 ret = clk_enable(phy->wkupclk);
217 if (ret < 0) { 216 if (ret < 0) {