Skip to content

Commit

Permalink
Merge tag 'fixes-for-v4.2-rc5' 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 v4.2-rc5

BCD driver now reads correct register to fetch HW
dequeue pointer address.

f_uac2 got a fix for bInterval calculation.

Both f_hid and f_printer can now correctly limit number
of instances when used through configfs.

Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Greg Kroah-Hartman committed Jul 27, 2015
2 parents a14aad0 + 4248bd7 commit 84b6b02
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/gadget/function/f_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ static inline int hidg_get_minor(void)
int ret;

ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL);
if (ret >= HIDG_MINORS) {
ida_simple_remove(&hidg_ida, ret);
ret = -ENODEV;
}

return ret;
}
Expand Down
10 changes: 9 additions & 1 deletion drivers/usb/gadget/function/f_printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,15 @@ static struct config_item_type printer_func_type = {

static inline int gprinter_get_minor(void)
{
return ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL);
int ret;

ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL);
if (ret >= PRINTER_MINORS) {
ida_simple_remove(&printer_ida, ret);
ret = -ENODEV;
}

return ret;
}

static inline void gprinter_put_minor(int minor)
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/gadget/function/f_uac2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,14 +1162,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
factor = 1000;
} else {
ep_desc = &hs_epin_desc;
factor = 125;
factor = 8000;
}

/* pre-compute some values for iso_complete() */
uac2->p_framesize = opts->p_ssize *
num_channels(opts->p_chmask);
rate = opts->p_srate * uac2->p_framesize;
uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor;
uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1));
uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval,
prm->max_psize);

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/udc/bdc/bdc_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req)
/* The current hw dequeue pointer */
tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0));
deq_ptr_64 = tmp_32;
tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(1));
tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS1(0));
deq_ptr_64 |= ((u64)tmp_32 << 32);

/* we have the dma addr of next bd that will be fetched by hardware */
Expand Down

0 comments on commit 84b6b02

Please sign in to comment.