From: Julia Lawall <julia.lawall@lip6.fr>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: mchehab@infradead.org, linux-media@vger.kernel.org, joe@perches.com
Subject: Re: question about bt8xx/bttv-audio-hook.c, tvaudio.c
Date: Sun, 10 Jun 2012 12:55:30 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.2.02.1206101255080.1806@hadrien> (raw)
In-Reply-To: <201206091005.16782.hverkuil@xs4all.nl>
On Sat, 9 Jun 2012, Hans Verkuil wrote:
> On Wed June 6 2012 09:06:23 Julia Lawall wrote:
>> The files drivers/media/video/bt8xx/bttv-audio-hook.c and
>> drivers/media/video/tvaudio.c contain a number of occurrences of eg:
>>
>> mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
>>
>> and
>>
>> if (mode & V4L2_TUNER_MODE_MONO)
>>
>> (both from tvaudio.c)
>>
>> V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2 is suspicious because
>> V4L2_TUNER_MODE_LANG1 is 3 and V4L2_TUNER_MODE_LANG2 is 2, so the result
>> is just the same as V4L2_TUNER_MODE_LANG1. Maybe
>> V4L2_TUNER_MODE_LANG1_LANG2 was intended?
>>
>> mode & V4L2_TUNER_MODE_MONO is suspicious because V4L2_TUNER_MODE_MONO is
>> 0. Maybe & should be ==?
>>
>> If & is to be changed to == everywhere, then some new code may need to be
>> constructed to account for V4L2_TUNER_MODE_LANG1_LANG2. For example, the
>> function tda8425_setmode has ifs for the other values, but not for this
>> one. On the other hand, the function ta8874z_setmode already uses == (or
>> rather switch), and does not take V4L2_TUNER_MODE_LANG1_LANG2 into
>> account, so perhaps it is not appropriate in this context?
>
> I would have to analyse this more carefully, but the core issue here is that
> these drivers mixup the tuner audio reception bitmask flags (V4L2_TUNER_SUB_*)
> and the tuner audio modes (V4L2_TUNER_MODE_*, not a bitmask). This happened
> regularly in older drivers, and apparently these two are still not fixed.
>
> More info is here:
>
> http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-tuner
>
> I can't just replace one define with another, I would need to look carefully
> at the code to see what was intended.
>
> If you find more places where this happens, then please let us know. Otherwise
> this is something for us to fix.
No, I explicitly looked, but only found the problem in these two files.
julia
prev parent reply other threads:[~2012-06-10 16:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 7:06 question about bt8xx/bttv-audio-hook.c, tvaudio.c Julia Lawall
2012-06-09 8:05 ` Hans Verkuil
2012-06-09 21:41 ` Daniel Glöckner
2012-06-10 1:43 ` Some tvaudio fixes Daniel Glöckner
2012-06-10 6:28 ` Hans Verkuil
2012-06-17 11:53 ` [PATCH] tvaudio: rename getmode and setmode Daniel Glöckner
2012-06-17 12:08 ` Hans Verkuil
2012-06-10 1:43 ` [PATCH 1/9] tvaudio: fix TDA9873 constants Daniel Glöckner
2012-06-10 1:43 ` [PATCH 2/9] tvaudio: fix tda8425_setmode Daniel Glöckner
2012-06-10 1:43 ` [PATCH 3/9] tvaudio: use V4L2_TUNER_MODE_SAP for TDA985x SAP Daniel Glöckner
2012-06-10 1:43 ` [PATCH 4/9] tvaudio: remove watch_stereo Daniel Glöckner
2012-06-10 1:43 ` [PATCH 5/9] tvaudio: don't use thread for TA8874Z Daniel Glöckner
2012-06-10 1:43 ` [PATCH 6/9] tvaudio: use V4L2_TUNER_SUB_* for bitfields Daniel Glöckner
2012-06-10 1:43 ` [PATCH 7/9] tvaudio: obey V4L2 tuner audio matrix Daniel Glöckner
2012-06-10 1:43 ` [PATCH 8/9] tvaudio: support V4L2_TUNER_MODE_LANG1_LANG2 Daniel Glöckner
2012-06-10 1:43 ` [PATCH 9/9] tvaudio: don't report mono when stereo is received Daniel Glöckner
2012-06-10 16:55 ` Julia Lawall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1206101255080.1806@hadrien \
--to=julia.lawall@lip6.fr \
--cc=hverkuil@xs4all.nl \
--cc=joe@perches.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox