Skip to content

Commit

Permalink
Merge tag 'fixes-for-v3.9-rc2' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/balbi/usb into usb-linus

Felipe writes:

"usb: fixes for v3.9-rc2

A few drivers got their gadget->dev registration problems
exposed by the removal of ->start()/->stop() functions from
udc-core.c. All of such instances are now fixed.

We're also fixing chipidea's mistake of registering private
debugging sysfs files under the gadget's device. This is
in preparation to complete removal of gadget->dev handling
from all UDC drivers which will happen for v3.10 merge window.

MUSB's Kconfig got a fix to avoid a non-buildable selection
of its Kconfig choices.

Some extra devm_ioremap_resource() are added here because they
missed the merge window.

Finally, we have a temporary fix linking function drivers
before gadget drivers so they work fine when they're statically
linked to the kernel. We've done it so since the real fix wouldn't
fit the -rc cycle."
  • Loading branch information
Greg Kroah-Hartman committed Mar 5, 2013
2 parents 6dbe51c + 29240e2 commit ea5301a
Showing 18 changed files with 84 additions and 94 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/chipidea/udc.c
Original file line number Diff line number Diff line change
@@ -1767,7 +1767,7 @@ static int udc_start(struct ci13xxx *ci)
goto put_transceiver;
}

retval = dbg_create_files(&ci->gadget.dev);
retval = dbg_create_files(ci->dev);
if (retval)
goto unreg_device;

@@ -1796,7 +1796,7 @@ static int udc_start(struct ci13xxx *ci)

dev_err(dev, "error = %i\n", retval);
remove_dbg:
dbg_remove_files(&ci->gadget.dev);
dbg_remove_files(ci->dev);
unreg_device:
device_unregister(&ci->gadget.dev);
put_transceiver:
@@ -1836,7 +1836,7 @@ static void udc_stop(struct ci13xxx *ci)
if (ci->global_phy)
usb_put_phy(ci->transceiver);
}
dbg_remove_files(&ci->gadget.dev);
dbg_remove_files(ci->dev);
device_unregister(&ci->gadget.dev);
/* my kobject is dynamic, I swear! */
memset(&ci->gadget, 0, sizeof(ci->gadget));
1 change: 1 addition & 0 deletions drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
@@ -583,6 +583,7 @@ static int dwc3_remove(struct platform_device *pdev)
break;
}

dwc3_free_event_buffers(dwc);
dwc3_core_exit(dwc);

return 0;
2 changes: 0 additions & 2 deletions drivers/usb/dwc3/dwc3-exynos.c
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@
#include <linux/usb/nop-usb-xceiv.h>
#include <linux/of.h>

#include "core.h"

