Skip to content

Commit

Permalink
Merge tag 'fixes-for-v3.12-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.12-rc2

Here's first set of fixes for v3.12-rc series, patches have
been soaking in linux-usb for a while now.

We have the usual sparse and build warnings, a Kconfig fix
to a mismerge on dwc3 Kconfig, fix for a possible memory leak
in dwc3, s3c-hsotg won't disconnect when bus goes idle, locking
fix in mv_u3d_core, endpoint disable fix in f_mass_storage.

We also have one device ID added to dwc3's PCI glue layer in order
to support Intel's BayTrail devices.

Signed-of-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Greg Kroah-Hartman committed Sep 17, 2013
2 parents 7d26a78 + d3675e3 commit 42f4891
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 45 deletions.
1 change: 0 additions & 1 deletion drivers/usb/dwc3/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
config USB_DWC3
tristate "DesignWare USB3 DRD Core Support"
depends on (USB || USB_GADGET) && HAS_DMA
depends on EXTCON
select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
help
Say Y or M here if your system has a Dual Role SuperSpeed
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/dwc3/dwc3-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/* FIXME define these in <linux/pci_ids.h> */
#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
#define PCI_DEVICE_ID_INTEL_BYT 0x0f37

struct dwc3_pci {
struct device *dev;
Expand Down Expand Up @@ -187,6 +188,7 @@ static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_id_table) = {
PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
{ } /* Terminating Entry */
};
MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -2611,15 +2611,13 @@ int dwc3_gadget_init(struct dwc3 *dwc)
ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget);
if (ret) {
dev_err(dwc->dev, "failed to register udc\n");
goto err5;
goto err4;
}

return 0;

err5:
dwc3_gadget_free_endpoints(dwc);

err4:
dwc3_gadget_free_endpoints(dwc);
dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE,
dwc->ep0_bounce, dwc->ep0_bounce_addr);

Expand Down
19 changes: 1 addition & 18 deletions drivers/usb/gadget/cdc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ static int __init cdc_do_config(struct usb_configuration *c)
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
}

fi_ecm = usb_get_function_instance("ecm");
if (IS_ERR(fi_ecm)) {
status = PTR_ERR(fi_ecm);
goto err_func_ecm;
}

f_ecm = usb_get_function(fi_ecm);
if (IS_ERR(f_ecm)) {
status = PTR_ERR(f_ecm);
Expand All @@ -129,35 +123,24 @@ static int __init cdc_do_config(struct usb_configuration *c)
if (status)
goto err_add_ecm;

fi_serial = usb_get_function_instance("acm");
if (IS_ERR(fi_serial)) {
status = PTR_ERR(fi_serial);
goto err_get_acm;
}

f_acm = usb_get_function(fi_serial);
if (IS_ERR(f_acm)) {
status = PTR_ERR(f_acm);
goto err_func_acm;
goto err_get_acm;
}

status = usb_add_function(c, f_acm);
if (status)
goto err_add_acm;

return 0;

err_add_acm:
usb_put_function(f_acm);
err_func_acm:
usb_put_function_instance(fi_serial);
err_get_acm:
usb_remove_function(c, f_ecm);
err_add_ecm:
usb_put_function(f_ecm);
err_get_ecm:
usb_put_function_instance(fi_ecm);
err_func_ecm:
return status;
}

Expand Down
7 changes: 4 additions & 3 deletions drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,9 @@ static int dummy_udc_stop(struct usb_gadget *g,
struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g);
struct dummy *dum = dum_hcd->dum;

dev_dbg(udc_dev(dum), "unregister gadget driver '%s'\n",
driver->driver.name);
if (driver)
dev_dbg(udc_dev(dum), "unregister gadget driver '%s'\n",
driver->driver.name);

dum->driver = NULL;

Expand Down Expand Up @@ -1000,8 +1001,8 @@ static int dummy_udc_remove(struct platform_device *pdev)
{
struct dummy *dum = platform_get_drvdata(pdev);

usb_del_gadget_udc(&dum->gadget);
device_remove_file(&dum->gadget.dev, &dev_attr_function);
usb_del_gadget_udc(&dum->gadget);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/f_ecm.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ static void ecm_unbind(struct usb_configuration *c, struct usb_function *f)
usb_ep_free_request(ecm->notify, ecm->notify_req);
}

struct usb_function *ecm_alloc(struct usb_function_instance *fi)
static struct usb_function *ecm_alloc(struct usb_function_instance *fi)
{
struct f_ecm *ecm;
struct f_ecm_opts *opts;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/f_eem.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ static void eem_unbind(struct usb_configuration *c, struct usb_function *f)
usb_free_all_descriptors(f);
}

