summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-12-27 20:06:54 -0600
committerMike Isely <isely@pobox.com>2006-12-27 20:06:54 -0600
commit07c2e5338998bde7ba3bfd338813a5a4dacf430f (patch)
tree3ae556f87af88a63dab1035d4673ac5ad5a6d658 /linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
parent9658dff2c8dd1b4c1dac98a634a5967aaa156ef8 (diff)
downloadmediapointer-dvb-s2-07c2e5338998bde7ba3bfd338813a5a4dacf430f.tar.gz
mediapointer-dvb-s2-07c2e5338998bde7ba3bfd338813a5a4dacf430f.tar.bz2
pvrusb2: Fix for min/max control value checking
From: Pantelis Koukousoulas <pakt223@freemail.gr> 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. --Pantelis Signed-off-by: Pantelis Koukousoulas <pakt223@freemail.gr> Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index 767cb0943..307e4d789 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -503,10 +503,19 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
LOCK_TAKE(cptr->hdw->big_lock); do {
if (cptr->info->type == pvr2_ctl_int) {
ret = parse_token(ptr,len,valptr,NULL,0);
- if ((ret >= 0) &&
- ((*valptr < cptr->info->def.type_int.min_value) ||
- (*valptr > cptr->info->def.type_int.max_value))) {
- ret = -ERANGE;
+ if (ret >= 0) {
+ int min, max;
+ min = cptr->info->def.type_int.min_value;
+ if (cptr->info->get_min_value) {
+ cptr->info->get_min_value(cptr,&min);
+ }
+ max = cptr->info->def.type_int.max_value;
+ if (cptr->info->get_max_value) {
+ cptr->info->get_max_value(cptr,&max);
+ }
+ if ((*valptr < min) || (*valptr > max)) {
+ ret = -ERANGE;
+ }
}
if (maskptr) *maskptr = ~0;
} else if (cptr->info->type == pvr2_ctl_bool) {