diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2014-09-13 10:52:21 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-23 21:13:42 +0200 |
commit | 920f1e4a528a1db01d6822026f653659ecb4983d (patch) | |
tree | f2b0d8260412cab4d463b3fffad853c29eaa86b3 /drivers/media/usb/em28xx/em28xx-video.c | |
parent | [media] em28xx: simplify usb audio class handling (diff) | |
download | linux-920f1e4a528a1db01d6822026f653659ecb4983d.tar.xz linux-920f1e4a528a1db01d6822026f653659ecb4983d.zip |
[media] em28xx: get rid of field has_audio in struct em28xx_audio_mode
Field has_audio in struct em28xx_audio_mode is used together with value
EM28XX_NO_AC97 of field ac97 to determine the internal type of audio
(none/i2s/ac97). This makes the code difficult to understand:
!audio_mode.has_audio && audio_mode.ac97 == EM28XX_NO_AC97 => no audio
!audio_mode.has_audio && audio_mode.ac97 != EM28XX_NO_AC97 => BUG
audio_mode.has_audio && audio_mode.ac97 == EM28XX_NO_AC97 => AC97 audio
audio_mode.has_audio && audio_mode.ac97 != EM28XX_NO_AC97 => I2S audio
Simplify the whole thing by introducing an enum em28xx_int_audio_type
which describes the internal audio type (none, ac97, i2s) and is hooked
directly to the device struct. Then get rid of field has_audio in struct
em28xx_audio_mode.
A follow-up patch will then remove struct em28xx_ac97_mode and finally
the whole struct em28xx_audio_mode.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-video.c')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-video.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 3642438bc7d4..3284de99fc99 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1720,7 +1720,7 @@ static int vidioc_querycap(struct file *file, void *priv, else cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE; - if (dev->audio_mode.has_audio) + if (dev->int_audio_type != EM28XX_INT_AUDIO_NONE) cap->device_caps |= V4L2_CAP_AUDIO; if (dev->tuner_type != TUNER_ABSENT) @@ -2514,7 +2514,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) v4l2_disable_ioctl(v4l2->vdev, VIDIOC_G_FREQUENCY); v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_FREQUENCY); } - if (!dev->audio_mode.has_audio) { + if (dev->int_audio_type == EM28XX_INT_AUDIO_NONE) { v4l2_disable_ioctl(v4l2->vdev, VIDIOC_G_AUDIO); v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_AUDIO); } @@ -2544,7 +2544,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_G_FREQUENCY); v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_S_FREQUENCY); } - if (!dev->audio_mode.has_audio) { + if (dev->int_audio_type == EM28XX_INT_AUDIO_NONE) { v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_G_AUDIO); v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_S_AUDIO); } |