aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-tea5777.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-09-14 06:41:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-26 09:47:28 -0400
commitec6f4328108f1c83d5ac907c0d978fa886ef9627 (patch)
tree5e964c9a73b5ab2cb839af53ebebfe18f5bb28c9 /drivers/media/radio/radio-tea5777.c
parentd88aab53bd267c9fb0b0451e9acae68091703eab (diff)
[media] v4l2: make vidioc_s_freq_hw_seek const
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>
Diffstat (limited to 'drivers/media/radio/radio-tea5777.c')
-rw-r--r--drivers/media/radio/radio-tea5777.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c
index ef8289829794..c1a2ea6e87a3 100644
--- a/drivers/media/radio/radio-tea5777.c
+++ b/drivers/media/radio/radio-tea5777.c
@@ -385,59 +385,61 @@ static int vidioc_s_frequency(struct file *file, void *priv,
385} 385}
386 386
387static int vidioc_s_hw_freq_seek(struct file *file, void *fh, 387static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
388 struct v4l2_hw_freq_seek *a) 388 const struct v4l2_hw_freq_seek *a)
389{ 389{
390 struct radio_tea5777 *tea = video_drvdata(file); 390 struct radio_tea5777 *tea = video_drvdata(file);
391 unsigned long timeout; 391 unsigned long timeout;
392 u32 rangelow = a->rangelow;
393 u32 rangehigh = a->rangehigh;
392 int i, res, spacing; 394 int i, res, spacing;
393 u32 orig_freq; 395 u32 orig_freq;
394 396
395 if (a->tuner || a->wrap_around) 397 if (a->tuner || a->wrap_around)
396 return -EINVAL; 398 return -EINVAL;
397 399
398 if (a->rangelow || a->rangehigh) { 400 if (rangelow || rangehigh) {
399 for (i = 0; i < ARRAY_SIZE(bands); i++) { 401 for (i = 0; i < ARRAY_SIZE(bands); i++) {
400 if (i == BAND_AM && !tea->has_am) 402 if (i == BAND_AM && !tea->has_am)
401 continue; 403 continue;
402 if (bands[i].rangelow >= a->rangelow && 404 if (bands[i].rangelow >= rangelow &&
403 bands[i].rangehigh <= a->rangehigh) 405 bands[i].rangehigh <= rangehigh)
404 break; 406 break;
405 } 407 }
406 if (i == ARRAY_SIZE(bands)) 408 if (i == ARRAY_SIZE(bands))
407 return -EINVAL; /* No matching band found */ 409 return -EINVAL; /* No matching band found */
408 410
409 tea->band = i; 411 tea->band = i;
410 if (tea->freq < a->rangelow || tea->freq > a->rangehigh) { 412 if (tea->freq < rangelow || tea->freq > rangehigh) {
411 tea->freq = clamp(tea->freq, a->rangelow, 413 tea->freq = clamp(tea->freq, rangelow,
412 a->rangehigh); 414 rangehigh);
413 res = radio_tea5777_set_freq(tea); 415 res = radio_tea5777_set_freq(tea);
414 if (res) 416 if (res)
415 return res; 417 return res;
416 } 418 }
417 } else { 419 } else {
418 a->rangelow = bands[tea->band].rangelow; 420 rangelow = bands[tea->band].rangelow;
419 a->rangehigh = bands[tea->band].rangehigh; 421 rangehigh = bands[tea->band].rangehigh;
420 } 422 }
421 423
422 spacing = (tea->band == BAND_AM) ? (5 * 16) : (200 * 16); /* kHz */ 424 spacing = (tea->band == BAND_AM) ? (5 * 16) : (200 * 16); /* kHz */
423 orig_freq = tea->freq; 425 orig_freq = tea->freq;
424 426
425 tea->write_reg |= TEA5777_W_PROGBLIM_MASK; 427 tea->write_reg |= TEA5777_W_PROGBLIM_MASK;
426 if (tea->seek_rangelow != a->rangelow) { 428 if (tea->seek_rangelow != rangelow) {
427 tea->write_reg &= ~TEA5777_W_UPDWN_MASK; 429 tea->write_reg &= ~TEA5777_W_UPDWN_MASK;
428 tea->freq = a->rangelow; 430 tea->freq = rangelow;
429 res = radio_tea5777_set_freq(tea); 431 res = radio_tea5777_set_freq(tea);
430 if (res) 432 if (res)
431 goto leave; 433 goto leave;
432 tea->seek_rangelow = a->rangelow; 434 tea->seek_rangelow = rangelow;
433 } 435 }
434 if (tea->seek_rangehigh != a->rangehigh) { 436 if (tea->seek_rangehigh != rangehigh) {
435 tea->write_reg |= TEA5777_W_UPDWN_MASK; 437 tea->write_reg |= TEA5777_W_UPDWN_MASK;
436 tea->freq = a->rangehigh; 438 tea->freq = rangehigh;
437 res = radio_tea5777_set_freq(tea); 439 res = radio_tea5777_set_freq(tea);
438 if (res) 440 if (res)
439 goto leave; 441 goto leave;
440 tea->seek_rangehigh = a->rangehigh; 442 tea->seek_rangehigh = rangehigh;
441 } 443 }
442 tea->write_reg &= ~TEA5777_W_PROGBLIM_MASK; 444 tea->write_reg &= ~TEA5777_W_PROGBLIM_MASK;
443 445