struct usb_function *eem_alloc(struct usb_function_instance *fi)
static struct usb_function *eem_alloc(struct usb_function_instance *fi)
{
struct f_eem *eem;
struct f_eem_opts *opts;
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2260,10 +2260,12 @@ static int do_set_interface(struct fsg_common *common, struct fsg_dev *new_fsg)
/* Disable the endpoints */
if (fsg->bulk_in_enabled) {
usb_ep_disable(fsg->bulk_in);
fsg->bulk_in->driver_data = NULL;
fsg->bulk_in_enabled = 0;
}
if (fsg->bulk_out_enabled) {
usb_ep_disable(fsg->bulk_out);
fsg->bulk_out->driver_data = NULL;
fsg->bulk_out_enabled = 0;
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static __init int rndis_do_config(struct usb_configuration *c)
return ret;
}

static int rndis_config_register(struct usb_composite_dev *cdev)
static __ref int rndis_config_register(struct usb_composite_dev *cdev)
{
static struct usb_configuration config = {
.bConfigurationValue = MULTI_RNDIS_CONFIG_NUM,
Expand All @@ -194,7 +194,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev)

#else

static int rndis_config_register(struct usb_composite_dev *cdev)
static __ref int rndis_config_register(struct usb_composite_dev *cdev)
{
return 0;
}
Expand Down Expand Up @@ -241,7 +241,7 @@ static __init int cdc_do_config(struct usb_configuration *c)
return ret;
}

static int cdc_config_register(struct usb_composite_dev *cdev)
static __ref int cdc_config_register(struct usb_composite_dev *cdev)
{
static struct usb_configuration config = {
.bConfigurationValue = MULTI_CDC_CONFIG_NUM,
Expand All @@ -256,7 +256,7 @@ static int cdc_config_register(struct usb_composite_dev *cdev)

#else

static int cdc_config_register(struct usb_composite_dev *cdev)
static __ref int cdc_config_register(struct usb_composite_dev *cdev)
{
return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/gadget/mv_u3d_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ static int mv_u3d_ep_disable(struct usb_ep *_ep)
struct mv_u3d_ep *ep;
struct mv_u3d_ep_context *ep_context;
u32 epxcr, direction;
unsigned long flags;

if (!_ep)
return -EINVAL;
Expand All @@ -661,7 +662,9 @@ static int mv_u3d_ep_disable(struct usb_ep *_ep)
direction = mv_u3d_ep_dir(ep);

/* nuke all pending requests (does flush) */
spin_lock_irqsave(&u3d->lock, flags);
mv_u3d_nuke(ep, -ESHUTDOWN);
spin_unlock_irqrestore(&u3d->lock, flags);

/* Disable the endpoint for Rx or Tx and reset the endpoint type */
if (direction == MV_U3D_EP_DIR_OUT) {
Expand Down
13 changes: 4 additions & 9 deletions drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2475,8 +2475,6 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
if (gintsts & GINTSTS_ErlySusp) {
dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n");
writel(GINTSTS_ErlySusp, hsotg->regs + GINTSTS);

s3c_hsotg_disconnect(hsotg);
}

/*
Expand Down Expand Up @@ -2962,25 +2960,22 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
if (!hsotg)
return -ENODEV;

if (!driver || driver != hsotg->driver || !driver->unbind)
return -EINVAL;

/* all endpoints should be shutdown */
for (ep = 0; ep < hsotg->num_of_eps; ep++)
s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);

spin_lock_irqsave(&hsotg->lock, flags);

s3c_hsotg_phy_disable(hsotg);
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);

hsotg->driver = NULL;
if (!driver)
hsotg->driver = NULL;

hsotg->gadget.speed = USB_SPEED_UNKNOWN;

spin_unlock_irqrestore(&hsotg->lock, flags);

dev_info(hsotg->dev, "unregistered gadget driver '%s'\n",
driver->driver.name);
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/host/fsl-mph-dr-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct fsl_usb2_dev_data {
enum fsl_usb2_operating_modes op_mode; /* operating mode */
};

struct fsl_usb2_dev_data dr_mode_data[] = {
static struct fsl_usb2_dev_data dr_mode_data[] = {
{
.dr_mode = "host",
.drivers = { "fsl-ehci", NULL, NULL, },
Expand All @@ -42,7 +42,7 @@ struct fsl_usb2_dev_data dr_mode_data[] = {
},
};

struct fsl_usb2_dev_data *get_dr_mode_data(struct device_node *np)
static struct fsl_usb2_dev_data *get_dr_mode_data(struct device_node *np)
{
const unsigned char *prop;
int i;
Expand Down Expand Up @@ -75,7 +75,7 @@ static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
return FSL_USB2_PHY_NONE;
}

struct platform_device *fsl_usb2_device_register(
static struct platform_device *fsl_usb2_device_register(
struct platform_device *ofdev,
struct fsl_usb2_platform_data *pdata,
const char *name, int id)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/phy/phy-omap-usb3.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static struct usb_dpll_params *omap_usb3_get_dpll_params(unsigned long rate)
return &dpll_map[i].params;
}

return 0;
return NULL;
}

static int omap_usb3_suspend(struct usb_phy *x, int suspend)
Expand Down

0 comments on commit 42f4891

Please sign in to comment.