diff options
author | Mike Isely <isely@pobox.com> | 2008-08-31 19:55:03 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:57 -0400 |
commit | 26dd1c57a05f5c6d339d55d5317d47576fd2fbc5 (patch) | |
tree | b1aebbbc3f6701c6caa718cfc92d91b657cf7433 /drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |
parent | 755879c66bb820ec27e2e02b22b13d3896583efe (diff) |
V4L/DVB (8898): pvrusb2: Be able to programmatically retrieve a control's default value
The pvrusb2 control mechanism up until now has used a constant int to
hold a control's default value. This change makes it possible to
retrieve the control's default through some other means, e.g. as a
result of a query from lower level software.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-ctrl.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index 0764fbfffb73..2741c7b0b537 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -134,13 +134,19 @@ int pvr2_ctrl_get_min(struct pvr2_ctrl *cptr) | |||
134 | 134 | ||
135 | 135 | ||
136 | /* Retrieve control's default value (any type) */ | 136 | /* Retrieve control's default value (any type) */ |
137 | int pvr2_ctrl_get_def(struct pvr2_ctrl *cptr) | 137 | int pvr2_ctrl_get_def(struct pvr2_ctrl *cptr, int *valptr) |
138 | { | 138 | { |
139 | int ret = 0; | 139 | int ret = 0; |
140 | if (!cptr) return 0; | 140 | if (!cptr) return 0; |
141 | LOCK_TAKE(cptr->hdw->big_lock); do { | 141 | LOCK_TAKE(cptr->hdw->big_lock); do { |
142 | if (cptr->info->type == pvr2_ctl_int) { | 142 | if (cptr->info->type == pvr2_ctl_int) { |
143 | ret = cptr->info->default_value; | 143 | if (cptr->info->get_def_value) { |
144 | /* Comment to keep checkpatch.pl quiet */ | ||
145 | ret = cptr->info->get_def_value(cptr, valptr); | ||
146 | } else { | ||
147 | /* Comment to keep checkpatch.pl quiet */ | ||
148 | *valptr = cptr->info->default_value; | ||
149 | } | ||
144 | } | 150 | } |
145 | } while(0); LOCK_GIVE(cptr->hdw->big_lock); | 151 | } while(0); LOCK_GIVE(cptr->hdw->big_lock); |
146 | return ret; | 152 | return ret; |