aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-hdw.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2006-06-30 10:30:20 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-30 14:59:48 -0400
commit07e337eeab3660559cbe1fee6907d1092037aea7 (patch)
treed1960df404e80f7480c34a44f94ba599eb8df031 /drivers/media/video/pvrusb2/pvrusb2-hdw.c
parentc02a34f4e3e65a7b1fb64507ec5c093e8328335e (diff)
V4L/DVB (4287): Pvrusb2/: possible cleanups
This patch contains the following possible cleanups: - make needlessly global code static - #if 0 unused global functions Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c114
1 files changed, 45 insertions, 69 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index c6105bce4fe8..9638591cc06f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -88,7 +88,7 @@ static struct pvr2_string_table pvr2_client_lists[] = {
88}; 88};
89 89
90static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = 0}; 90static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = 0};
91DECLARE_MUTEX(pvr2_unit_sem); 91static DECLARE_MUTEX(pvr2_unit_sem);
92 92
93static int ctlchg = 0; 93static int ctlchg = 0;
94static int initusbreset = 1; 94static int initusbreset = 1;
@@ -261,6 +261,25 @@ static const char *control_values_subsystem[] = {
261 [PVR2_SUBSYS_B_ENC_RUN] = "enc_run", 261 [PVR2_SUBSYS_B_ENC_RUN] = "enc_run",
262}; 262};
263 263
264static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl);
265static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw);
266static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw);
267static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw);
268static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
269static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
270static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw);
271static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw,
272 unsigned long msk,
273 unsigned long val);
274static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw,
275 unsigned long msk,
276 unsigned long val);
277static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
278 unsigned int timeout,int probe_fl,
279 void *write_data,unsigned int write_len,
280 void *read_data,unsigned int read_len);
281static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res);
282static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res);
264 283
265static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp) 284static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp)
266{ 285{
@@ -834,14 +853,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw)
834} 853}
835 854
836 855
837struct pvr2_hdw *pvr2_hdw_find(int unit_number)
838{
839 if (unit_number < 0) return 0;
840 if (unit_number >= PVR_NUM) return 0;
841 return unit_pointers[unit_number];
842}
843
844
845int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) 856int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw)
846{ 857{
847 return hdw->unit_number; 858 return hdw->unit_number;
@@ -915,7 +926,7 @@ static int pvr2_locate_firmware(struct pvr2_hdw *hdw,
915 * is not suitable for an usb transaction. 926 * is not suitable for an usb transaction.
916 * 927 *
917 */ 928 */
918int pvr2_upload_firmware1(struct pvr2_hdw *hdw) 929static int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
919{ 930{
920 const struct firmware *fw_entry = 0; 931 const struct firmware *fw_entry = 0;
921 void *fw_ptr; 932 void *fw_ptr;
@@ -1164,8 +1175,9 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
1164 reconfigure and start over. 1175 reconfigure and start over.
1165 1176
1166*/ 1177*/
1167void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, 1178static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw,
1168 unsigned long msk,unsigned long val) 1179 unsigned long msk,
1180 unsigned long val)
1169{ 1181{
1170 unsigned long nmsk; 1182 unsigned long nmsk;
1171 unsigned long vmsk; 1183 unsigned long vmsk;
@@ -1316,18 +1328,6 @@ void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw,
1316} 1328}
1317 1329
1318 1330
1319void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk)
1320{
1321 pvr2_hdw_subsys_bit_chg(hdw,msk,msk);
1322}
1323
1324
1325void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk)
1326{
1327 pvr2_hdw_subsys_bit_chg(hdw,msk,0);
1328}
1329
1330
1331unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *hdw) 1331unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *hdw)
1332{ 1332{
1333 return hdw->subsys_enabled_mask; 1333 return hdw->subsys_enabled_mask;
@@ -1340,9 +1340,9 @@ unsigned long pvr2_hdw_subsys_stream_get(struct pvr2_hdw *hdw)
1340} 1340}
1341 1341
1342 1342
1343void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, 1343static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw,
1344 unsigned long msk, 1344 unsigned long msk,
1345 unsigned long val) 1345 unsigned long val)
1346{ 1346{
1347 unsigned long val2; 1347 unsigned long val2;
1348 msk &= PVR2_SUBSYS_ALL; 1348 msk &= PVR2_SUBSYS_ALL;
@@ -1364,7 +1364,7 @@ void pvr2_hdw_subsys_stream_bit_chg(struct pvr2_hdw *hdw,
1364} 1364}
1365 1365
1366 1366
1367int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl) 1367static int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl)
1368{ 1368{
1369 if ((!enableFl) == !(hdw->flag_streaming_enabled)) return 0; 1369 if ((!enableFl) == !(hdw->flag_streaming_enabled)) return 0;
1370 if (enableFl) { 1370 if (enableFl) {
@@ -1398,8 +1398,8 @@ int pvr2_hdw_set_streaming(struct pvr2_hdw *hdw,int enable_flag)
1398} 1398}
1399 1399
1400 1400
1401int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw, 1401static int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw,
1402 enum pvr2_config config) 1402 enum pvr2_config config)
1403{ 1403{
1404 unsigned long sm = hdw->subsys_enabled_mask; 1404 unsigned long sm = hdw->subsys_enabled_mask;
1405 if (!hdw->flag_ok) return -EIO; 1405 if (!hdw->flag_ok) return -EIO;
@@ -1926,7 +1926,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
1926 1926
1927/* Remove _all_ associations between this driver and the underlying USB 1927/* Remove _all_ associations between this driver and the underlying USB
1928 layer. */ 1928 layer. */
1929void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) 1929static void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw)
1930{ 1930{
1931 if (hdw->flag_disconnected) return; 1931 if (hdw->flag_disconnected) return;
1932 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_remove_usb_stuff: hdw=%p",hdw); 1932 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_remove_usb_stuff: hdw=%p",hdw);
@@ -2016,7 +2016,7 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw)
2016 2016
2017// Attempt to autoselect an appropriate value for std_enum_cur given 2017// Attempt to autoselect an appropriate value for std_enum_cur given
2018// whatever is currently in std_mask_cur 2018// whatever is currently in std_mask_cur
2019void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) 2019static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw)
2020{ 2020{
2021 unsigned int idx; 2021 unsigned int idx;
2022 for (idx = 1; idx < hdw->std_enum_cnt; idx++) { 2022 for (idx = 1; idx < hdw->std_enum_cnt; idx++) {
@@ -2031,7 +2031,7 @@ void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw)
2031 2031
2032// Calculate correct set of enumerated standards based on currently known 2032// Calculate correct set of enumerated standards based on currently known
2033// set of available standards bits. 2033// set of available standards bits.
2034void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) 2034static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw)
2035{ 2035{
2036 struct v4l2_standard *newstd; 2036 struct v4l2_standard *newstd;
2037 unsigned int std_cnt; 2037 unsigned int std_cnt;
@@ -2180,7 +2180,7 @@ static const char *get_ctrl_typename(enum pvr2_ctl_type tp)
2180 state(s) back to their previous value before this function was called. 2180 state(s) back to their previous value before this function was called.
2181 Thus we can automatically reconfigure affected pieces of the driver as 2181 Thus we can automatically reconfigure affected pieces of the driver as
2182 controls are changed. */ 2182 controls are changed. */
2183int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) 2183static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw)
2184{ 2184{
2185 unsigned long saved_subsys_mask = hdw->subsys_enabled_mask; 2185 unsigned long saved_subsys_mask = hdw->subsys_enabled_mask;
2186 unsigned long stale_subsys_mask = 0; 2186 unsigned long stale_subsys_mask = 0;
@@ -2319,14 +2319,6 @@ void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *hdw)
2319} 2319}
2320 2320
2321 2321
2322void pvr2_hdw_poll_trigger(struct pvr2_hdw *hdw)
2323{
2324 LOCK_TAKE(hdw->big_lock); do {
2325 pvr2_hdw_poll_trigger_unlocked(hdw);
2326 } while (0); LOCK_GIVE(hdw->big_lock);
2327}
2328
2329
2330/* Return name for this driver instance */ 2322/* Return name for this driver instance */
2331const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) 2323const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
2332{ 2324{
@@ -2335,7 +2327,7 @@ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
2335 2327
2336 2328
2337/* Return bit mask indicating signal status */ 2329/* Return bit mask indicating signal status */
2338unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw) 2330static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw)
2339{ 2331{
2340 unsigned int msk = 0; 2332 unsigned int msk = 0;
2341 switch (hdw->input_val) { 2333 switch (hdw->input_val) {
@@ -2517,22 +2509,6 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,int v)
2517} 2509}
2518 2510
2519 2511
2520void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw)
2521{
2522 if (!hdw->usb_dev) return;
2523 usb_settoggle(hdw->usb_dev, PVR2_CTL_WRITE_ENDPOINT & 0xf,
2524 !(PVR2_CTL_WRITE_ENDPOINT & USB_DIR_IN), 0);
2525 usb_settoggle(hdw->usb_dev, PVR2_CTL_READ_ENDPOINT & 0xf,
2526 !(PVR2_CTL_READ_ENDPOINT & USB_DIR_IN), 0);
2527 usb_clear_halt(hdw->usb_dev,
2528 usb_rcvbulkpipe(hdw->usb_dev,
2529 PVR2_CTL_READ_ENDPOINT & 0x7f));
2530 usb_clear_halt(hdw->usb_dev,
2531 usb_sndbulkpipe(hdw->usb_dev,
2532 PVR2_CTL_WRITE_ENDPOINT & 0x7f));
2533}
2534
2535
2536static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs) 2512static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs)
2537{ 2513{
2538 struct pvr2_hdw *hdw = urb->context; 2514 struct pvr2_hdw *hdw = urb->context;
@@ -2566,10 +2542,10 @@ static void pvr2_ctl_timeout(unsigned long data)
2566} 2542}
2567 2543
2568 2544
2569int pvr2_send_request_ex(struct pvr2_hdw *hdw, 2545static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
2570 unsigned int timeout,int probe_fl, 2546 unsigned int timeout,int probe_fl,
2571 void *write_data,unsigned int write_len, 2547 void *write_data,unsigned int write_len,
2572 void *read_data,unsigned int read_len) 2548 void *read_data,unsigned int read_len)
2573{ 2549{
2574 unsigned int idx; 2550 unsigned int idx;
2575 int status = 0; 2551 int status = 0;
@@ -2824,7 +2800,7 @@ int pvr2_write_register(struct pvr2_hdw *hdw, u16 reg, u32 data)
2824} 2800}
2825 2801
2826 2802
2827int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) 2803static int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data)
2828{ 2804{
2829 int ret = 0; 2805 int ret = 0;
2830 2806
@@ -2848,7 +2824,7 @@ int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data)
2848} 2824}
2849 2825
2850 2826
2851int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) 2827static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res)
2852{ 2828{
2853 int ret; 2829 int ret;
2854 2830
@@ -2865,7 +2841,7 @@ int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res)
2865} 2841}
2866 2842
2867 2843
2868int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) 2844static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res)
2869{ 2845{
2870 int ret; 2846 int ret;
2871 2847
@@ -2881,7 +2857,7 @@ int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res)
2881} 2857}
2882 2858
2883 2859
2884void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw) 2860static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw)
2885{ 2861{
2886 if (!hdw->flag_ok) return; 2862 if (!hdw->flag_ok) return;
2887 pvr2_trace(PVR2_TRACE_INIT,"render_useless"); 2863 pvr2_trace(PVR2_TRACE_INIT,"render_useless");
@@ -2994,7 +2970,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
2994} 2970}
2995 2971
2996 2972
2997int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) 2973static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl)
2998{ 2974{
2999 int status; 2975 int status;
3000 LOCK_TAKE(hdw->ctl_lock); do { 2976 LOCK_TAKE(hdw->ctl_lock); do {
@@ -3092,7 +3068,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val)
3092} 3068}
3093 3069
3094 3070
3095int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) 3071static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
3096{ 3072{
3097 int result; 3073 int result;
3098 LOCK_TAKE(hdw->ctl_lock); do { 3074 LOCK_TAKE(hdw->ctl_lock); do {