drivers/media/video/pvrusb2/: possible cleanups
PATCH 1/1 drivers/media/video/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 <[email protected]>
---
BTW: There are still tons of sparse warnings.
drivers/media/video/pvrusb2/pvrusb2-debugifc.c | 4 drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 17 -- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 84 ++++++++----- drivers/media/video/pvrusb2/pvrusb2-hdw.h | 32 ---- drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 22 ++- drivers/media/video/pvrusb2/pvrusb2-i2c-core.h | 3 drivers/media/video/pvrusb2/pvrusb2-io.c | 16 ++ drivers/media/video/pvrusb2/pvrusb2-io.h | 13 -- drivers/media/video/pvrusb2/pvrusb2-ioread.c | 6 drivers/media/video/pvrusb2/pvrusb2-ioread.h | 1 drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 16 +- 11 files changed, 94 insertions(+), 120 deletions(-)
drivers/media/video/pvrusb2/pvrusb2-debugifc.c renamed from drivers/media/video/pvrusb2/pvrusb2-debugifc.c.old +2 -2
@@ -337,8 +337,8 @@ } -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;
drivers/media/video/pvrusb2/pvrusb2-hdw.h renamed from drivers/media/video/pvrusb2/pvrusb2-hdw.h.old +0 -32
@@ -91,7 +91,6 @@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 (*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 @@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 @@/* 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 @@/* 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 *);
drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h renamed from drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h.old +0 -17
@@ -354,23 +354,6 @@ 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 */ /*
drivers/media/video/pvrusb2/pvrusb2-hdw.c renamed from drivers/media/video/pvrusb2/pvrusb2-hdw.c.old +53 -31
246 lines not on this page · raw message
drivers/media/video/pvrusb2/pvrusb2-i2c-core.h renamed from drivers/media/video/pvrusb2/pvrusb2-i2c-core.h.old +0 -3
@@ -75,9 +75,6 @@ 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);
drivers/media/video/pvrusb2/pvrusb2-i2c-core.c renamed from drivers/media/video/pvrusb2/pvrusb2-i2c-core.c.old +13 -9
@@ -37,6 +37,10 @@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 @@/* 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 @@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 ;
drivers/media/video/pvrusb2/pvrusb2-io.h renamed from drivers/media/video/pvrusb2/pvrusb2-io.h.old +0 -13
@@ -36,8 +36,6 @@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 *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_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 @@/* 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 */ /*
drivers/media/video/pvrusb2/pvrusb2-io.c renamed from drivers/media/video/pvrusb2/pvrusb2-io.c.old +14 -2
@@ -93,7 +93,7 @@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 @@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 @@ (bp ? bp->purb :0 ), (bp ? bp->signature : 0)); } +#endif /* SANITY_CHECK_BUFFERS */ static void pvr2_buffer_remove (struct pvr2_buffer *bp) {
@@ -513,10 +515,12 @@ }/* Query / set the nominal buffer count */ +#if 0 int pvr2_stream_get_buffer_count (struct pvr2_stream *sp) {return sp->buffer_target_count; } +#endif /* 0 */ int pvr2_stream_set_buffer_count (struct pvr2_stream *sp,unsigned int cnt) {
@@ -555,6 +559,8 @@return sp->r_count; } +#if 0 +int pvr2_stream_get_idle_count (struct pvr2_stream *sp) {return sp->i_count;
@@ -567,6 +573,8 @@ } while(0); mutex_unlock(&sp->mutex); } +#endif /* 0 */ +void pvr2_stream_kill (struct pvr2_stream *sp) {struct pvr2_buffer *bp;
@@ -620,6 +628,7 @@return ret; } +#if 0 int pvr2_buffer_idle (struct pvr2_buffer *bp) {struct pvr2_stream *sp;
@@ -634,6 +643,7 @@ } while(0); mutex_unlock(&sp->mutex);return 0 ; } +#endif /* 0 */ int pvr2_buffer_set_buffer (struct pvr2_buffer *bp,void *ptr,unsigned int cnt) {
@@ -673,10 +683,12 @@return bp->status; } +#if 0 enum pvr2_buffer_state pvr2_buffer_get_state (struct pvr2_buffer *bp) {return bp->state; } +#endif /* 0 */ int pvr2_buffer_get_id (struct pvr2_buffer *bp) {
drivers/media/video/pvrusb2/pvrusb2-ioread.h renamed from drivers/media/video/pvrusb2/pvrusb2-ioread.h.old +0 -1
@@ -33,7 +33,6 @@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 *);
drivers/media/video/pvrusb2/pvrusb2-ioread.c renamed from drivers/media/video/pvrusb2/pvrusb2-ioread.c.old +4 -2
@@ -251,12 +251,14 @@return ret; } +#if 0 int pvr2_ioread_get_enabled (struct pvr2_ioread *cp) {return cp->enabled !=0 ; } +#endif /* 0 */ -int pvr2_ioread_get_buffer (struct pvr2_ioread *cp) +static int pvr2_ioread_get_buffer (struct pvr2_ioread *cp) {int stat;
@@ -307,7 +309,7 @@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 ;
drivers/media/video/pvrusb2/pvrusb2-v4l2.c renamed from drivers/media/video/pvrusb2/pvrusb2-v4l2.c.old +8 -8
@@ -81,7 +81,7 @@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 @@ } }; -struct v4l2_fmtdesc pvr_fmtdesc [] = { +static struct v4l2_fmtdesc pvr_fmtdesc [] = { { .index =0 , .type =V4L2_BUF_TYPE_VIDEO_CAPTURE ,
@@ -127,7 +127,7 @@#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 = {
@@ -725,7 +725,7 @@ } -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);
@@ -735,8 +735,8 @@ } -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. */
@@ -747,7 +747,7 @@ } -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;
@@ -794,7 +794,7 @@ } -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;