diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-12-30 08:20:50 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-06 09:01:18 -0200 |
commit | d0d3435b212f88aebee6a06e002e4fd3b487a918 (patch) | |
tree | 398fd278fa4787dd4bde55dff221cf2d819106ae /drivers/media/video/gspca/gspca.c | |
parent | 66957b864646e2ea0aebc66d1173f39a63509a19 (diff) | |
download | op-kernel-dev-d0d3435b212f88aebee6a06e002e4fd3b487a918.zip op-kernel-dev-d0d3435b212f88aebee6a06e002e4fd3b487a918.tar.gz |
[media] gspca - main: Correct use of interval in bandwidth calculation
The calculated bandwidth should not be multiplied by the interval, but be
divided by it. Also bInterbval should be interpreted as a power of 2
for isochronous endpoints.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 5b8f4fc..a82d45e 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -698,12 +698,17 @@ static int build_isoc_ep_tb(struct gspca_dev *gspca_dev, USB_ENDPOINT_XFER_ISOC); if (ep == NULL) continue; + if (ep->desc.bInterval == 0) { + pr_err("alt %d iso endp with 0 interval\n", j); + continue; + } psize = le16_to_cpu(ep->desc.wMaxPacketSize); psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3)); - bandwidth = psize * ep->desc.bInterval * 1000; + bandwidth = psize * 1000; if (gspca_dev->dev->speed == USB_SPEED_HIGH || gspca_dev->dev->speed == USB_SPEED_SUPER) bandwidth *= 8; + bandwidth /= 1 << (ep->desc.bInterval - 1); if (bandwidth <= last_bw) continue; if (bandwidth < ep_tb->bandwidth) { |