[media] v4l2: add const to argument of write-only s_frequency ioctl
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 19 Mar 2013 07:09:26 +0000 (04:09 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 24 Mar 2013 09:25:34 +0000 (06:25 -0300)
This ioctl is defined as IOW, so pass the argument as const.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
56 files changed:
drivers/media/i2c/cx25840/cx25840-core.c
drivers/media/i2c/msp3400-driver.c
drivers/media/i2c/tvaudio.c
drivers/media/i2c/upd64031a.c
drivers/media/i2c/wm8775.c
drivers/media/pci/bt8xx/bttv-driver.c
drivers/media/pci/cx18/cx18-av-core.c
drivers/media/pci/cx18/cx18-ioctl.c
drivers/media/pci/cx18/cx18-ioctl.h
drivers/media/pci/cx23885/cx23885-417.c
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/cx23885/cx23885.h
drivers/media/pci/cx25821/cx25821-video.c
drivers/media/pci/cx25821/cx25821-video.h
drivers/media/pci/cx88/cx88-blackbird.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/pci/cx88/cx88.h
drivers/media/pci/ivtv/ivtv-ioctl.c
drivers/media/pci/ivtv/ivtv-ioctl.h
drivers/media/pci/saa7134/saa7134-video.c
drivers/media/pci/saa7146/mxb.c
drivers/media/pci/saa7164/saa7164-encoder.c
drivers/media/pci/saa7164/saa7164-vbi.c
drivers/media/pci/ttpci/av7110_v4l.c
drivers/media/radio/dsbr100.c
drivers/media/radio/radio-cadet.c
drivers/media/radio/radio-isa.c
drivers/media/radio/radio-keene.c
drivers/media/radio/radio-ma901.c
drivers/media/radio/radio-miropcm20.c
drivers/media/radio/radio-mr800.c
drivers/media/radio/radio-sf16fmi.c
drivers/media/radio/radio-si4713.c
drivers/media/radio/radio-tea5764.c
drivers/media/radio/radio-tea5777.c
drivers/media/radio/radio-timb.c
drivers/media/radio/radio-wl1273.c
drivers/media/radio/si470x/radio-si470x-common.c
drivers/media/radio/si4713-i2c.c
drivers/media/radio/tef6862.c
drivers/media/radio/wl128x/fmdrv_v4l2.c
drivers/media/usb/au0828/au0828-video.c
drivers/media/usb/cx231xx/cx231xx-video.c
drivers/media/usb/cx231xx/cx231xx.h
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
drivers/media/usb/tlg2300/pd-radio.c
drivers/media/usb/tlg2300/pd-video.c
drivers/media/usb/tm6000/tm6000-video.c
drivers/media/usb/usbvision/usbvision-video.c
drivers/media/v4l2-core/tuner-core.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/staging/media/go7007/go7007-v4l2.c
include/media/v4l2-ioctl.h
include/media/v4l2-subdev.h
sound/i2c/other/tea575x-tuner.c

index f4149eb4d7b4f545e647321f79344786d743a17a..f4339ed8f2e5b035df5834ef8b691d8d833eccbd 100644 (file)
@@ -1835,7 +1835,7 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
        return set_input(client, state->vid_input, input);
 }
 
-static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
+static int cx25840_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
 
index 766305f69a2899264d3819e8ebbda7e165d488af..77053ba09627ac7979358b193c1d3c96cdb52807 100644 (file)
@@ -445,7 +445,7 @@ static int msp_s_radio(struct v4l2_subdev *sd)
        return 0;
 }
 
-static int msp_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
+static int msp_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
 
index 4c91b355b55a1e8f9989ccc7d19fb1939ef5b665..4b12c51880750224d5bcd9251577e6f9a07a9772 100644 (file)
@@ -1817,7 +1817,7 @@ static int tvaudio_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
        return 0;
 }
 
-static int tvaudio_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
+static int tvaudio_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq)
 {
        struct CHIPSTATE *chip = to_state(sd);
        struct CHIPDESC *desc = chip->desc;
index 1e7446542091fac877cc52480eb17299aa8de8f5..d15cfd944e57a12d82aef09a43c465bb54b13ef9 100644 (file)
@@ -111,7 +111,7 @@ static void upd64031a_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 /* ------------------------------------------------------------------------ */
 
 /* The input changed due to new input or channel changed */
-static int upd64031a_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
+static int upd64031a_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq)
 {
        struct upd64031a_state *state = to_state(sd);
        u8 reg = state->regs[R00];
index bee77ea9f49efeab3250f44519760dfc8726a4e7..27c27b4ae238516b89f49da8627b1fbd0568985d 100644 (file)
@@ -174,7 +174,7 @@ static int wm8775_log_status(struct v4l2_subdev *sd)
        return 0;
 }
 
