summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/em28xx/em28xx-audio.c
diff options
context:
space:
mode:
authorFrank Schaefer <fschaefer.oss@googlemail.com>2014-01-13 19:02:06 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-14 19:24:38 -0200
commit961717b41bc1103dcd30d293fd689a614fbfa90c (patch)
treefdff0e05b3a227f1454d6550de6607373b169311 /drivers/media/usb/em28xx/em28xx-audio.c
parent8068eb885a13e33244a8692c880eca478b467d9d (diff)
[media] em28xx: fix usb alternate setting for analog and digital video endpoints > 0
The current code assumes that the analog + digital video endpoints are always at interface number 0 when changing the alternate setting. This seems to work fine for most existing devices. However, at least the SpeedLink VAD Laplace webcam has the video endpoint on interface number 3 (which fortunately doesn't cause any trouble because ist uses bulk transfers only). We already consider the actual interface number for audio endpoints, so rename the the audio_ifnum variable and use it for all device types. Also get get rid of a pointless (ifnum < 0) in em28xx-audio. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-audio.c')
-rw-r--r--drivers/media/usb/em28xx/em28xx-audio.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 45bea1adc11..50c4ab49a27 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -266,7 +266,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
dprintk("opening device and trying to acquire exclusive lock\n");
runtime->hw = snd_em28xx_hw_capture;
- if ((dev->alt == 0 || dev->audio_ifnum) && dev->adev.users == 0) {
+ if ((dev->alt == 0 || dev->ifnum) && dev->adev.users == 0) {
int nonblock = !!(substream->f_flags & O_NONBLOCK);
if (nonblock) {
@@ -274,14 +274,14 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
return -EAGAIN;
} else
mutex_lock(&dev->lock);
- if (dev->audio_ifnum)
+ if (dev->ifnum)
dev->alt = 1;
else
dev->alt = 7;
dprintk("changing alternate number on interface %d to %d\n",
- dev->audio_ifnum, dev->alt);
- usb_set_interface(dev->udev, dev->audio_ifnum, dev->alt);
+ dev->ifnum, dev->alt);
+ usb_set_interface(dev->udev, dev->ifnum, dev->alt);
/* Sets volume, mute, etc */
dev->mute = 0;
@@ -733,16 +733,16 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
int urb_size, bytes_per_transfer;
u8 alt;
- if (dev->audio_ifnum)
+ if (dev->ifnum)
alt = 1;
else
alt = 7;
- intf = usb_ifnum_to_if(dev->udev, dev->audio_ifnum);
+ intf = usb_ifnum_to_if(dev->udev, dev->ifnum);
if (intf->num_altsetting <= alt) {
em28xx_errdev("alt %d doesn't exist on interface %d\n",
- dev->audio_ifnum, alt);
+ dev->ifnum, alt);
return -ENODEV;
}
@@ -766,7 +766,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
em28xx_info("Endpoint 0x%02x %s on intf %d alt %d interval = %d, size %d\n",
EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
- dev->audio_ifnum, alt,
+ dev->ifnum, alt,
interval,
ep_size);
@@ -877,7 +877,7 @@ static int em28xx_audio_init(struct em28xx *dev)
static int devnr;
int err;
- if (!dev->has_alsa_audio || dev->audio_ifnum < 0) {
+ if (!dev->has_alsa_audio) {
/* This device does not support the extension (in this case
the device is expecting the snd-usb-audio module or
doesn't have analog audio support at all) */