Commit 6fcb5b3e authored by Pantelis Koukousoulas's avatar Pantelis Koukousoulas Committed by Mauro Carvalho Chehab

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: default avatarPantelis Koukousoulas <pakt223@freemail.gr>
Signed-off-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 25d8527a
...@@ -498,11 +498,20 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, ...@@ -498,11 +498,20 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
LOCK_TAKE(cptr->hdw->big_lock); do { LOCK_TAKE(cptr->hdw->big_lock); do {
if (cptr->info->type == pvr2_ctl_int) { if (cptr->info->type == pvr2_ctl_int) {
ret = parse_token(ptr,len,valptr,NULL,0); ret = parse_token(ptr,len,valptr,NULL,0);
if ((ret >= 0) && if (ret >= 0) {
((*valptr < cptr->info->def.type_int.min_value) || int min, max;
(*valptr > cptr->info->def.type_int.max_value))) { 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; ret = -ERANGE;
} }
}
if (maskptr) *maskptr = ~0; if (maskptr) *maskptr = ~0;
} else if (cptr->info->type == pvr2_ctl_bool) { } else if (cptr->info->type == pvr2_ctl_bool) {
ret = parse_token( ret = parse_token(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment