Skip to content

Commit

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

First set of fixes for this -rc cycle. A few important
fixes which should be backported to stable kernels and
the usual set of sparse warning fixes. There's also a
regression fix on phy-generic.c which would prevent
am335x-based platforms from having their PHY drivers
probed.

Signed-of-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Greg Kroah-Hartman committed Nov 27, 2013
2 parents 043e3f8 + 2cf93be commit c24cb6c
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 97 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
dep = dwc3_wIndex_to_dep(dwc, wIndex);
if (!dep)
return -EINVAL;
if (set == 0 && (dep->flags & DWC3_EP_WEDGE))
break;
ret = __dwc3_gadget_ep_set_halt(dep, set);
if (ret)
return -EINVAL;
Expand Down
5 changes: 1 addition & 4 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1200,17 +1200,14 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
else
dep->flags |= DWC3_EP_STALL;
} else {
if (dep->flags & DWC3_EP_WEDGE)
return 0;

ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
DWC3_DEPCMD_CLEARSTALL, &params);
if (ret)
dev_err(dwc->dev, "failed to %s STALL on %s\n",
value ? "set" : "clear",
dep->name);
else
dep->flags &= ~DWC3_EP_STALL;
dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE);
}

return ret;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ config USB_CONFIGFS_PHONET
config USB_CONFIGFS_MASS_STORAGE
boolean "Mass storage"
depends on USB_CONFIGFS
depends on BLOCK
select USB_F_MASS_STORAGE
help
The Mass Storage Gadget acts as a USB Mass Storage disk drive.
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ static void reset_config(struct usb_composite_dev *cdev)
bitmap_zero(f->endpoints, 32);
}
cdev->config = NULL;
cdev->delayed_status = 0;
}

static int set_config(struct usb_composite_dev *cdev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ static struct ffs_data *ffs_data_new(void)
{
struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);
if (unlikely(!ffs))
return 0;
return NULL;

ENTER();

Expand Down
27 changes: 14 additions & 13 deletions drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ static int fsg_setup(struct usb_function *f,
*/
DBG(fsg, "bulk reset request\n");
raise_exception(fsg->common, FSG_STATE_RESET);
return DELAYED_STATUS;
return USB_GADGET_DELAYED_STATUS;

case US_BULK_GET_MAX_LUN:
if (ctrl->bRequestType !=
Expand Down Expand Up @@ -602,13 +602,14 @@ static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
return true;
}

static int sleep_thread(struct fsg_common *common)
static int sleep_thread(struct fsg_common *common, bool can_freeze)
{
int rc = 0;

/* Wait until a signal arrives or we are woken up */
for (;;) {
try_to_freeze();
if (can_freeze)
try_to_freeze();
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
rc = -EINTR;
Expand Down Expand Up @@ -682,7 +683,7 @@ static int do_read(struct fsg_common *common)
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
rc = sleep_thread(common);
rc = sleep_thread(common, false);
if (rc)
return rc;
}
Expand Down Expand Up @@ -937,7 +938,7 @@ static int do_write(struct fsg_common *common)
}

/* Wait for something to happen */
rc = sleep_thread(common);
rc = sleep_thread(common, false);
if (rc)
return rc;
}
Expand Down Expand Up @@ -1504,7 +1505,7 @@ static int throw_away_data(struct fsg_common *common)
}

/* Otherwise wait for something to happen */
rc = sleep_thread(common);
rc = sleep_thread(common, true);
if (rc)
return rc;
}
Expand Down Expand Up @@ -1625,7 +1626,7 @@ static int send_status(struct fsg_common *common)
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
rc = sleep_thread(common);
rc = sleep_thread(common, true);
if (rc)
return rc;
}
Expand Down Expand Up @@ -1828,7 +1829,7 @@ static int do_scsi_command(struct fsg_common *common)
bh = common->next_buffhd_to_fill;
common->next_buffhd_to_drain = bh;
while (bh->state != BUF_STATE_EMPTY) {
rc = sleep_thread(common);
rc = sleep_thread(common, true);
if (rc)
return rc;
}
Expand Down Expand Up @@ -2174,7 +2175,7 @@ static int get_next_command(struct fsg_common *common)
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
rc = sleep_thread(common);
rc = sleep_thread(common, true);
if (rc)
return rc;
}
Expand All @@ -2193,7 +2194,7 @@ static int get_next_command(struct fsg_common *common)

/* Wait for the CBW to arrive */
while (bh->state != BUF_STATE_FULL) {
rc = sleep_thread(common);
rc = sleep_thread(common, true);
if (rc)
return rc;
}
Expand Down Expand Up @@ -2379,7 +2380,7 @@ static void handle_exception(struct fsg_common *common)
}
if (num_active == 0)
break;
if (sleep_thread(common))
if (sleep_thread(common, true))
return;
}

Expand Down Expand Up @@ -2516,7 +2517,7 @@ static int fsg_main_thread(void *common_)
}

if (!common->running) {
sleep_thread(common);
sleep_thread(common, true);
continue;
}