-static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
+static int wm8775_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq)
 {
        wm8775_set_audio(sd, 0);
        return 0;
index 2fb2168f74e29904e53193ca7c8e760ebcdf1507..3156daf2c80400784f2999279579b219fed72131 100644 (file)
@@ -1852,24 +1852,26 @@ static int bttv_g_frequency(struct file *file, void *priv,
        return 0;
 }
 
-static void bttv_set_frequency(struct bttv *btv, struct v4l2_frequency *f)
+static void bttv_set_frequency(struct bttv *btv, const struct v4l2_frequency *f)
 {
+       struct v4l2_frequency new_freq = *f;
+
        bttv_call_all(btv, tuner, s_frequency, f);
        /* s_frequency may clamp the frequency, so get the actual
           frequency before assigning radio/tv_freq. */
-       bttv_call_all(btv, tuner, g_frequency, f);
-       if (f->type == V4L2_TUNER_RADIO) {
+       bttv_call_all(btv, tuner, g_frequency, &new_freq);
+       if (new_freq.type == V4L2_TUNER_RADIO) {
                radio_enable(btv);
-               btv->radio_freq = f->frequency;
+               btv->radio_freq = new_freq.frequency;
                if (btv->has_matchbox)
                        tea5757_set_freq(btv, btv->radio_freq);
        } else {
-               btv->tv_freq = f->frequency;
+               btv->tv_freq = new_freq.frequency;
        }
 }
 
 static int bttv_s_frequency(struct file *file, void *priv,
-                                       struct v4l2_frequency *f)
+                                       const struct v4l2_frequency *f)
 {
        struct bttv_fh *fh  = priv;
        struct bttv *btv = fh->btv;
index f164b7f610a50320d1c11bcad00e0473efd02811..a2c51e0468a8fd7aa19db634e9e965e8c0c5042b 100644 (file)
@@ -576,7 +576,7 @@ static void input_change(struct cx18 *cx)
 }
 
 static int cx18_av_s_frequency(struct v4l2_subdev *sd,
-                              struct v4l2_frequency *freq)
+                              const struct v4l2_frequency *freq)
 {
        struct cx18 *cx = v4l2_get_subdevdata(sd);
        input_change(cx);
index cd8d2c2b16246e667e8e78053558cd7c30f6261d..5cd22e7095e6635439772efa2e709b95e01198af 100644 (file)
@@ -614,7 +614,7 @@ static int cx18_g_frequency(struct file *file, void *fh,
        return 0;
 }
 
-int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
+int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf)
 {
        struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
index 2f9dd591ee0f9421d95610756b91b43fbb419674..aa9b44a611d3692b0b72e27fe1a87a3dd0aeb2f3 100644 (file)
@@ -27,5 +27,5 @@ void cx18_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal);
 u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt);
 void cx18_set_funcs(struct video_device *vdev);
 int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std);
-int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf);
+int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf);
 int cx18_s_input(struct file *file, void *fh, unsigned int inp);
index 5d5052d0253f00808d5960d46b388b20b6c0bf98..84a1b75d544423155ff1ae2c6c7a8b1c33d7a4f5 100644 (file)
@@ -1311,7 +1311,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_frequency(struct file *file, void *priv,
-       struct v4l2_frequency *f)
+       const struct v4l2_frequency *f)
 {
        return cx23885_set_frequency(file, priv, f);
 }
index 5991bc8dc158bdb70dd5de2236ba05d68f1427d4..5ba15b8dafe036d5f55f84411a01844af40aad97 100644 (file)
@@ -1518,7 +1518,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
        return 0;
 }
 
-static int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f)
+static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency *f)
 {
        struct v4l2_control ctrl;
 
@@ -1550,7 +1550,7 @@ static int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f)
 }
 
 static int cx23885_set_freq_via_ops(struct cx23885_dev *dev,
-       struct v4l2_frequency *f)
+       const struct v4l2_frequency *f)
 {
        struct v4l2_control ctrl;
        struct videobuf_dvb_frontend *vfe;
@@ -1608,7 +1608,7 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev,
 }
 
 int cx23885_set_frequency(struct file *file, void *priv,
-       struct v4l2_frequency *f)
+       const struct v4l2_frequency *f)
 {
        struct cx23885_fh *fh = priv;
        struct cx23885_dev *dev = fh->dev;
@@ -1628,7 +1628,7 @@ int cx23885_set_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_frequency(struct file *file, void *priv,
-       struct v4l2_frequency *f)
+       const struct v4l2_frequency *f)
 {
        return cx23885_set_frequency(file, priv, f);
 }
index 59c322d870f2e8216463d0063843c24d74e930ce..5687d3f678db7aee570b56790f91b2c348f297ea 100644 (file)
@@ -587,7 +587,7 @@ extern void cx23885_video_wakeup(struct cx23885_dev *dev,
 int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i);
 int cx23885_set_input(struct file *file, void *priv, unsigned int i);
 int cx23885_get_input(struct file *file, void *priv, unsigned int *i);
