[media] v4l2: make vidioc_s_freq_hw_seek const
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 14 Sep 2012 10:41:18 +0000 (07:41 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 26 Sep 2012 13:47:28 +0000 (10:47 -0300)
Write-only ioctls should have a const argument in the ioctl op.
Do this conversion for vidioc_s_freq_hw_seek.
Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/radio/radio-mr800.c
drivers/media/radio/radio-tea5777.c
drivers/media/radio/radio-wl1273.c
drivers/media/radio/si470x/radio-si470x-common.c
drivers/media/radio/wl128x/fmdrv_v4l2.c
include/media/v4l2-ioctl.h
sound/i2c/other/tea575x-tuner.c

index 3182b26d6efa8f99cb50fdc7d81d5b9681782ab9..720bf0da599cece60a2d36e80b7c393efb36a45b 100644 (file)
@@ -348,7 +348,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_hw_freq_seek(struct file *file, void *priv,
-               struct v4l2_hw_freq_seek *seek)
+               const struct v4l2_hw_freq_seek *seek)
 {
        static u8 buf[8] = {
                0x3d, 0x32, 0x0f, 0x08, 0x3d, 0x32, 0x0f, 0x08
index ef8289829794243744a02a4e189ddc77b84d1ecc..c1a2ea6e87a3fd48270b3ffc8a9145fd22a4e303 100644 (file)
@@ -385,59 +385,61 @@ static int vidioc_s_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
-                                       struct v4l2_hw_freq_seek *a)
+                                       const struct v4l2_hw_freq_seek *a)
 {
        struct radio_tea5777 *tea = video_drvdata(file);
        unsigned long timeout;
+       u32 rangelow = a->rangelow;
+       u32 rangehigh = a->rangehigh;
        int i, res, spacing;
        u32 orig_freq;
 
        if (a->tuner || a->wrap_around)
                return -EINVAL;
 
-       if (a->rangelow || a->rangehigh) {
+       if (rangelow || rangehigh) {
                for (i = 0; i < ARRAY_SIZE(bands); i++) {
                        if (i == BAND_AM && !tea->has_am)
                                continue;
-                       if (bands[i].rangelow  >= a->rangelow &&
-                           bands[i].rangehigh <= a->rangehigh)
+                       if (bands[i].rangelow  >= rangelow &&
+                           bands[i].rangehigh <= rangehigh)
                                break;
                }
                if (i == ARRAY_SIZE(bands))
                        return -EINVAL; /* No matching band found */
 
                tea->band = i;
-               if (tea->freq < a->rangelow || tea->freq > a->rangehigh) {
-                       tea->freq = clamp(tea->freq, a->rangelow,
-                                                    a->rangehigh);
+               if (tea->freq < rangelow || tea->freq > rangehigh) {
+                       tea->freq = clamp(tea->freq, rangelow,
+                                                    rangehigh);
                        res = radio_tea5777_set_freq(tea);
                        if (res)
                                return res;
                }
        } else {
-               a->rangelow  = bands[tea->band].rangelow;
-               a->rangehigh = bands[tea->band].rangehigh;
+               rangelow  = bands[tea->band].rangelow;
+               rangehigh = bands[tea->band].rangehigh;
        }
 
        spacing   = (tea->band == BAND_AM) ? (5 * 16) : (200 * 16); /* kHz */
        orig_freq = tea->freq;
 
        tea->write_reg |= TEA5777_W_PROGBLIM_MASK;
-       if (tea->seek_rangelow != a->rangelow) {
+       if (tea->seek_rangelow != rangelow) {
                tea->write_reg &= ~TEA5777_W_UPDWN_MASK;
-               tea->freq = a->rangelow;
+               tea->freq = rangelow;
                res = radio_tea5777_set_freq(tea);
                if (res)
                        goto leave;
-               tea->seek_rangelow = a->rangelow;
+               tea->seek_rangelow = rangelow;
        }
-       if (tea->seek_rangehigh != a->rangehigh) {
+       if (tea->seek_rangehigh != rangehigh) {
                tea->write_reg |= TEA5777_W_UPDWN_MASK;
-               tea->freq = a->rangehigh;
+               tea->freq = rangehigh;
                res = radio_tea5777_set_freq(tea);
                if (res)
                        goto leave;
-               tea->seek_rangehigh = a->rangehigh;
+               tea->seek_rangehigh = rangehigh;
        }
        tea->write_reg &= ~TEA5777_W_PROGBLIM_MASK;
 
index a22ad1c1f3d57bf6290679ad7fd4893d836fba31..71968a61073466fbdc5953ae9c96e4283905b5a3 100644 (file)
@@ -1682,7 +1682,7 @@ static int wl1273_fm_vidioc_s_frequency(struct file *file, void *priv,
 #define WL1273_DEFAULT_SEEK_LEVEL      7
 
 static int wl1273_fm_vidioc_s_hw_freq_seek(struct file *file, void *priv,
-                                          struct v4l2_hw_freq_seek *seek)
+                                          const struct v4l2_hw_freq_seek *seek)
 {
        struct wl1273_device *radio = video_get_drvdata(video_devdata(file));
        struct wl1273_core *core = radio->core;
index 9bb65e170d99bd87455107083379931c6bda40a6..74a5c901471fb07e9355aa3371f0fd5389c372a0 100644 (file)
@@ -296,7 +296,7 @@ int si470x_set_freq(struct si470x_device *radio, unsigned int freq)
  * si470x_set_seek - set seek
  */
 static int si470x_set_seek(struct si470x_device *radio,
-                          struct v4l2_hw_freq_seek *seek)
+                          const struct v4l2_hw_freq_seek *seek)
 {
        int band, retval;
        unsigned int freq;
@@ -701,7 +701,7 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv,
  * si470x_vidioc_s_hw_freq_seek - set hardware frequency seek
  */
 static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
-               struct v4l2_hw_freq_seek *seek)
+               const struct v4l2_hw_freq_seek *seek)
 {
        struct si470x_device *radio = video_drvdata(file);
 
index db2248ee9498b54940dce319c378e29f6a42071b..f816ea68e46964580f1dc23fd5d047771bc84dc7 100644 (file)
@@ -403,7 +403,7 @@ static int fm_v4l2_vidioc_s_freq(struct file *file, void *priv,
 
 /* Set hardware frequency seek. If current mode is NOT RX, set it RX. */
 static int fm_v4l2_vidioc_s_hw_freq_seek(struct file *file, void *priv,
-               struct v4l2_hw_freq_seek *seek)
+               const struct v4l2_hw_freq_seek *seek)
 {
        struct fmdev *fmdev = video_drvdata(file);
        int ret;
index 21f624586d56e9bf5e201634e29c45a6b97cc0bc..865f95d92ba8fac15cb11bdce4456bcce39030aa 100644 (file)
@@ -233,7 +233,7 @@ struct v4l2_ioctl_ops {
        int (*vidioc_log_status)       (struct file *file, void *fh);
 
        int (*vidioc_s_hw_freq_seek)   (struct file *file, void *fh,
-                                       struct v4l2_hw_freq_seek *a);
+                                       const struct v4l2_hw_freq_seek *a);
 
        /* Debugging ioctls */
 #ifdef CONFIG_VIDEO_ADV_DEBUG
index cd79ed590f9a3039bffed330017b11226b5d7964..4a8fad674f02904dd30e943af1a5ab594cdaca19 100644 (file)
@@ -357,7 +357,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
-                                       struct v4l2_hw_freq_seek *a)
+                                       const struct v4l2_hw_freq_seek *a)
 {
        struct snd_tea575x *tea = video_drvdata(file);
        unsigned long timeout;