aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-cadet.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-03-19 03:09:26 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-24 05:25:34 -0400
commitb530a447bb588fdf43fdf4eb909e4ee1921d47ac (patch)
tree8c9f6abb0f0c07ceea984a87fd80e9e65e7d483b /drivers/media/radio/radio-cadet.c
parent69aa6f4ec669b9121057cc9e32cb10b5f744f6d6 (diff)
[media] v4l2: add const to argument of write-only s_frequency ioctl
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>
Diffstat (limited to 'drivers/media/radio/radio-cadet.c')
-rw-r--r--drivers/media/radio/radio-cadet.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 643d80ac28fb..59be293cbf42 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -90,6 +90,26 @@ static u16 sigtable[2][4] = {
90 { 2185, 4369, 13107, 65535 }, 90 { 2185, 4369, 13107, 65535 },
91}; 91};
92 92
93static const struct v4l2_frequency_band bands[] = {
94 {
95 .index = 0,
96 .type = V4L2_TUNER_RADIO,
97 .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
98 .rangelow = 8320, /* 520 kHz */
99 .rangehigh = 26400, /* 1650 kHz */
100 .modulation = V4L2_BAND_MODULATION_AM,
101 }, {
102 .index = 1,
103 .type = V4L2_TUNER_RADIO,
104 .capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS |
105 V4L2_TUNER_CAP_RDS_BLOCK_IO | V4L2_TUNER_CAP_LOW |
106 V4L2_TUNER_CAP_FREQ_BANDS,
107 .rangelow = 1400000, /* 87.5 MHz */
108 .rangehigh = 1728000, /* 108.0 MHz */
109 .modulation = V4L2_BAND_MODULATION_FM,
110 },
111};
112
93 113
94static int cadet_getstereo(struct cadet *dev) 114static int cadet_getstereo(struct cadet *dev)
95{ 115{
@@ -196,6 +216,8 @@ static void cadet_setfreq(struct cadet *dev, unsigned freq)
196 int i, j, test; 216 int i, j, test;
197 int curvol; 217 int curvol;
198 218
219 freq = clamp(freq, bands[dev->is_fm_band].rangelow,
220 bands[dev->is_fm_band].rangehigh);
199 dev->curfreq = freq; 221 dev->curfreq = freq;
200 /* 222 /*
201 * Formulate a fifo command 223 * Formulate a fifo command
@@ -337,26 +359,6 @@ static int vidioc_querycap(struct file *file, void *priv,
337 return 0; 359 return 0;
338} 360}
339 361
340static const struct v4l2_frequency_band bands[] = {
341 {
342 .index = 0,
343 .type = V4L2_TUNER_RADIO,
344 .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
345 .rangelow = 8320, /* 520 kHz */
346 .rangehigh = 26400, /* 1650 kHz */
347 .modulation = V4L2_BAND_MODULATION_AM,
348 }, {
349 .index = 1,
350 .type = V4L2_TUNER_RADIO,
351 .capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS |
352 V4L2_TUNER_CAP_RDS_BLOCK_IO | V4L2_TUNER_CAP_LOW |
353 V4L2_TUNER_CAP_FREQ_BANDS,
354 .rangelow = 1400000, /* 87.5 MHz */
355 .rangehigh = 1728000, /* 108.0 MHz */
356 .modulation = V4L2_BAND_MODULATION_FM,
357 },
358};
359
360static int vidioc_g_tuner(struct file *file, void *priv, 362static int vidioc_g_tuner(struct file *file, void *priv,
361 struct v4l2_tuner *v) 363 struct v4l2_tuner *v)
362{ 364{
@@ -418,7 +420,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
418 420
419 421
420static int vidioc_s_frequency(struct file *file, void *priv, 422static int vidioc_s_frequency(struct file *file, void *priv,
421 struct v4l2_frequency *f) 423 const struct v4l2_frequency *f)
422{ 424{
423 struct cadet *dev = video_drvdata(file); 425 struct cadet *dev = video_drvdata(file);
424 426
@@ -426,8 +428,6 @@ static int vidioc_s_frequency(struct file *file, void *priv,
426 return -EINVAL; 428 return -EINVAL;
427 dev->is_fm_band = 429 dev->is_fm_band =
428 f->frequency >= (bands[0].rangehigh + bands[1].rangelow) / 2; 430 f->frequency >= (bands[0].rangehigh + bands[1].rangelow) / 2;
429 clamp(f->frequency, bands[dev->is_fm_band].rangelow,
430 bands[dev->is_fm_band].rangehigh);
431 cadet_setfreq(dev, f->frequency); 431 cadet_setfreq(dev, f->frequency);
432 return 0; 432 return 0;
433} 433}