-int cx23885_set_frequency(struct file *file, void *priv, struct v4l2_frequency *f);
+int cx23885_set_frequency(struct file *file, void *priv, const struct v4l2_frequency *f);
 int cx23885_set_control(struct cx23885_dev *dev, struct v4l2_control *ctl);
 int cx23885_get_control(struct cx23885_dev *dev, struct v4l2_control *ctl);
 int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm);
index d4de021dc844e88776f67e7b08018cf9ab11b394..1219d60cdd790ddf9a56a126634174d29ed2b081 100644 (file)
@@ -1312,7 +1312,7 @@ int cx25821_vidioc_g_frequency(struct file *file, void *priv,
        return 0;
 }
 
-int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f)
+int cx25821_set_freq(struct cx25821_dev *dev, const struct v4l2_frequency *f)
 {
        mutex_lock(&dev->lock);
        dev->freq = f->frequency;
@@ -1328,7 +1328,7 @@ int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f)
 }
 
 int cx25821_vidioc_s_frequency(struct file *file, void *priv,
-                              struct v4l2_frequency *f)
+                              const struct v4l2_frequency *f)
 {
        struct cx25821_fh *fh = priv;
        struct cx25821_dev *dev;
index c265e35b37c3e54a9ddbe0b57f0fb31e3fda8d89..969340c2dcfa7c0a9fc45539287988a4e8cfe923 100644 (file)
@@ -149,9 +149,9 @@ extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
                                        struct v4l2_format *f);
 extern int cx25821_vidioc_g_frequency(struct file *file, void *priv,
                                      struct v4l2_frequency *f);
-extern int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f);
+extern int cx25821_set_freq(struct cx25821_dev *dev, const struct v4l2_frequency *f);
 extern int cx25821_vidioc_s_frequency(struct file *file, void *priv,
-                                     struct v4l2_frequency *f);
+                                     const struct v4l2_frequency *f);
 extern int cx25821_vidioc_g_register(struct file *file, void *fh,
                                     struct v4l2_dbg_register *reg);
 extern int cx25821_vidioc_s_register(struct file *file, void *fh,
index a6ff8a6f4fc09f90e1ffce5027839e575d41515a..82aa11f526f05953ce840af532e55ce907b7f0dd 100644 (file)
@@ -815,7 +815,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
 }
 
 static int vidioc_s_frequency (struct file *file, void *priv,
-                               struct v4l2_frequency *f)
+                               const struct v4l2_frequency *f)
 {
        struct cx8802_fh  *fh   = priv;
        struct cx8802_dev *dev  = fh->dev;
index bc78354262acae2dc90c877455c532a0120cd47a..4f10875295e85adc4e725c30515815bae0355341 100644 (file)
@@ -1321,8 +1321,10 @@ static int vidioc_g_frequency (struct file *file, void *priv,
 }
 
 int cx88_set_freq (struct cx88_core  *core,
-                               struct v4l2_frequency *f)
+                               const struct v4l2_frequency *f)
 {
+       struct v4l2_frequency new_freq = *f;
+
        if (unlikely(UNSET == core->board.tuner_type))
                return -EINVAL;
        if (unlikely(f->tuner != 0))
@@ -1331,8 +1333,8 @@ int cx88_set_freq (struct cx88_core  *core,
        mutex_lock(&core->lock);
        cx88_newstation(core);
        call_all(core, tuner, s_frequency, f);
-       call_all(core, tuner, g_frequency, f);
-       core->freq = f->frequency;
+       call_all(core, tuner, g_frequency, &new_freq);
+       core->freq = new_freq.frequency;
 
        /* When changing channels it is required to reset TVAUDIO */
        msleep (10);
@@ -1345,7 +1347,7 @@ int cx88_set_freq (struct cx88_core  *core,
 EXPORT_SYMBOL(cx88_set_freq);
 
 static int vidioc_s_frequency (struct file *file, void *priv,
-                               struct v4l2_frequency *f)
+                               const struct v4l2_frequency *f)
 {
        struct cx8800_fh  *fh   = priv;
        struct cx88_core  *core = fh->dev->core;
index feff53c0a2511adb6ffca0e270c1a772822a639a..eca02c2435def04f1fea7dd07993904445f10bf2 100644 (file)
@@ -740,7 +740,7 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev);
 /* ----------------------------------------------------------- */
 /* cx88-video.c*/
 int cx88_enum_input (struct cx88_core  *core,struct v4l2_input *i);
-int cx88_set_freq (struct cx88_core  *core,struct v4l2_frequency *f);
+int cx88_set_freq(struct cx88_core  *core, const struct v4l2_frequency *f);
 int cx88_video_mux(struct cx88_core *core, unsigned int input);
 void cx88_querycap(struct file *file, struct cx88_core *core,
                struct v4l2_capability *cap);
index 7a8b0d0b6127aefbc1281e30108c2ef1050e9e79..e6258b68d22c68a1f776a804cd1a082b48414a68 100644 (file)
@@ -1078,7 +1078,7 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency *
        return 0;
 }
 
-int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
+int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf)
 {
        struct ivtv *itv = fh2id(fh)->itv;
        struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
index 7c553d16579bec13adb67a6e8361be22c56f5ac9..34c6bc132ebd59955b21dd62328ceb171720acd3 100644 (file)
@@ -29,7 +29,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed);
 void ivtv_set_funcs(struct video_device *vdev);
 void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std);
 void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std);
