diff options
author | Pantelis Koukousoulas <pakt223@freemail.gr> | 2006-12-27 21:06:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:22 -0500 |
commit | 6fcb5b3ef758ca78461d390dc07bed5a4667c521 (patch) | |
tree | a24da9ae4d9c523cc3a6dd432060a080223cfdec | |
parent | 25d8527a441760c333c41ec7197ba0750780b371 (diff) |
V4L/DVB (5036): Pvrusb2: Fix for min/max control value checking
In the previous patch we exploited the get_{min,max}_value facility to adjust
min/max allowable frequencies on the fly, depending on tuner mode.
Unfortunately, this facility was not used inside the *sym_to_val() function
that translates what we echo to sysfs, which means we got an -ERANGE despite
asking for a frequency between what we read to be min/max.
This patch corrects this small omission.
Signed-off-by: Pantelis Koukousoulas <pakt223@freemail.gr>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index c77de859cc8e..5c9cf1523e23 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -498,10 +498,19 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
498 | LOCK_TAKE(cptr->hdw->big_lock); do { | 498 | LOCK_TAKE(cptr->hdw->big_lock); do { |
499 | if (cptr->info->type == pvr2_ctl_int) { | 499 | if (cptr->info->type == pvr2_ctl_int) { |
500 | ret = parse_token(ptr,len,valptr,NULL,0); | 500 | ret = parse_token(ptr,len,valptr,NULL,0); |
501 | if ((ret >= 0) && | 501 | if (ret >= 0) { |
502 | ((*valptr < cptr->info->def.type_int.min_value) || | 502 | int min, max; |
503 | (*valptr > cptr->info->def.type_int.max_value))) { | 503 | min = cptr->info->def.type_int.min_value; |
504 | ret = -ERANGE; | 504 | if (cptr->info->get_min_value) { |
505 | cptr->info->get_min_value(cptr,&min); | ||
506 | } | ||
507 | max = cptr->info->def.type_int.max_value; | ||
508 | if (cptr->info->get_max_value) { | ||
509 | cptr->info->get_max_value(cptr,&max); | ||
510 | } | ||
511 | if ((*valptr < min) || (*valptr > max)) { | ||
512 | ret = -ERANGE; | ||
513 | } | ||
505 | } | 514 | } |
506 | if (maskptr) *maskptr = ~0; | 515 | if (maskptr) *maskptr = ~0; |
507 | } else if (cptr->info->type == pvr2_ctl_bool) { | 516 | } else if (cptr->info->type == pvr2_ctl_bool) { |