From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Scott Jiang <scott.jiang.linux@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Andy Walls <awalls@md.metrocast.net>,
Prabhakar Lad <prabhakar.csengg@gmail.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Tomasz Stanislawski <t.stanislaws@samsung.com>,
Alexey Klimov <klimov.linux@gmail.com>,
Hans de Goede <hdegoede@redhat.com>,
Brian Johnson <brijohn@gmail.com>, Mike Isely <isely@pobox.com>,
Ezequiel Garcia <elezegarcia@gmail.com>,
Huang Shijie <shijie8@gmail.com>,
Ismael Luceno <ismael.luceno@corp.bluecherry.net>,
Takashi Iwai <tiwai@suse.de>,
Ondrej Zary <linux@rainbow-software.org>,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [REVIEWv2 PATCH 1/6] v4l2: add const to argument of write-only s_frequency ioctl.
Date: Tue, 19 Mar 2013 00:17:32 +0100 [thread overview]
Message-ID: <38963986.sdyc1budE1@avalon> (raw)
In-Reply-To: <1363615925-19507-2-git-send-email-hverkuil@xs4all.nl>
Hi Hans,
Thanks for the patch.
On Monday 18 March 2013 15:12:00 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> This ioctl is defined as IOW, so pass the argument as const.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
[snip]
> diff --git a/drivers/media/radio/radio-keene.c
> b/drivers/media/radio/radio-keene.c index 296941a..a598852 100644
> --- a/drivers/media/radio/radio-keene.c
> +++ b/drivers/media/radio/radio-keene.c
> @@ -82,9 +82,12 @@ static inline struct keene_device *to_keene_dev(struct
> v4l2_device *v4l2_dev) /* Set frequency (if non-0), PA, mute and turn
> on/off the FM transmitter. */ static int keene_cmd_main(struct keene_device
> *radio, unsigned freq, bool play) {
> - unsigned short freq_send = freq ? (freq - 76 * 16000) / 800 : 0;
> + unsigned short freq_send;
> int ret;
>
> + if (freq)
> + freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
> + freq_send = freq ? (freq - 76 * 16000) / 800 : 0;
> radio->buffer[0] = 0x00;
> radio->buffer[1] = 0x50;
> radio->buffer[2] = (freq_send >> 8) & 0xff;
> @@ -215,15 +218,15 @@ static int vidioc_s_modulator(struct file *file, void
> *priv, }
>
> static int vidioc_s_frequency(struct file *file, void *priv,
> - struct v4l2_frequency *f)
> + const struct v4l2_frequency *f)
> {
> struct keene_device *radio = video_drvdata(file);
>
> if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
> return -EINVAL;
> - f->frequency = clamp(f->frequency,
> - FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
> - return keene_cmd_main(radio, f->frequency, true);
> + /* Take care: keene_cmd_main handles a frequency of 0 as a
> + * special case, so make sure we never give that from here. */
> + return keene_cmd_main(radio, f->frequency ? f->frequency : 1, true);
Can't you keep the clamp() here ? That looks easier.
> }
>
> static int vidioc_g_frequency(struct file *file, void *priv,
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-03-18 23:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 14:11 [REVIEWv2 PATCH 0/6] v4l2: constify _IOW ioctls Hans Verkuil
2013-03-18 14:12 ` [REVIEWv2 PATCH 1/6] v4l2: add const to argument of write-only s_frequency ioctl Hans Verkuil
2013-03-18 23:17 ` Laurent Pinchart [this message]
2013-03-19 7:12 ` Hans Verkuil
2013-03-18 14:12 ` [REVIEWv2 PATCH 2/6] v4l2: add const to argument of write-only s_tuner ioctl Hans Verkuil
2013-03-18 14:12 ` [REVIEWv2 PATCH 3/6] v4l2: pass std by value to the write-only s_std ioctl Hans Verkuil
2013-03-18 14:12 ` [REVIEWv2 PATCH 4/6] v4l2: add const to argument of write-only s_register ioctl Hans Verkuil
2013-03-18 23:20 ` Laurent Pinchart
2013-03-19 7:07 ` Hans Verkuil
2013-03-24 10:07 ` Mauro Carvalho Chehab
2013-03-24 10:12 ` Hans Verkuil
2013-03-18 14:12 ` [REVIEWv2 PATCH 5/6] v4l2-ioctl: simplify debug code Hans Verkuil
2013-03-24 10:12 ` Mauro Carvalho Chehab
2013-03-18 14:12 ` [REVIEWv2 PATCH 6/6] v4l2-ioctl: add precision when printing names 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=38963986.sdyc1budE1@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=awalls@md.metrocast.net \
--cc=brijohn@gmail.com \
--cc=corbet@lwn.net \
--cc=elezegarcia@gmail.com \
--cc=g.liakhovetski@gmx.de \
--cc=hans.verkuil@cisco.com \
--cc=hdegoede@redhat.com \
--cc=hverkuil@xs4all.nl \
--cc=isely@pobox.com \
--cc=ismael.luceno@corp.bluecherry.net \
--cc=klimov.linux@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=linux@rainbow-software.org \
--cc=mchehab@redhat.com \
--cc=prabhakar.csengg@gmail.com \
--cc=scott.jiang.linux@gmail.com \
--cc=shijie8@gmail.com \
--cc=t.stanislaws@samsung.com \
--cc=tiwai@suse.de \
/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.