From: Hans Verkuil <hverkuil@xs4all.nl>
To: Hans Petter Selasky <hps@bitfrost.no>
Cc: linux-media@vger.kernel.org,
Hans Verkuil <hans.verkuil@cisco.com>,
Fabio Belavenuto <belavenuto@gmail.com>
Subject: Re: [BUG] [PATCH 10/21] radio-tea5764: some cleanups and clamp frequency when out-of-range AND [PATCH 15/21] tef6862: clamp frequency.
Date: Mon, 04 Nov 2013 10:15:21 +0100 [thread overview]
Message-ID: <527765A9.6030200@xs4all.nl> (raw)
In-Reply-To: <526E4E58.1020409@bitfrost.no>
Hi Hans,
On 10/28/2013 12:45 PM, Hans Petter Selasky wrote:
> On 05/31/13 12:02, Hans Verkuil wrote:
>> return -EINVAL;
>> + }
>> + clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
>> tea5764_power_up(radio);
>> - tea5764_tune(radio, (f->frequency * 125) / 2);
>> + tea5764_tune(radio, (freq * 125) / 2);
>> return 0;
>
> Hi Hans,
>
> Should the part quoted above part perhaps read:
>
> freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
>
> Or did "#define clamp() change" recently?
Nope, that's a bug. Thanks for spotting this!
I'll make a patch for this.
Regards,
Hans
>
> http://lxr.free-electrons.com/source/include/linux/kernel.h
>
>> 698 /**
>> 699 * clamp - return a value clamped to a given range with strict typechecking
>> 700 * @val: current value
>> 701 * @min: minimum allowable value
>> 702 * @max: maximum allowable value
>> 703 *
>> 704 * This macro does strict typechecking of min/max to make sure they are of the
>> 705 * same type as val. See the unnecessary pointer comparisons.
>> 706 */
>> 707 #define clamp(val, min, max) ({ \
>> 708 typeof(val) __val = (val); \
>> 709 typeof(min) __min = (min); \
>> 710 typeof(max) __max = (max); \
>> 711 (void) (&__val == &__min); \
>> 712 (void) (&__val == &__max); \
>> 713 __val = __val < __min ? __min: __val; \
>> 714 __val > __max ? __max: __val; })
>
> Thank you!
>
> Same spotted in:
>
>>> media_tree/drivers/media/radio/radio-tea5764.c: In function 'vidioc_s_frequency':
>>> media_tree/drivers/media/radio/radio-tea5764.c:359: warning: statement with no effect
>>
>>> media_tree/drivers/media/radio/tef6862.c: In function 'tef6862_s_frequency':
>>> media_tree/drivers/media/radio/tef6862.c:115: warning: statement with no effect
>
> Keep up the good work!
>
> --HPS
>
next prev parent reply other threads:[~2013-11-04 9:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-31 10:02 [PATCH 00/21] Control framework conversions Hans Verkuil
2013-05-31 10:02 ` [PATCH 01/21] saa7706h: convert to the control framework Hans Verkuil
2013-05-31 10:02 ` [PATCH 02/21] sr030pc30: " Hans Verkuil
2013-05-31 10:38 ` Sylwester Nawrocki
2013-05-31 10:02 ` [PATCH 03/21] saa6752hs: " Hans Verkuil
2013-05-31 10:02 ` [PATCH 04/21] radio-tea5764: add support for struct v4l2_device Hans Verkuil
2013-05-31 10:02 ` [PATCH 05/21] radio-tea5764: embed struct video_device Hans Verkuil
2013-05-31 10:02 ` [PATCH 06/21] radio-tea5764: convert to the control framework Hans Verkuil
2013-05-31 10:02 ` [PATCH 07/21] radio-tea5764: audio and input ioctls do not apply to radio devices Hans Verkuil
2013-05-31 10:02 ` [PATCH 08/21] radio-tea5764: add device_caps support Hans Verkuil
2013-05-31 10:02 ` [PATCH 09/21] radio-tea5764: add prio and control event support Hans Verkuil
2013-05-31 10:02 ` [PATCH 10/21] radio-tea5764: some cleanups and clamp frequency when out-of-range Hans Verkuil
2013-10-28 11:45 ` [BUG] [PATCH 10/21] radio-tea5764: some cleanups and clamp frequency when out-of-range AND [PATCH 15/21] tef6862: clamp frequency Hans Petter Selasky
2013-11-04 9:15 ` Hans Verkuil [this message]
2013-05-31 10:02 ` [PATCH 11/21] radio-timb: add device_caps support, remove input/audio ioctls Hans Verkuil
2013-05-31 10:02 ` [PATCH 12/21] radio-timb: convert to the control framework Hans Verkuil
2013-05-31 10:02 ` [PATCH 13/21] radio-timb: actually load the requested subdevs Hans Verkuil
2013-05-31 10:02 ` [PATCH 14/21] radio-timb: add control events and prio support Hans Verkuil
2013-05-31 10:02 ` [PATCH 15/21] tef6862: clamp frequency Hans Verkuil
2013-05-31 10:02 ` [PATCH 16/21] timblogiw: fix querycap Hans Verkuil
2013-05-31 10:02 ` [PATCH 17/21] radio-sf16fmi: remove audio/input ioctls Hans Verkuil
2013-05-31 10:02 ` [PATCH 18/21] radio-sf16fmi: add device_caps support to querycap Hans Verkuil
2013-05-31 10:02 ` [PATCH 19/21] radio-sf16fmi: clamp frequency Hans Verkuil
2013-05-31 10:02 ` [PATCH 20/21] radio-sf16fmi: convert to the control framework Hans Verkuil
2013-05-31 10:02 ` [PATCH 21/21] radio-sf16fmi: add control event and prio support Hans Verkuil
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=527765A9.6030200@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=belavenuto@gmail.com \
--cc=hans.verkuil@cisco.com \
--cc=hps@bitfrost.no \
--cc=linux-media@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.