struct dwc3_exynos {
struct platform_device *dwc3;
struct platform_device *usb2_phy;
8 changes: 3 additions & 5 deletions drivers/usb/dwc3/dwc3-omap.c
Original file line number Diff line number Diff line change
@@ -54,8 +54,6 @@
#include <linux/usb/otg.h>
#include <linux/usb/nop-usb-xceiv.h>

#include "core.h"

/*
* All these registers belong to OMAP's Wrapper around the
* DesignWare USB3 Core.
@@ -465,20 +463,20 @@ static int dwc3_omap_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id of_dwc3_matach[] = {
static const struct of_device_id of_dwc3_match[] = {
{
"ti,dwc3",
},
{ },
};
MODULE_DEVICE_TABLE(of, of_dwc3_matach);
MODULE_DEVICE_TABLE(of, of_dwc3_match);

static struct platform_driver dwc3_omap_driver = {
.probe = dwc3_omap_probe,
.remove = dwc3_omap_remove,
.driver = {
.name = "omap-dwc3",
.of_match_table = of_dwc3_matach,
.of_match_table = of_dwc3_match,
},
};

2 changes: 0 additions & 2 deletions drivers/usb/dwc3/dwc3-pci.c
Original file line number Diff line number Diff line change
@@ -45,8 +45,6 @@
#include <linux/usb/otg.h>
#include <linux/usb/nop-usb-xceiv.h>

#include "core.h"

/* FIXME define these in <linux/pci_ids.h> */
#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
3 changes: 0 additions & 3 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
@@ -2159,16 +2159,13 @@ static void dwc3_gadget_phy_suspend(struct dwc3 *dwc, u8 speed)

static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
{
struct dwc3_gadget_ep_cmd_params params;
struct dwc3_ep *dep;
int ret;
u32 reg;
u8 speed;

dev_vdbg(dwc->dev, "%s\n", __func__);

memset(&params, 0x00, sizeof(params));

reg = dwc3_readl(dwc->regs, DWC3_DSTS);
speed = reg & DWC3_DSTS_CONNECTSPD;
dwc->speed = speed;
12 changes: 6 additions & 6 deletions drivers/usb/gadget/Makefile
Original file line number Diff line number Diff line change
@@ -35,6 +35,12 @@ mv_udc-y := mv_udc_core.o
obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o
obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o

# USB Functions
obj-$(CONFIG_USB_F_ACM) += f_acm.o
f_ss_lb-y := f_loopback.o f_sourcesink.o
obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o
obj-$(CONFIG_USB_U_SERIAL) += u_serial.o

#
# USB gadget drivers
#
@@ -74,9 +80,3 @@ obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o
obj-$(CONFIG_USB_G_NCM) += g_ncm.o
obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o
obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o

# USB Functions
obj-$(CONFIG_USB_F_ACM) += f_acm.o
f_ss_lb-y := f_loopback.o f_sourcesink.o
obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o
obj-$(CONFIG_USB_U_SERIAL) += u_serial.o
1 change: 1 addition & 0 deletions drivers/usb/gadget/f_uac1.c
Original file line number Diff line number Diff line change
@@ -418,6 +418,7 @@ static int audio_get_intf_req(struct usb_function *f,

req->context = audio;
req->complete = f_audio_complete;
len = min_t(size_t, sizeof(value), len);
memcpy(req->buf, &value, len);

return len;
20 changes: 8 additions & 12 deletions drivers/usb/gadget/imx_udc.c
Original file line number Diff line number Diff line change
@@ -1334,27 +1334,18 @@ static int imx_udc_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver)
{
struct imx_udc_struct *imx_usb;
int retval;

imx_usb = container_of(gadget, struct imx_udc_struct, gadget);
/* first hook up the driver ... */
imx_usb->driver = driver;
imx_usb->gadget.dev.driver = &driver->driver;

retval = device_add(&imx_usb->gadget.dev);
if (retval)
goto fail;

D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n",
__func__, driver->driver.name);

imx_udc_enable(imx_usb);

return 0;
fail:
imx_usb->driver = NULL;
imx_usb->gadget.dev.driver = NULL;
return retval;
}

static int imx_udc_stop(struct usb_gadget *gadget,
@@ -1370,8 +1361,6 @@ static int imx_udc_stop(struct usb_gadget *gadget,
imx_usb->gadget.dev.driver = NULL;
imx_usb->driver = NULL;

device_del(&imx_usb->gadget.dev);

D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n",
__func__, driver->driver.name);

@@ -1477,6 +1466,10 @@ static int __init imx_udc_probe(struct platform_device *pdev)
imx_usb->gadget.dev.parent = &pdev->dev;
imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask;

ret = device_add(&imx_usb->gadget.dev);
if (retval)
goto fail4;

platform_set_drvdata(pdev, imx_usb);

usb_init_data(imx_usb);
@@ -1488,9 +1481,11 @@ static int __init imx_udc_probe(struct platform_device *pdev)

ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget);
if (ret)
goto fail4;
goto fail5;

return 0;
fail5:
device_unregister(&imx_usb->gadget.dev);
fail4:
for (i = 0; i < IMX_USB_NB_EP + 1; i++)
free_irq(imx_usb->usbd_int[i], imx_usb);
@@ -1514,6 +1509,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
int i;

usb_del_gadget_udc(&imx_usb->gadget);
device_unregister(&imx_usb->gadget.dev);
imx_udc_disable(imx_usb);
del_timer(&imx_usb->timer);

20 changes: 11 additions & 9 deletions drivers/usb/gadget/pxa25x_udc.c
Original file line number Diff line number Diff line change
@@ -1266,13 +1266,6 @@ static int pxa25x_udc_start(struct usb_gadget *g,
dev->gadget.dev.driver = &driver->driver;
dev->pullup = 1;

retval = device_add (&dev->gadget.dev);
if (retval) {
dev->driver = NULL;
dev->gadget.dev.driver = NULL;
return retval;
}

/* ... then enable host detection and ep0; and we're ready
* for set_configuration as well as eventual disconnect.
*/
@@ -1331,7 +1324,6 @@ static int pxa25x_udc_stop(struct usb_gadget*g,
dev->gadget.dev.driver = NULL;
dev->driver = NULL;

device_del (&dev->gadget.dev);
dump_state(dev);

return 0;
@@ -2146,6 +2138,13 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
dev->gadget.dev.parent = &pdev->dev;
dev->gadget.dev.dma_mask = pdev->dev.dma_mask;

retval = device_add(&dev->gadget.dev);
if (retval) {
dev->driver = NULL;
dev->gadget.dev.driver = NULL;
goto err_device_add;
}

the_controller = dev;
platform_set_drvdata(pdev, dev);

@@ -2196,6 +2195,8 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
free_irq(irq, dev);
#endif
err_irq1:
device_unregister(&dev->gadget.dev);
err_device_add:
if (gpio_is_valid(dev->mach->gpio_pullup))
gpio_free(dev->mach->gpio_pullup);
err_gpio_pullup:
@@ -2217,10 +2218,11 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
{
struct pxa25x_udc *dev = platform_get_drvdata(pdev);

usb_del_gadget_udc(&dev->gadget);
if (dev->driver)
return -EBUSY;

usb_del_gadget_udc(&dev->gadget);
device_unregister(&dev->gadget.dev);
dev->pullup = 0;
pullup(dev);

18 changes: 12 additions & 6 deletions drivers/usb/gadget/pxa27x_udc.c
Original file line number Diff line number Diff line change
@@ -1814,11 +1814,6 @@ static int pxa27x_udc_start(struct usb_gadget *g,
udc->gadget.dev.driver = &driver->driver;
dplus_pullup(udc, 1);

retval = device_add(&udc->gadget.dev);
if (retval) {
dev_err(udc->dev, "device_add error %d\n", retval);
goto fail;
}
if (!IS_ERR_OR_NULL(udc->transceiver)) {
retval = otg_set_peripheral(udc->transceiver->otg,
&udc->gadget);
@@ -1876,7 +1871,6 @@ static int pxa27x_udc_stop(struct usb_gadget *g,

udc->driver = NULL;

device_del(&udc->gadget.dev);

if (!IS_ERR_OR_NULL(udc->transceiver))
return otg_set_peripheral(udc->transceiver->otg, NULL);
@@ -2480,13 +2474,24 @@ static int __init pxa_udc_probe(struct platform_device *pdev)
driver_name, udc->irq, retval);
goto err_irq;
}

retval = device_add(&udc->gadget.dev);
if (retval) {
dev_err(udc->dev, "device_add error %d\n", retval);
goto err_dev_add;
}

retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget);
if (retval)
goto err_add_udc;

pxa_init_debugfs(udc);

return 0;

err_add_udc:
device_unregister(&udc->gadget.dev);
err_dev_add:
free_irq(udc->irq, udc);
err_irq:
iounmap(udc->regs);
@@ -2507,6 +2512,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev)
int gpio = udc->mach->gpio_pullup;

usb_del_gadget_udc(&udc->gadget);
device_del(&udc->gadget.dev);
usb_gadget_unregister_driver(udc->driver);
free_irq(udc->irq, udc);
pxa_cleanup_debugfs(udc);
28 changes: 12 additions & 16 deletions drivers/usb/gadget/s3c2410_udc.c
Original file line number Diff line number Diff line change
@@ -1668,39 +1668,25 @@ static void s3c2410_udc_enable(struct s3c2410_udc *dev)
static int s3c2410_udc_start(struct usb_gadget *g,
struct usb_gadget_driver *driver)
{
struct s3c2410_udc *udc = to_s3c2410(g)
int retval;
struct s3c2410_udc *udc = to_s3c2410(g);

dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name);

/* Hook the driver */
udc->driver = driver;
udc->gadget.dev.driver = &driver->driver;

/* Bind the driver */
retval = device_add(&udc->gadget.dev);
if (retval) {
dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval);
goto register_error;
}

/* Enable udc */
s3c2410_udc_enable(udc);

return 0;

register_error:
udc->driver = NULL;
udc->gadget.dev.driver = NULL;
return retval;
}

static int s3c2410_udc_stop(struct usb_gadget *g,
struct usb_gadget_driver *driver)
{
struct s3c2410_udc *udc = to_s3c2410(g);

device_del(&udc->gadget.dev);
udc->driver = NULL;

/* Disable udc */
@@ -1842,6 +1828,13 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
udc->gadget.dev.parent = &pdev->dev;
udc->gadget.dev.dma_mask = pdev->dev.dma_mask;

/* Bind the driver */
retval = device_add(&udc->gadget.dev);
if (retval) {
dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval);
goto err_device_add;
}

the_controller = udc;
platform_set_drvdata(pdev, udc);

@@ -1930,6 +1923,8 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
err_int:
free_irq(IRQ_USBD, udc);
err_map:
device_unregister(&udc->gadget.dev);
err_device_add:
iounmap(base_addr);
err_mem:
release_mem_region(rsrc_start, rsrc_len);
@@ -1947,10 +1942,11 @@ static int s3c2410_udc_remove(struct platform_device *pdev)

dev_dbg(&pdev->dev, "%s()\n", __func__);

usb_del_gadget_udc(&udc->gadget);
if (udc->driver)
return -EBUSY;

usb_del_gadget_udc(&udc->gadget);
device_unregister(&udc->gadget.dev);
debugfs_remove(udc->regs_info);

if (udc_info && !udc_info->udc_command &&
Loading

0 comments on commit ea5301a

Please sign in to comment.