-int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf);
+int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf);
 int ivtv_s_input(struct file *file, void *fh, unsigned int inp);
 
 #endif
index 7c503fb68526fe19ab3d8a2ded41601fd44328fb..6c619d13f731c4e14186226816883b5d73ee7fac 100644 (file)
@@ -2057,7 +2057,7 @@ static int saa7134_g_frequency(struct file *file, void *priv,
 }
 
 static int saa7134_s_frequency(struct file *file, void *priv,
-                                       struct v4l2_frequency *f)
+                                       const struct v4l2_frequency *f)
 {
        struct saa7134_fh *fh = priv;
        struct saa7134_dev *dev = fh->dev;
index 91369daad72285005c14701c9dd0052d2e6adece..27dc49b03d025222154b5eb545d96628061a3988 100644 (file)
@@ -595,7 +595,7 @@ static int vidioc_g_frequency(struct file *file, void *fh, struct v4l2_frequency
        return 0;
 }
 
-static int vidioc_s_frequency(struct file *file, void *fh, struct v4l2_frequency *f)
+static int vidioc_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *f)
 {
        struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
        struct mxb *mxb = (struct mxb *)dev->ext_priv;
@@ -612,8 +612,8 @@ static int vidioc_s_frequency(struct file *file, void *fh, struct v4l2_frequency
        /* tune in desired frequency */
        tuner_call(mxb, tuner, s_frequency, f);
        /* let the tuner subdev clamp the frequency to the tuner range */
-       tuner_call(mxb, tuner, g_frequency, f);
        mxb->cur_freq = *f;
+       tuner_call(mxb, tuner, g_frequency, &mxb->cur_freq);
        if (mxb->cur_audinput == 0)
                mxb_update_audmode(mxb);
 
index 9bb0903ee5f1abeb7a969f1dcb9c6387f06bf814..34f700da2e7a12541b58a1625db50a1250e54b90 100644 (file)
@@ -337,7 +337,7 @@ static int vidioc_g_frequency(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 saa7164_encoder_fh *fh = file->private_data;
        struct saa7164_port *port = fh->port;
index b4532299c0edf54247e6d7065ef9db03a23ce9c3..5a8a6adb894bcf26741c378de531e47746a2b8f1 100644 (file)
@@ -309,7 +309,7 @@ static int vidioc_g_frequency(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 saa7164_vbi_fh *fh = file->private_data;
        struct saa7164_port *port = fh->port;
index 730e906ea912d12d810be017aa885372c476af86..65adaa74c5118fb04cd4007ecc90f3330950abfe 100644 (file)
@@ -426,7 +426,7 @@ static int vidioc_g_frequency(struct file *file, void *fh, struct v4l2_frequency
        return 0;
 }
 
-static int vidioc_s_frequency(struct file *file, void *fh, struct v4l2_frequency *f)
+static int vidioc_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *f)
 {
        struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
        struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
index 63b112b555b2fbc3f0792becae395f83eb54a458..e140a725820d613f51e63407b170ba10a9cbee90 100644 (file)
@@ -214,7 +214,7 @@ static int vidioc_s_tuner(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 dsbr100_device *radio = video_drvdata(file);
 
index 643d80ac28fb1269b70942d2a53ccb7303c266b7..59be293cbf42148d3d674f3c5fbd7f9f1dd9de44 100644 (file)
@@ -90,6 +90,26 @@ static u16 sigtable[2][4] = {
        { 2185, 4369, 13107, 65535 },
 };
 
+static const struct v4l2_frequency_band bands[] = {
+       {
+               .index = 0,
+               .type = V4L2_TUNER_RADIO,
+               .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
+               .rangelow = 8320,      /* 520 kHz */
+               .rangehigh = 26400,    /* 1650 kHz */
+               .modulation = V4L2_BAND_MODULATION_AM,
+       }, {
+               .index = 1,
+               .type = V4L2_TUNER_RADIO,
+               .capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS |
+                       V4L2_TUNER_CAP_RDS_BLOCK_IO | V4L2_TUNER_CAP_LOW |
+                       V4L2_TUNER_CAP_FREQ_BANDS,
+               .rangelow = 1400000,   /* 87.5 MHz */
+               .rangehigh = 1728000,  /* 108.0 MHz */
+               .modulation = V4L2_BAND_MODULATION_FM,
+       },
+};
+
 
 static int cadet_getstereo(struct cadet *dev)
 {
@@ -196,6 +216,8 @@ static void cadet_setfreq(struct cadet *dev, unsigned freq)
        int i, j, test;
        int curvol;
 
+       freq = clamp(freq, bands[dev->is_fm_band].rangelow,
+                          bands[dev->is_fm_band].rangehigh);
        dev->curfreq = freq;
        /*
         * Formulate a fifo command
@@ -337,26 +359,6 @@ static int vidioc_querycap(struct file *file, void *priv,
        return 0;
 }
 
-static const struct v4l2_frequency_band bands[] = {
-       {
-               .index = 0,
-               .type = V4L2_TUNER_RADIO,
-               .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
-               .rangelow = 8320,      /* 520 kHz */
-               .rangehigh = 26400,    /* 1650 kHz */
-               .modulation = V4L2_BAND_MODULATION_AM,
-       }, {
-               .index = 1,
-               .type = V4L2_TUNER_RADIO,
-               .capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS |
-                       V4L2_TUNER_CAP_RDS_BLOCK_IO | V4L2_TUNER_CAP_LOW |
-                       V4L2_TUNER_CAP_FREQ_BANDS,
-               .rangelow = 1400000,   /* 87.5 MHz */
-               .rangehigh = 1728000,  /* 108.0 MHz */
-               .modulation = V4L2_BAND_MODULATION_FM,
-       },
-};
-
 static int vidioc_g_tuner(struct file *file, void *priv,
                                struct v4l2_tuner *v)
 {
@@ -418,7 +420,7 @@ static int vidioc_g_frequency(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 cadet *dev = video_drvdata(file);
 
@@ -426,8 +428,6 @@ static int vidioc_s_frequency(struct file *file, void *priv,
                return -EINVAL;
        dev->is_fm_band =
                f->frequency >= (bands[0].rangehigh + bands[1].rangelow) / 2;
-       clamp(f->frequency, bands[dev->is_fm_band].rangelow,
-                           bands[dev->is_fm_band].rangehigh);
        cadet_setfreq(dev, f->frequency);
        return 0;
 }
index fe0a4f85c422d4d4818dcc56d152722d3e4002d2..0c1e27b13e69d50d8f37b43aca8efaa92c9a8584 100644 (file)
@@ -102,17 +102,18 @@ static int radio_isa_s_tuner(struct file *file, void *priv,
 }
 
 static int radio_isa_s_frequency(struct file *file, void *priv,
-                               struct v4l2_frequency *f)
+                               const struct v4l2_frequency *f)
 {
        struct radio_isa_card *isa = video_drvdata(file);
+       u32 freq = f->frequency;
        int res;
 
        if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
                return -EINVAL;
-       f->frequency = clamp(f->frequency, FREQ_LOW, FREQ_HIGH);
-       res = isa->drv->ops->s_frequency(isa, f->frequency);
+       freq = clamp(freq, FREQ_LOW, FREQ_HIGH);
+       res = isa->drv->ops->s_frequency(isa, freq);
        if (res == 0)
-               isa->freq = f->frequency;
+               isa->freq = freq;
        return res;
 }
 
index 296941a9ae25decc88dd4d0da8b2240319eb2b34..4c9ae767fb31c3739c08e82888b4ecb1ecbf280a 100644 (file)
@@ -215,15 +215,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);
+       unsigned freq = f->frequency;
 
        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);
+       freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
+       return keene_cmd_main(radio, freq, true);
 }
 
 static int vidioc_g_frequency(struct file *file, void *priv,
index c61f590029ad7c05ef75911c69e5fdbe50f24e8e..7f85c6f980097cd59639425108038fa2b001b2a9 100644 (file)
@@ -257,7 +257,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
 
 /* vidioc_s_frequency - set tuner radio frequency */
 static int vidioc_s_frequency(struct file *file, void *priv,
-                               struct v4l2_frequency *f)
+                               const struct v4l2_frequency *f)
 {
        struct ma901radio_device *radio = video_drvdata(file);
 
index 3d0ff4404d1261618951d8be5abe76a6509a1ac4..2b8d31d8330bf94907baed5b67ff991f90f18337 100644 (file)
@@ -131,14 +131,14 @@ static int vidioc_g_frequency(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 pcm20 *dev = video_drvdata(file);
 
        if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
                return -EINVAL;
 
-       dev->freq = clamp(f->frequency, 87 * 16000U, 108 * 16000U);
+       dev->freq = clamp_t(u32, f->frequency, 87 * 16000U, 108 * 16000U);
        pcm20_setfreq(dev, dev->freq);
        return 0;
 }
index 9c5a267b60b46f80f35a0326771cffa3666a12c9..f9cdd8b96adde71720e41e83749e2dc6a09f6204 100644 (file)
@@ -323,7 +323,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
 
 /* vidioc_s_frequency - set tuner radio frequency */
 static int vidioc_s_frequency(struct file *file, void *priv,
-                               struct v4l2_frequency *f)
+                               const struct v4l2_frequency *f)
 {
        struct amradio_device *radio = video_drvdata(file);
 
index 637a555649582e1ed8aaa9913d4c66ea47318b0d..6142b5b3e81bad85839315236eecb0170c2d7c01 100644 (file)
@@ -151,7 +151,7 @@ static int vidioc_s_tuner(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 fmi *fmi = video_drvdata(file);
 
index 3df4339460d25bc1e0945b5d5ab19a56e38f1749..2a2d21ed91339ecde6fa0127e7406c26a64a298c 100644 (file)
@@ -215,7 +215,7 @@ static int radio_si4713_g_frequency(struct file *file, void *p,
 }
 
 static int radio_si4713_s_frequency(struct file *file, void *p,
-                                   struct v4l2_frequency *vf)
+                                   const struct v4l2_frequency *vf)
 {
        return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
                                          s_frequency, vf);
index 1978516af67e01510fc849f006dcfdd0d59ba2a1..893842874d89452d3446879ba10c889cc063bb45 100644 (file)
@@ -351,7 +351,7 @@ static int vidioc_s_tuner(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 tea5764_device *radio = video_drvdata(file);
 
index 4b5190d4fea5d701b06853bedb5b89408742fb3c..fcd7c195e0c5fe15080a87b1607d68f4719d592a 100644 (file)
@@ -368,7 +368,7 @@ static int vidioc_g_frequency(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 radio_tea5777 *tea = video_drvdata(file);
 
index b87effeb5dc607ea57bf08bd1ca17cd0afabefff..1712c05c113dae9307796b9bc138778d0f277d64 100644 (file)
@@ -91,7 +91,7 @@ static int timbradio_vidioc_s_audio(struct file *file, void *priv,
 }
 
 static int timbradio_vidioc_s_frequency(struct file *file, void *priv,
-       struct v4l2_frequency *f)
+       const struct v4l2_frequency *f)
 {
        struct timbradio *tr = video_drvdata(file);
        return v4l2_subdev_call(tr->sd_tuner, tuner, s_frequency, f);
index 02151e0e6e63333e54fccae27c181fe05e108b78..9a02fee904bf5da2d4d600798315e37bba4a92ac 100644 (file)
@@ -1640,7 +1640,7 @@ static int wl1273_fm_vidioc_g_frequency(struct file *file, void *priv,
 }
 
 static int wl1273_fm_vidioc_s_frequency(struct file *file, void *priv,
-                                       struct v4l2_frequency *freq)
+                                       const struct v4l2_frequency *freq)
 {
        struct wl1273_device *radio = video_get_drvdata(video_devdata(file));
        struct wl1273_core *core = radio->core;
index 18989388ddc14d32f3134f650615c33e43bb55bb..5708633a3d78d718dd41a4b3918642f5428d835b 100644 (file)
@@ -678,7 +678,7 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv,
  * si470x_vidioc_s_frequency - set tuner or modulator radio frequency
  */
 static int si470x_vidioc_s_frequency(struct file *file, void *priv,
-               struct v4l2_frequency *freq)
+               const struct v4l2_frequency *freq)
 {
        struct si470x_device *radio = video_drvdata(file);
        int retval;
index bd61b3bd0ca316a05d339b12a77d02c45c1a8cd6..e305c14272b5ca9a9ad736b8d6b1ac4590746285 100644 (file)
@@ -1212,7 +1212,7 @@ exit:
        return rval;
 }
 
-static int si4713_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f);
+static int si4713_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f);
 static int si4713_s_modulator(struct v4l2_subdev *sd, const struct v4l2_modulator *);
 /*
  * si4713_setup - Sets the device up with current configuration.
@@ -1950,7 +1950,7 @@ unlock:
 }
 
 /* si4713_s_frequency - set tuner or modulator radio frequency */
-static int si4713_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
+static int si4713_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f)
 {
        struct si4713_device *sdev = to_si4713_device(sd);
        int rval = 0;
@@ -1970,7 +1970,6 @@ static int si4713_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
                rval = 0;
        }
        sdev->frequency = frequency;
-       f->frequency = si4713_to_v4l2(frequency);
 
 unlock:
        mutex_unlock(&sdev->mutex);
index b18c2dc268bab2705ee6cd88cdcea9bb970c71aa..867395568f9220a98c17e7f5920868335180c950 100644 (file)
@@ -101,7 +101,7 @@ static int tef6862_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v)
        return v->index ? -EINVAL : 0;
 }
 