Expand Down Expand Up @@ -3111,7 +3112,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
fsg->common->can_stall);
if (ret)
return ret;
fsg_common_set_inquiry_string(fsg->common, 0, 0);
fsg_common_set_inquiry_string(fsg->common, NULL, NULL);
ret = fsg_common_run_thread(fsg->common);
if (ret)
return ret;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/pxa25x_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
*/
#ifdef CONFIG_ARCH_PXA
#include <mach/pxa25x-udc.h>
#include <mach/hardware.h>
#endif

#ifdef CONFIG_ARCH_LUBBOCK
Expand Down
7 changes: 6 additions & 1 deletion drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
}

static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg);
static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg);

/**
* s3c_hsotg_process_control - process a control request
Expand Down Expand Up @@ -1221,6 +1222,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
switch (ctrl->bRequest) {
case USB_REQ_SET_ADDRESS:
s3c_hsotg_disconnect(hsotg);
dcfg = readl(hsotg->regs + DCFG);
dcfg &= ~DCFG_DevAddr_MASK;
dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT;
Expand All @@ -1245,7 +1247,9 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
/* as a fallback, try delivering it to the driver to deal with */

if (ret == 0 && hsotg->driver) {
spin_unlock(&hsotg->lock);
ret = hsotg->driver->setup(&hsotg->gadget, ctrl);
spin_lock(&hsotg->lock);
if (ret < 0)
dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret);
}
Expand Down Expand Up @@ -1308,10 +1312,12 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
return;
}

spin_lock(&hsotg->lock);
if (req->actual == 0)
s3c_hsotg_enqueue_setup(hsotg);
else
s3c_hsotg_process_control(hsotg, req->buf);
spin_unlock(&hsotg->lock);
}

/**
Expand Down Expand Up @@ -2533,7 +2539,6 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS);

call_gadget(hsotg, suspend);
s3c_hsotg_disconnect(hsotg);
}

if (gintsts & GINTSTS_WkUpInt) {
Expand Down
4 changes: 0 additions & 4 deletions drivers/usb/gadget/storage_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ static inline bool fsg_lun_is_open(struct fsg_lun *curlun)
return curlun->filp != NULL;
}

/* Big enough to hold our biggest descriptor */
#define EP0_BUFSIZE 256
#define DELAYED_STATUS (EP0_BUFSIZE + 999) /* An impossibly large value */

/* Default size of buffer length. */
#define FSG_BUFLEN ((u32)16384)

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/tcm_usb_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static int bot_prepare_reqs(struct f_uas *fu)
return -ENOMEM;
}

void bot_cleanup_old_alt(struct f_uas *fu)
static void bot_cleanup_old_alt(struct f_uas *fu)
{
if (!(fu->flags & USBG_ENABLED))
return;
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/gadget/zero.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ static struct usb_zero_options gzero_options = {
* functional coverage for the "USBCV" test harness from USB-IF.
* It's always set if OTG mode is enabled.
*/
unsigned autoresume = DEFAULT_AUTORESUME;
static unsigned autoresume = DEFAULT_AUTORESUME;
module_param(autoresume, uint, S_IRUGO);
MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup");

/* Maximum Autoresume time */
unsigned max_autoresume;
static unsigned max_autoresume;
module_param(max_autoresume, uint, S_IRUGO);
MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup");

/* Interval between two remote wakeups */
unsigned autoresume_interval_ms;
static unsigned autoresume_interval_ms;
module_param(autoresume_interval_ms, uint, S_IRUGO);
MODULE_PARM_DESC(autoresume_interval_ms,
"milliseconds to increase successive wakeup delays");
Expand Down
9 changes: 5 additions & 4 deletions drivers/usb/musb/musb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,6 @@ static void musb_free(struct musb *musb)
disable_irq_wake(musb->nIrq);
free_irq(musb->nIrq, musb);
}
cancel_work_sync(&musb->irq_work);

musb_host_free(musb);
}
Expand Down Expand Up @@ -1896,6 +1895,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb_platform_disable(musb);
musb_generic_disable(musb);

/* Init IRQ workqueue before request_irq */
INIT_WORK(&musb->irq_work, musb_irq_work);

/* setup musb parts of the core (especially endpoints) */
status = musb_core_init(plat->config->multipoint
? MUSB_CONTROLLER_MHDRC
Expand All @@ -1905,9 +1907,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)

setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb);

/* Init IRQ workqueue before request_irq */
INIT_WORK(&musb->irq_work, musb_irq_work);

/* attach to the IRQ */
if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
dev_err(dev, "request_irq %d failed!\n", nIrq);
Expand Down Expand Up @@ -1981,6 +1980,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb_host_cleanup(musb);

fail3:
cancel_work_sync(&musb->irq_work);
if (musb->dma_controller)
dma_controller_destroy(musb->dma_controller);
fail2_5:
Expand Down Expand Up @@ -2043,6 +2043,7 @@ static int musb_remove(struct platform_device *pdev)
if (musb->dma_controller)
dma_controller_destroy(musb->dma_controller);

cancel_work_sync(&musb->irq_work);
musb_free(musb);
device_init_wakeup(dev, 0);
return 0;
Expand Down
Loading

0 comments on commit c24cb6c

Please sign in to comment.