diff options
author | Mike Isely <isely@pobox.com> | 2006-12-27 21:12:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:24 -0500 |
commit | 8079384eeb1c490d0ad679cef061205e1b5a1c8a (patch) | |
tree | c2c53947dd456bcf668c6b4d62f664b49b0590f1 /drivers/media | |
parent | fd5a75fe00ec13311289928c2cb17d8676f8db45 (diff) |
V4L/DVB (5041): Pvrusb2: Use separate enumeration for get/store of minor number
Use separate enum for get/store of minor number; we want pvr2_config
to go away eventually and since it really means something different,
don't use it here
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 3 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 17 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.h | 10 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 4 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 12 |
5 files changed, 31 insertions, 15 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index e6d546f56d31..746d174d0b0d 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | |||
@@ -283,7 +283,8 @@ struct pvr2_hdw { | |||
283 | 283 | ||
284 | /* Minor numbers used by v4l logic (yes, this is a hack, as there | 284 | /* Minor numbers used by v4l logic (yes, this is a hack, as there |
285 | should be no v4l junk here). Probably a better way to do this. */ | 285 | should be no v4l junk here). Probably a better way to do this. */ |
286 | int v4l_minor_number_mpeg; | 286 | int v4l_minor_number_video; |
287 | int v4l_minor_number_vbi; | ||
287 | int v4l_minor_number_radio; | 288 | int v4l_minor_number_radio; |
288 | 289 | ||
289 | /* Location of eeprom or a negative number if none */ | 290 | /* Location of eeprom or a negative number if none */ |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 6acd73ca9ed3..39d04d8644a8 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -1898,7 +1898,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
1898 | 1898 | ||
1899 | hdw->eeprom_addr = -1; | 1899 | hdw->eeprom_addr = -1; |
1900 | hdw->unit_number = -1; | 1900 | hdw->unit_number = -1; |
1901 | hdw->v4l_minor_number_mpeg = -1; | 1901 | hdw->v4l_minor_number_video = -1; |
1902 | hdw->v4l_minor_number_vbi = -1; | ||
1902 | hdw->v4l_minor_number_radio = -1; | 1903 | hdw->v4l_minor_number_radio = -1; |
1903 | hdw->ctl_write_buffer = kmalloc(PVR2_CTL_BUFFSIZE,GFP_KERNEL); | 1904 | hdw->ctl_write_buffer = kmalloc(PVR2_CTL_BUFFSIZE,GFP_KERNEL); |
1904 | if (!hdw->ctl_write_buffer) goto fail; | 1905 | if (!hdw->ctl_write_buffer) goto fail; |
@@ -2548,11 +2549,12 @@ int pvr2_hdw_cpufw_get(struct pvr2_hdw *hdw,unsigned int offs, | |||
2548 | 2549 | ||
2549 | 2550 | ||
2550 | int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw, | 2551 | int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw, |
2551 | enum pvr2_config index) | 2552 | enum pvr2_v4l_type index) |
2552 | { | 2553 | { |
2553 | switch (index) { | 2554 | switch (index) { |
2554 | case pvr2_config_mpeg: return hdw->v4l_minor_number_mpeg; | 2555 | case pvr2_v4l_type_video: return hdw->v4l_minor_number_video; |
2555 | case pvr2_config_radio: return hdw->v4l_minor_number_radio; | 2556 | case pvr2_v4l_type_vbi: return hdw->v4l_minor_number_vbi; |
2557 | case pvr2_v4l_type_radio: return hdw->v4l_minor_number_radio; | ||
2556 | default: return -1; | 2558 | default: return -1; |
2557 | } | 2559 | } |
2558 | } | 2560 | } |
@@ -2560,11 +2562,12 @@ int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw, | |||
2560 | 2562 | ||
2561 | /* Store a v4l minor device number */ | 2563 | /* Store a v4l minor device number */ |
2562 | void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw, | 2564 | void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw, |
2563 | enum pvr2_config index,int v) | 2565 | enum pvr2_v4l_type index,int v) |
2564 | { | 2566 | { |
2565 | switch (index) { | 2567 | switch (index) { |
2566 | case pvr2_config_mpeg: hdw->v4l_minor_number_mpeg = v; | 2568 | case pvr2_v4l_type_video: hdw->v4l_minor_number_video = v; |
2567 | case pvr2_config_radio: hdw->v4l_minor_number_radio = v; | 2569 | case pvr2_v4l_type_vbi: hdw->v4l_minor_number_vbi = v; |
2570 | case pvr2_v4l_type_radio: hdw->v4l_minor_number_radio = v; | ||
2568 | default: break; | 2571 | default: break; |
2569 | } | 2572 | } |
2570 | } | 2573 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index fa3769a244a1..19af4d636c3f 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h | |||
@@ -78,6 +78,12 @@ enum pvr2_config { | |||
78 | pvr2_config_radio, | 78 | pvr2_config_radio, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | enum pvr2_v4l_type { | ||
82 | pvr2_v4l_type_video, | ||
83 | pvr2_v4l_type_vbi, | ||
84 | pvr2_v4l_type_radio, | ||
85 | }; | ||
86 | |||
81 | const char *pvr2_config_get_name(enum pvr2_config); | 87 | const char *pvr2_config_get_name(enum pvr2_config); |
82 | 88 | ||
83 | struct pvr2_hdw; | 89 | struct pvr2_hdw; |
@@ -206,11 +212,11 @@ int pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs, | |||
206 | char *buf,unsigned int cnt); | 212 | char *buf,unsigned int cnt); |
207 | 213 | ||
208 | /* Retrieve a previously stored v4l minor device number */ | 214 | /* Retrieve a previously stored v4l minor device number */ |
209 | int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_config index); | 215 | int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index); |
210 | 216 | ||
211 | /* Store a v4l minor device number */ | 217 | /* Store a v4l minor device number */ |
212 | void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *, | 218 | void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *, |
213 | enum pvr2_config index,int); | 219 | enum pvr2_v4l_type index,int); |
214 | 220 | ||
215 | /* Direct read/write access to chip's registers: | 221 | /* Direct read/write access to chip's registers: |
216 | chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx) | 222 | chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx) |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 0f8021e2dd06..a3af24320e73 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -733,7 +733,7 @@ static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf) | |||
733 | if (!sfp) return -EINVAL; | 733 | if (!sfp) return -EINVAL; |
734 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 734 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
735 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 735 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
736 | pvr2_config_mpeg)); | 736 | pvr2_v4l_type_video)); |
737 | } | 737 | } |
738 | 738 | ||
739 | 739 | ||
@@ -745,7 +745,7 @@ static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev, | |||
745 | if (!sfp) return -EINVAL; | 745 | if (!sfp) return -EINVAL; |
746 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 746 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
747 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 747 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
748 | pvr2_config_radio)); | 748 | pvr2_v4l_type_radio)); |
749 | } | 749 | } |
750 | 750 | ||
751 | 751 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 4acbbc71f7e0..3a2a0ca33e90 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
@@ -725,9 +725,11 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) | |||
725 | static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) | 725 | static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) |
726 | { | 726 | { |
727 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, | 727 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, |
728 | pvr2_config_mpeg,-1); | 728 | pvr2_v4l_type_video,-1); |
729 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, | 729 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, |
730 | pvr2_config_radio,-1); | 730 | pvr2_v4l_type_vbi,-1); |
731 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, | ||
732 | pvr2_v4l_type_radio,-1); | ||
731 | pvr2_v4l2_dev_destroy(vp->vdev); | 733 | pvr2_v4l2_dev_destroy(vp->vdev); |
732 | 734 | ||
733 | pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); | 735 | pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); |
@@ -1072,6 +1074,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, | |||
1072 | int mindevnum; | 1074 | int mindevnum; |
1073 | int unit_number; | 1075 | int unit_number; |
1074 | int v4l_type; | 1076 | int v4l_type; |
1077 | enum pvr2_v4l_type pvt; | ||
1075 | dip->v4lp = vp; | 1078 | dip->v4lp = vp; |
1076 | dip->config = cfg; | 1079 | dip->config = cfg; |
1077 | 1080 | ||
@@ -1079,13 +1082,16 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, | |||
1079 | switch (cfg) { | 1082 | switch (cfg) { |
1080 | case pvr2_config_mpeg: | 1083 | case pvr2_config_mpeg: |
1081 | v4l_type = VFL_TYPE_GRABBER; | 1084 | v4l_type = VFL_TYPE_GRABBER; |
1085 | pvt = pvr2_v4l_type_video; | ||
1082 | dip->stream = &vp->channel.mc_head->video_stream; | 1086 | dip->stream = &vp->channel.mc_head->video_stream; |
1083 | break; | 1087 | break; |
1084 | case pvr2_config_vbi: | 1088 | case pvr2_config_vbi: |
1085 | v4l_type = VFL_TYPE_VBI; | 1089 | v4l_type = VFL_TYPE_VBI; |
1090 | pvt = pvr2_v4l_type_vbi; | ||
1086 | break; | 1091 | break; |
1087 | case pvr2_config_radio: | 1092 | case pvr2_config_radio: |
1088 | v4l_type = VFL_TYPE_RADIO; | 1093 | v4l_type = VFL_TYPE_RADIO; |
1094 | pvt = pvr2_v4l_type_radio; | ||
1089 | break; | 1095 | break; |
1090 | default: | 1096 | default: |
1091 | /* Bail out (this should be impossible) */ | 1097 | /* Bail out (this should be impossible) */ |
@@ -1133,7 +1139,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, | |||
1133 | } | 1139 | } |
1134 | 1140 | ||
1135 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, | 1141 | pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, |
1136 | cfg,dip->devbase.minor); | 1142 | pvt,dip->devbase.minor); |
1137 | } | 1143 | } |
1138 | 1144 | ||
1139 | 1145 | ||