-static int tef6862_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
+static int tef6862_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f)
 {
        struct tef6862_state *state = to_state(sd);
        struct i2c_client *client = v4l2_get_subdevdata(sd);
index 0a8ee8fab9242476c14c153b0cc00b51387a7b26..0183956d9b02649194b9a2d52ae15579391dd191 100644 (file)
@@ -388,7 +388,7 @@ static int fm_v4l2_vidioc_g_freq(struct file *file, void *priv,
 
 /* Set tuner or modulator radio frequency */
 static int fm_v4l2_vidioc_s_freq(struct file *file, void *priv,
-               struct v4l2_frequency *freq)
+               const struct v4l2_frequency *freq)
 {
        struct fmdev *fmdev = video_drvdata(file);
 
@@ -396,9 +396,7 @@ static int fm_v4l2_vidioc_s_freq(struct file *file, void *priv,
         * As V4L2_TUNER_CAP_LOW is set 1 user sends the frequency
         * in units of 62.5 Hz.
         */
-       freq->frequency = (u32)(freq->frequency / 16);
-
-       return fmc_set_freq(fmdev, freq->frequency);
+       return fmc_set_freq(fmdev, freq->frequency / 16);
 }
 
 /* Set hardware frequency seek. If current mode is NOT RX, set it RX. */
index 8b9e8268e911d2589f2758f8631f428518013019..b1d6b034e1a1575e029ae5d6046df3a9ea022781 100644 (file)
@@ -1545,7 +1545,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_frequency(struct file *file, void *priv,
-                               struct v4l2_frequency *freq)
+                               const struct v4l2_frequency *freq)
 {
        struct au0828_fh *fh = priv;
        struct au0828_dev *dev = fh->dev;
index ac6200870a6264c21ffacbef8c7fda3477fd7b79..96f65318d7885f8ad125b1bc1c81f897d1d39dad 100644 (file)
@@ -1172,10 +1172,11 @@ int cx231xx_g_frequency(struct file *file, void *priv,
 }
 
 int cx231xx_s_frequency(struct file *file, void *priv,
-                             struct v4l2_frequency *f)
+                             const struct v4l2_frequency *f)
 {
        struct cx231xx_fh *fh = priv;
        struct cx231xx *dev = fh->dev;
+       struct v4l2_frequency new_freq = *f;
        int rc;
        u32 if_frequency = 5400000;
 
@@ -1194,8 +1195,8 @@ int cx231xx_s_frequency(struct file *file, void *priv,
        rc = cx231xx_tuner_pre_channel_change(dev);
 
        call_all(dev, tuner, s_frequency, f);
-       call_all(dev, tuner, g_frequency, f);
-       dev->ctl_freq = f->frequency;
+       call_all(dev, tuner, g_frequency, &new_freq);
+       dev->ctl_freq = new_freq.frequency;
 
        /* set post channel change settings in DIF first */
        rc = cx231xx_tuner_post_channel_change(dev);
index dff3f1d73f28d2360b051fa15c79aea3a2524dc8..6f701e9bec446bea919443c7b6291650892267ff 100644 (file)
@@ -940,7 +940,7 @@ int cx231xx_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
 int cx231xx_g_frequency(struct file *file, void *priv,
                              struct v4l2_frequency *f);
 int cx231xx_s_frequency(struct file *file, void *priv,
-                             struct v4l2_frequency *f);
+                             const struct v4l2_frequency *f);
 int cx231xx_enum_input(struct file *file, void *priv,
                             struct v4l2_input *i);
 int cx231xx_g_input(struct file *file, void *priv, unsigned int *i);
index d585c19a5d9c98bfffb73373de4bc8bf4b2178f7..af79089a016917fd59c66dddb478fc1574ce2c13 100644 (file)
@@ -1221,8 +1221,9 @@ static int vidioc_g_frequency(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 v4l2_frequency new_freq = *f;
        struct em28xx_fh      *fh  = priv;
        struct em28xx         *dev = fh->dev;
 
@@ -1230,8 +1231,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
                return -EINVAL;
 
        v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
-       v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f);
-       dev->ctl_freq = f->frequency;
+       v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, &new_freq);
+       dev->ctl_freq = new_freq.frequency;
 
        return 0;
 }
