diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-ctrl.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index fb6198f1df98..c77de859cc8e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -43,12 +43,17 @@ int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *cptr,int mask,int val) | |||
43 | if (cptr->info->type == pvr2_ctl_bitmask) { | 43 | if (cptr->info->type == pvr2_ctl_bitmask) { |
44 | mask &= cptr->info->def.type_bitmask.valid_bits; | 44 | mask &= cptr->info->def.type_bitmask.valid_bits; |
45 | } else if (cptr->info->type == pvr2_ctl_int) { | 45 | } else if (cptr->info->type == pvr2_ctl_int) { |
46 | if (val < cptr->info->def.type_int.min_value) { | 46 | int lim; |
47 | break; | 47 | lim = cptr->info->def.type_int.min_value; |
48 | if (cptr->info->get_min_value) { | ||
49 | cptr->info->get_min_value(cptr,&lim); | ||
48 | } | 50 | } |
49 | if (val > cptr->info->def.type_int.max_value) { | 51 | if (val < lim) break; |
50 | break; | 52 | lim = cptr->info->def.type_int.max_value; |
53 | if (cptr->info->get_max_value) { | ||
54 | cptr->info->get_max_value(cptr,&lim); | ||
51 | } | 55 | } |
56 | if (val > lim) break; | ||
52 | } else if (cptr->info->type == pvr2_ctl_enum) { | 57 | } else if (cptr->info->type == pvr2_ctl_enum) { |
53 | if (val >= cptr->info->def.type_enum.count) { | 58 | if (val >= cptr->info->def.type_enum.count) { |
54 | break; | 59 | break; |
@@ -91,7 +96,9 @@ int pvr2_ctrl_get_max(struct pvr2_ctrl *cptr) | |||
91 | int ret = 0; | 96 | int ret = 0; |
92 | if (!cptr) return 0; | 97 | if (!cptr) return 0; |
93 | LOCK_TAKE(cptr->hdw->big_lock); do { | 98 | LOCK_TAKE(cptr->hdw->big_lock); do { |
94 | if (cptr->info->type == pvr2_ctl_int) { | 99 | if (cptr->info->get_max_value) { |
100 | cptr->info->get_max_value(cptr,&ret); | ||
101 | } else if (cptr->info->type == pvr2_ctl_int) { | ||
95 | ret = cptr->info->def.type_int.max_value; | 102 | ret = cptr->info->def.type_int.max_value; |
96 | } | 103 | } |
97 | } while(0); LOCK_GIVE(cptr->hdw->big_lock); | 104 | } while(0); LOCK_GIVE(cptr->hdw->big_lock); |
@@ -105,7 +112,9 @@ int pvr2_ctrl_get_min(struct pvr2_ctrl *cptr) | |||
105 | int ret = 0; | 112 | int ret = 0; |
106 | if (!cptr) return 0; | 113 | if (!cptr) return 0; |
107 | LOCK_TAKE(cptr->hdw->big_lock); do { | 114 | LOCK_TAKE(cptr->hdw->big_lock); do { |
108 | if (cptr->info->type == pvr2_ctl_int) { | 115 | if (cptr->info->get_min_value) { |
116 | cptr->info->get_min_value(cptr,&ret); | ||
117 | } else if (cptr->info->type == pvr2_ctl_int) { | ||
109 | ret = cptr->info->def.type_int.min_value; | 118 | ret = cptr->info->def.type_int.min_value; |
110 | } | 119 | } |
111 | } while(0); LOCK_GIVE(cptr->hdw->big_lock); | 120 | } while(0); LOCK_GIVE(cptr->hdw->big_lock); |