From 07e337eeab3660559cbe1fee6907d1092037aea7 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 30 Jun 2006 11:30:20 -0300 Subject: [PATCH] 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 Signed-off-by: Mauro Carvalho Chehab --- .../media/video/pvrusb2/pvrusb2-debugifc.c | 4 +- .../video/pvrusb2/pvrusb2-hdw-internal.h | 17 --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 114 +++++++----------- drivers/media/video/pvrusb2/pvrusb2-hdw.h | 32 ----- .../media/video/pvrusb2/pvrusb2-i2c-core.c | 22 ++-- .../media/video/pvrusb2/pvrusb2-i2c-core.h | 3 - drivers/media/video/pvrusb2/pvrusb2-io.c | 39 +----- drivers/media/video/pvrusb2/pvrusb2-io.h | 13 -- drivers/media/video/pvrusb2/pvrusb2-ioread.c | 8 +- drivers/media/video/pvrusb2/pvrusb2-ioread.h | 1 - drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 16 +-- 11 files changed, 74 insertions(+), 195 deletions(-) diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c index 586900e365..8092b239cf 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c +++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c @@ -337,8 +337,8 @@ int pvr2_debugifc_print_status(struct pvr2_hdw *hdw, } -int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf, - unsigned int count) +static int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf, + unsigned int count) { const char *wptr; unsigned int wlen; diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index ba2afbfe32..0d6dc33ca3 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -354,23 +354,6 @@ struct pvr2_hdw { unsigned int control_cnt; }; -int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw); - -unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *); - -void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk,unsigned long val); -void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk, - unsigned long val); - -void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); -void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); - -int pvr2_i2c_basic_op(struct pvr2_hdw *,u8 i2c_addr, - u8 *wdata,u16 wlen, - u8 *rdata,u16 rlen); - #endif /* __PVRUSB2_HDW_INTERNAL_H */ /* diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index c6105bce4f..9638591cc0 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[] = { }; static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = 0}; -DECLARE_MUTEX(pvr2_unit_sem); +static DECLARE_MUTEX(pvr2_unit_sem); static int ctlchg = 0; static int initusbreset = 1; @@ -261,6 +261,25 @@ static const char *control_values_subsystem[] = { [PVR2_SUBSYS_B_ENC_RUN] = "enc_run", }; +static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); +static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw); +static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw); +static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw); +static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); +static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); +static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw); +static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val); +static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val); +static int pvr2_send_request_ex(struct pvr2_hdw *hdw, + unsigned int timeout,int probe_fl, + void *write_data,unsigned int write_len, + void *read_data,unsigned int read_len); +static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res); +static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res); static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp) { @@ -834,14 +853,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw) } -struct pvr2_hdw *pvr2_hdw_find(int unit_number) -{ - if (unit_number < 0) return 0; - if (unit_number >= PVR_NUM) return 0; - return unit_pointers[unit_number]; -} - - int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) { return hdw->unit_number; @@ -915,7 +926,7 @@ static int pvr2_locate_firmware(struct pvr2_hdw *hdw, * is not suitable for an usb transaction. * */ -int pvr2_upload_firmware1(struct pvr2_hdw *hdw) +static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) { const struct firmware *fw_entry = 0; void *fw_ptr; @@ -1164,8 +1175,9 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) reconfigure and start over. */ -void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk,unsigned long val) +static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val) { unsigned long nmsk; unsigned long vmsk; @@ -1316,18 +1328,6 @@ void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw, } -void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk) -{ - pvr2_hdw_subsys_bit_chg(hdw,msk,msk); -} - - -void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk) -{ - pvr2_hdw_subsys_bit_chg(hdw,msk,0); -} - - unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *hdw) { return hdw->subsys_enabled_mask; @@ -1340,9 +1340,9 @@ unsigned long pvr2_hdw_subsys_stream_get(struct pvr2_hdw *hdw) } -void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk, - unsigned long val) +static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val) { unsigned long val2; msk &= PVR2_SUBSYS_ALL; @@ -1364,7 +1364,7 @@ void pvr2_hdw_subsys_stream_bit_chg(struct pvr2_hdw *hdw, } -int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl) +static int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl) { if ((!enableFl) == !(hdw->flag_streaming_enabled)) return 0; if (enableFl) { @@ -1398,8 +1398,8 @@ int pvr2_hdw_set_streaming(struct pvr2_hdw *hdw,int enable_flag) } -int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw, - enum pvr2_config config) +static int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw, + enum pvr2_config config) { unsigned long sm = hdw->subsys_enabled_mask; if (!hdw->flag_ok) return -EIO; @@ -1926,7 +1926,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, /* Remove _all_ associations between this driver and the underlying USB layer. */ -void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) +static void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) { if (hdw->flag_disconnected) return; 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) // Attempt to autoselect an appropriate value for std_enum_cur given // whatever is currently in std_mask_cur -void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) +static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) { unsigned int idx; for (idx = 1; idx < hdw->std_enum_cnt; idx++) { @@ -2031,7 +2031,7 @@ void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) // Calculate correct set of enumerated standards based on currently known // set of available standards bits. -void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) +static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) { struct v4l2_standard *newstd; unsigned int std_cnt; @@ -2180,7 +2180,7 @@ static const char *get_ctrl_typename(enum pvr2_ctl_type tp) state(s) back to their previous value before this function was called. Thus we can automatically reconfigure affected pieces of the driver as controls are changed. */ -int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) +static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) { unsigned long saved_subsys_mask = hdw->subsys_enabled_mask; unsigned long stale_subsys_mask = 0; @@ -2319,14 +2319,6 @@ void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *hdw) } -void pvr2_hdw_poll_trigger(struct pvr2_hdw *hdw) -{ - LOCK_TAKE(hdw->big_lock); do { - pvr2_hdw_poll_trigger_unlocked(hdw); - } while (0); LOCK_GIVE(hdw->big_lock); -} - - /* Return name for this driver instance */ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) { @@ -2335,7 +2327,7 @@ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) /* Return bit mask indicating signal status */ -unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw) +static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw) { unsigned int msk = 0; switch (hdw->input_val) { @@ -2517,22 +2509,6 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,int v) } -void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw) -{ - if (!hdw->usb_dev) return; - usb_settoggle(hdw->usb_dev, PVR2_CTL_WRITE_ENDPOINT & 0xf, - !(PVR2_CTL_WRITE_ENDPOINT & USB_DIR_IN), 0); - usb_settoggle(hdw->usb_dev, PVR2_CTL_READ_ENDPOINT & 0xf, - !(PVR2_CTL_READ_ENDPOINT & USB_DIR_IN), 0); - usb_clear_halt(hdw->usb_dev, - usb_rcvbulkpipe(hdw->usb_dev, - PVR2_CTL_READ_ENDPOINT & 0x7f)); - usb_clear_halt(hdw->usb_dev, - usb_sndbulkpipe(hdw->usb_dev, - PVR2_CTL_WRITE_ENDPOINT & 0x7f)); -} - - static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs) { struct pvr2_hdw *hdw = urb->context; @@ -2566,10 +2542,10 @@ static void pvr2_ctl_timeout(unsigned long data) } -int pvr2_send_request_ex(struct pvr2_hdw *hdw, - unsigned int timeout,int probe_fl, - void *write_data,unsigned int write_len, - void *read_data,unsigned int read_len) +static int pvr2_send_request_ex(struct pvr2_hdw *hdw, + unsigned int timeout,int probe_fl, + void *write_data,unsigned int write_len, + void *read_data,unsigned int read_len) { unsigned int idx; int status = 0; @@ -2824,7 +2800,7 @@ int pvr2_write_register(struct pvr2_hdw *hdw, u16 reg, u32 data) } -int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) +static int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) { int ret = 0; @@ -2848,7 +2824,7 @@ int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) } -int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) +static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) { int ret; @@ -2865,7 +2841,7 @@ int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) } -int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) +static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) { int ret; @@ -2881,7 +2857,7 @@ int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) } -void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw) +static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw) { if (!hdw->flag_ok) return; pvr2_trace(PVR2_TRACE_INIT,"render_useless"); @@ -2994,7 +2970,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw) } -int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) +static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) { int status; LOCK_TAKE(hdw->ctl_lock); do { @@ -3092,7 +3068,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val) } -int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) +static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) { int result; LOCK_TAKE(hdw->ctl_lock); do { diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 63f5291544..fd931b5da4 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -91,7 +91,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, void pvr2_hdw_poll(struct pvr2_hdw *); /* Trigger a poll to take place later at a convenient time */ -void pvr2_hdw_poll_trigger(struct pvr2_hdw *); void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *); /* Register a callback used to trigger a future poll */ @@ -99,9 +98,6 @@ void pvr2_hdw_setup_poll_trigger(struct pvr2_hdw *, void (*func)(void *), void *data); -/* Get pointer to structure given unit number */ -struct pvr2_hdw *pvr2_hdw_find(int unit_number); - /* Destroy hardware interaction structure */ void pvr2_hdw_destroy(struct pvr2_hdw *); @@ -180,12 +176,6 @@ int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw,struct v4l2_standard *std, void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw, unsigned long msk,unsigned long val); -/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,msk) */ -void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk); - -/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,0) */ -void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk); - /* Retrieve mask indicating which pieces of hardware are currently enabled / configured. */ unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *); @@ -225,34 +215,18 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int); /* The following entry points are all lower level things you normally don't want to worry about. */ -/* Attempt to recover from a USB foul-up (in practice I find that if you - have to do this, then it's already too late). */ -void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw); - /* Issue a command and get a response from the device. LOTS of higher level stuff is built on this. */ int pvr2_send_request(struct pvr2_hdw *, void *write_ptr,unsigned int write_len, void *read_ptr,unsigned int read_len); -/* Issue a command and get a response from the device. This extended - version includes a probe flag (which if set means that device errors - should not be logged or treated as fatal) and a timeout in jiffies. - This can be used to non-lethally probe the health of endpoint 1. */ -int pvr2_send_request_ex(struct pvr2_hdw *,unsigned int timeout,int probe_fl, - void *write_ptr,unsigned int write_len, - void *read_ptr,unsigned int read_len); - /* Slightly higher level device communication functions. */ int pvr2_write_register(struct pvr2_hdw *, u16, u32); -int pvr2_read_register(struct pvr2_hdw *, u16, u32 *); -int pvr2_write_u16(struct pvr2_hdw *, u16, int); -int pvr2_write_u8(struct pvr2_hdw *, u8, int); /* Call if for any reason we can't talk to the hardware anymore - this will cause the driver to stop flailing on the device. */ void pvr2_hdw_render_useless(struct pvr2_hdw *); -void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *); /* Set / clear 8051's reset bit */ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int); @@ -271,12 +245,6 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *); /* Order decoder to reset */ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *); -/* Stop / start video stream transport */ -int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); - -/* Find I2C address of eeprom */ -int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *); - /* Direct manipulation of GPIO bits */ int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *); int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *); diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index c8d0bdee3f..eca48c90b5 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c @@ -37,6 +37,10 @@ static unsigned int i2c_scan = 0; module_param(i2c_scan, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); +static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, + unsigned int detail, + char *buf,unsigned int maxlen); + static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ u8 i2c_addr, /* I2C address we're talking to */ u8 *data, /* Data to write */ @@ -165,12 +169,12 @@ static int pvr2_i2c_read(struct pvr2_hdw *hdw, /* Context */ /* This is the common low level entry point for doing I2C operations to the hardware. */ -int pvr2_i2c_basic_op(struct pvr2_hdw *hdw, - u8 i2c_addr, - u8 *wdata, - u16 wlen, - u8 *rdata, - u16 rlen) +static int pvr2_i2c_basic_op(struct pvr2_hdw *hdw, + u8 i2c_addr, + u8 *wdata, + u16 wlen, + u8 *rdata, + u16 rlen) { if (!rdata) rlen = 0; if (!wdata) wlen = 0; @@ -705,9 +709,9 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw) return (hdw->i2c_pend_types & PVR2_I2C_PEND_ALL) != 0; } -unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, - unsigned int detail, - char *buf,unsigned int maxlen) +static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, + unsigned int detail, + char *buf,unsigned int maxlen) { unsigned int ccnt,bcnt; int spcfl = 0; diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h index e8af5b0ed3..6d7e252475 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h @@ -75,9 +75,6 @@ unsigned int pvr2_i2c_report(struct pvr2_hdw *,char *buf,unsigned int maxlen); PVR2_I2C_DETAIL_DEBUG |\ PVR2_I2C_DETAIL_HANDLER |\ PVR2_I2C_DETAIL_CTLMASK) -unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *, - unsigned int detail_mask, - char *buf,unsigned int maxlen); void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *); const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx); diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c index a984c91f57..c032777a97 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.c +++ b/drivers/media/video/pvrusb2/pvrusb2-io.c @@ -93,7 +93,7 @@ struct pvr2_buffer { struct urb *purb; }; -const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) +static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) { switch (st) { case pvr2_buffer_state_none: return "none"; @@ -104,7 +104,8 @@ const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) return "unknown"; } -void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) +#ifdef SANITY_CHECK_BUFFERS +static void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) { pvr2_trace(PVR2_TRACE_INFO, "buffer%s%s %p state=%s id=%d status=%d" @@ -119,6 +120,7 @@ void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) (bp ? bp->purb : 0), (bp ? bp->signature : 0)); } +#endif /* SANITY_CHECK_BUFFERS */ static void pvr2_buffer_remove(struct pvr2_buffer *bp) { @@ -513,10 +515,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp, } /* Query / set the nominal buffer count */ -int pvr2_stream_get_buffer_count(struct pvr2_stream *sp) -{ - return sp->buffer_target_count; -} int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) { @@ -555,17 +553,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp) return sp->r_count; } -int pvr2_stream_get_idle_count(struct pvr2_stream *sp) -{ - return sp->i_count; -} - -void pvr2_stream_flush(struct pvr2_stream *sp) -{ - mutex_lock(&sp->mutex); do { - pvr2_stream_internal_flush(sp); - } while(0); mutex_unlock(&sp->mutex); -} void pvr2_stream_kill(struct pvr2_stream *sp) { @@ -620,20 +607,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp) return ret; } -int pvr2_buffer_idle(struct pvr2_buffer *bp) -{ - struct pvr2_stream *sp; - if (!bp) return -EINVAL; - sp = bp->stream; - mutex_lock(&sp->mutex); do { - pvr2_buffer_wipe(bp); - pvr2_buffer_set_idle(bp); - if (sp->buffer_total_count != sp->buffer_target_count) { - pvr2_stream_achieve_buffer_count(sp); - } - } while(0); mutex_unlock(&sp->mutex); - return 0; -} int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) { @@ -673,10 +646,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp) return bp->status; } -enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *bp) -{ - return bp->state; -} int pvr2_buffer_get_id(struct pvr2_buffer *bp) { diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.h b/drivers/media/video/pvrusb2/pvrusb2-io.h index 65e11385b2..96285ad234 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.h +++ b/drivers/media/video/pvrusb2/pvrusb2-io.h @@ -36,8 +36,6 @@ enum pvr2_buffer_state { struct pvr2_stream; struct pvr2_buffer; -const char *pvr2_buffer_state_decode(enum pvr2_buffer_state); - /* Initialize / tear down stream structure */ struct pvr2_stream *pvr2_stream_create(void); void pvr2_stream_destroy(struct pvr2_stream *); @@ -49,7 +47,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *, void *data); /* Query / set the nominal buffer count */ -int pvr2_stream_get_buffer_count(struct pvr2_stream *); int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); /* Get a pointer to a buffer that is either idle, ready, or is specified @@ -59,12 +56,8 @@ struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *); struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id); /* Find out how many buffers are idle or ready */ -int pvr2_stream_get_idle_count(struct pvr2_stream *); int pvr2_stream_get_ready_count(struct pvr2_stream *); -/* Kill all pending operations */ -void pvr2_stream_flush(struct pvr2_stream *); - /* Kill all pending buffers and throw away any ready buffers as well */ void pvr2_stream_kill(struct pvr2_stream *); @@ -77,18 +70,12 @@ unsigned int pvr2_buffer_get_count(struct pvr2_buffer *); /* Retrieve completion code for given ready buffer */ int pvr2_buffer_get_status(struct pvr2_buffer *); -/* Retrieve state of given buffer */ -enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *); - /* Retrieve ID of given buffer */ int pvr2_buffer_get_id(struct pvr2_buffer *); /* Start reading into given buffer (kill it if needed) */ int pvr2_buffer_queue(struct pvr2_buffer *); -/* Move buffer back to idle pool (kill it if needed) */ -int pvr2_buffer_idle(struct pvr2_buffer *); - #endif /* __PVRUSB2_IO_H */ /* diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c index 49da062e32..4dce1a462f 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c @@ -251,12 +251,8 @@ int pvr2_ioread_set_enabled(struct pvr2_ioread *cp,int fl) return ret; } -int pvr2_ioread_get_enabled(struct pvr2_ioread *cp) -{ - return cp->enabled != 0; -} -int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) +static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) { int stat; @@ -307,7 +303,7 @@ int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) return !0; } -void pvr2_ioread_filter(struct pvr2_ioread *cp) +static void pvr2_ioread_filter(struct pvr2_ioread *cp) { unsigned int idx; if (!cp->enabled) return; diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.h b/drivers/media/video/pvrusb2/pvrusb2-ioread.h index 6b002597f5..1d362f8335 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.h +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.h @@ -33,7 +33,6 @@ void pvr2_ioread_set_sync_key(struct pvr2_ioread *, const char *sync_key_ptr, unsigned int sync_key_len); int pvr2_ioread_set_enabled(struct pvr2_ioread *,int fl); -int pvr2_ioread_get_enabled(struct pvr2_ioread *); int pvr2_ioread_read(struct pvr2_ioread *,void __user *buf,unsigned int cnt); int pvr2_ioread_avail(struct pvr2_ioread *); diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 59f5ef5558..b12c2a7f13 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -81,7 +81,7 @@ static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1}; module_param_array(video_nr, int, NULL, 0444); MODULE_PARM_DESC(video_nr, "Offset for device's minor"); -struct v4l2_capability pvr_capability ={ +static struct v4l2_capability pvr_capability ={ .driver = "pvrusb2", .card = "Hauppauge WinTV pvr-usb2", .bus_info = "usb", @@ -111,7 +111,7 @@ static struct v4l2_tuner pvr_v4l2_tuners[]= { } }; -struct v4l2_fmtdesc pvr_fmtdesc [] = { +static struct v4l2_fmtdesc pvr_fmtdesc [] = { { .index = 0, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, @@ -127,7 +127,7 @@ struct v4l2_fmtdesc pvr_fmtdesc [] = { #define PVR_FORMAT_PIX 0 #define PVR_FORMAT_VBI 1 -struct v4l2_format pvr_format [] = { +static struct v4l2_format pvr_format [] = { [PVR_FORMAT_PIX] = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, .fmt = { @@ -724,7 +724,7 @@ static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) } -void pvr2_v4l2_internal_check(struct pvr2_channel *chp) +static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) { struct pvr2_v4l2 *vp; vp = container_of(chp,struct pvr2_v4l2,channel); @@ -734,8 +734,8 @@ void pvr2_v4l2_internal_check(struct pvr2_channel *chp) } -int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) { /* Temporary hack : use ivtv api until a v4l2 one is available. */ @@ -746,7 +746,7 @@ int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, } -int pvr2_v4l2_release(struct inode *inode, struct file *file) +static int pvr2_v4l2_release(struct inode *inode, struct file *file) { struct pvr2_v4l2_fh *fhp = file->private_data; struct pvr2_v4l2 *vp = fhp->vhead; @@ -793,7 +793,7 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file) } -int pvr2_v4l2_open(struct inode *inode, struct file *file) +static int pvr2_v4l2_open(struct inode *inode, struct file *file) { struct pvr2_v4l2_dev *dip = 0; /* Our own context pointer */ struct pvr2_v4l2_fh *fhp; -- 2.39.5