index 34c3b6e80e86da9f1f455b40d519e197d2aee6e0..75657c6dc0138d65db361d165ce34ebe9a24111f 100644 (file)
@@ -365,7 +365,7 @@ static int pvr2_s_tuner(struct file *file, void *priv, struct v4l2_tuner *vt)
                        vt->audmode);
 }
 
-static int pvr2_s_frequency(struct file *file, void *priv, struct v4l2_frequency *vf)
+static int pvr2_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *vf)
 {
        struct pvr2_v4l2_fh *fh = file->private_data;
        struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
index 0f958f74dbc46f45763a215046cff1f637d0baed..8b1daf1f1e99588aa75ecf47aae3dbaee9a7206e 100644 (file)
@@ -252,7 +252,7 @@ error:
 }
 
 static int fm_set_freq(struct file *file, void *priv,
-                      struct v4l2_frequency *argp)
+                      const struct v4l2_frequency *argp)
 {
        struct poseidon *p = video_drvdata(file);
 
index dab0ca32d396123fb5d57db239f2136385be98f9..8ef7c8c419f7af2bc0f9bb632c388a39650a39a9 100644 (file)
@@ -1079,10 +1079,11 @@ static int set_frequency(struct poseidon *pd, u32 *frequency)
 }
 
 static int vidioc_s_frequency(struct file *file, void *fh,
-                               struct v4l2_frequency *freq)
+                               const struct v4l2_frequency *freq)
 {
        struct front_face *front = fh;
        struct poseidon *pd = front->pd;
+       u32 frequency = freq->frequency;
 
        if (freq->tuner)
                return -EINVAL;
@@ -1090,7 +1091,7 @@ static int vidioc_s_frequency(struct file *file, void *fh,
        pd->pm_suspend = pm_video_suspend;
        pd->pm_resume = pm_video_resume;
 #endif
-       return set_frequency(pd, &freq->frequency);
+       return set_frequency(pd, &frequency);
 }
 
 static int vidioc_reqbufs(struct file *file, void *fh,
index 1a6857929c15716aa4bcd516e97b2b0726948336..49df7537fa638f1e35f4038da2e008e48c9acdb1 100644 (file)
@@ -1255,7 +1255,7 @@ static int vidioc_g_frequency(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 tm6000_fh   *fh  = priv;
        struct tm6000_core *dev = fh->dev;
index cd1fe78a553250c16f87ff594938e0505962c713..b66844564144edaaeebed6433a4793d5d2c9237f 100644 (file)
@@ -657,7 +657,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_frequency(struct file *file, void *priv,
-                               struct v4l2_frequency *freq)
+                               const struct v4l2_frequency *freq)
 {
        struct usb_usbvision *usbvision = video_drvdata(file);
 
index b5a8aac2e1263c2fb0f684dc794ce91ef5267561..279f65efe9ba905baff7e679c6db9c4a8d2c97d7 100644 (file)
@@ -1134,7 +1134,7 @@ static int tuner_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
        return 0;
 }
 
-static int tuner_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
+static int tuner_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f)
 {
        struct tuner *t = to_tuner(sd);
 
index aa6e7c788db2b00ed0493c9babae92924a65b6a5..8ec8abe0ffe79ebf241cfcbbd54b7b9f7dc95747 100644 (file)
@@ -1316,7 +1316,7 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops *ops,
                                struct file *file, void *fh, void *arg)
 {
        struct video_device *vfd = video_devdata(file);
-       struct v4l2_frequency *p = arg;
+       const struct v4l2_frequency *p = arg;
        enum v4l2_tuner_type type;
 
        type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
index cb9fe33050c7cec6a3ac45369207439d840bd2d4..1288f1cab1298166aed0e4ba11b95ee95ee69bbb 100644 (file)
@@ -1281,7 +1281,7 @@ static int vidioc_g_frequency(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 go7007 *go = ((struct go7007_file *) priv)->go;
 
index 4118ad1324c91a20dcdf8afafa080b9619986695..f06436dbaf75d2f49b94d7417e7912cd9e3374ff 100644 (file)
@@ -223,7 +223,7 @@ struct v4l2_ioctl_ops {
        int (*vidioc_g_frequency)      (struct file *file, void *fh,
                                        struct v4l2_frequency *a);
        int (*vidioc_s_frequency)      (struct file *file, void *fh,
-                                       struct v4l2_frequency *a);
+                                       const struct v4l2_frequency *a);
        int (*vidioc_enum_freq_bands) (struct file *file, void *fh,
                                    struct v4l2_frequency_band *band);
 
index b137a5e1151a5be0ad55c036f721ff6cb4bbe4e4..1a82a50ea9c85c1ee6a289787d6519d816ba9510 100644 (file)
@@ -191,7 +191,7 @@ struct v4l2_subdev_core_ops {
  */
 struct v4l2_subdev_tuner_ops {
        int (*s_radio)(struct v4l2_subdev *sd);
-       int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
+       int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);
        int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
        int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
        int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
index 3c6c1e3226f365c82c45cc1f98065520d24bfbb7..738c5ad9c93f4019b58e58994f9229e14b498d3a 100644 (file)
@@ -336,7 +336,7 @@ static int vidioc_g_frequency(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 snd_tea575x *tea = video_drvdata(file);
 
@@ -350,7 +350,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
        else
                tea->band = BAND_FM;
 
-       tea->freq = clamp(f->frequency, bands[tea->band].rangelow,
+       tea->freq = clamp_t(u32, f->frequency, bands[tea->band].rangelow,
                                        bands[tea->band].rangehigh);
        snd_tea575x_set_freq(tea);
        return 0;