cx231xx: Paranoic stack memory save
Subsystems (2)
PATCH RESEND 1/8 cx231xx: Paranoic stack memory save
Saves 255 bytes of stack memory on cx231xx_usb_probe() by removing a char array.
Tested by compilation only.
--- drivers/media/video/cx231xx/cx231xx-cards.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/media/video/cx231xx/cx231xx-cards.c +3 -14
@@ -1023,7 +1023,6 @@ static int cx231xx_usb_probe(struct usb_interface *interface,int nr =0 , ifnum;int i, isoc_pipe =0 ;char *speed; -char descr[255 ] ="" ;struct usb_interface_assoc_descriptor *assoc_desc; udev =usb_get_dev (interface_to_usbdev (interface));
@@ -1098,20 +1097,10 @@ static int cx231xx_usb_probe(struct usb_interface *interface, speed ="unknown" ; } -if (udev->manufacturer) -strlcpy (descr, udev->manufacturer,sizeof (descr)); - -if (udev->product) { -if (*descr) -strlcat (descr," " ,sizeof (descr)); -strlcat (descr, udev->product,sizeof (descr)); - } -if (*descr) -strlcat (descr," " ,sizeof (descr)); - - cx231xx_info("New device %s@ %s Mbps " + cx231xx_info("New device %s %s @ %s Mbps " "(%04x:%04x) with %d interfaces\n", - descr, + udev->manufacturer ? udev->manufacturer : "", + udev->product ? udev->product : "", speed, le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idProduct),
Signature · 1 line
1.7.10.2
PATCH RESEND 2/8 pvrusb2: Variables set but not used
Tested by compilation only.
--- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/media/video/pvrusb2/pvrusb2-v4l2.c +0 -8
@@ -226,13 +226,11 @@ static int pvr2_enum_input(struct file *file, void *priv, struct v4l2_input *vi)struct v4l2_input tmp;unsigned int cnt;int val; -int ret; cptr =pvr2_hdw_get_ctrl_by_id (hdw,PVR2_CID_INPUT );memset (&tmp,0 ,sizeof (tmp)); tmp.index = vi->index; - ret =0 ;if (vi->index >= fh->input_cnt)return -EINVAL ; val = fh->input_map[vi->index];
@@ -556,9 +554,7 @@ static int pvr2_queryctrl(struct file *file, void *priv,struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;struct pvr2_ctrl *cptr;int val; -int ret; - ret =0 ;if (vc->id &V4L2_CTRL_FLAG_NEXT_CTRL ) { cptr =pvr2_hdw_get_ctrl_nextv4l ( hdw, (vc->id & ~V4L2_CTRL_FLAG_NEXT_CTRL ));
@@ -705,11 +701,9 @@ static int pvr2_try_ext_ctrls(struct file *file, void *priv,struct v4l2_ext_control *ctrl;struct pvr2_ctrl *pctl;unsigned int idx; -int ret;/* For the moment just validate that the requested control actually exists. */ - ret =0 ;for (idx =0 ; idx < ctls->count; idx++) { ctrl = ctls->controls + idx; pctl =pvr2_hdw_get_ctrl_v4l (hdw, ctrl->id);
@@ -770,12 +764,10 @@ static int pvr2_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) {struct pvr2_v4l2_fh *fh = file->private_data;struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; -struct v4l2_cropcap cap;int ret;if (crop->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE )return -EINVAL ; - cap.type =V4L2_BUF_TYPE_VIDEO_CAPTURE ; ret =pvr2_ctrl_set_value (pvr2_hdw_get_ctrl_by_id (hdw,PVR2_CID_CROPL ), crop->c.left);
Signature · 1 line
1.7.10.2
PATCH RESEND 3/8 saa7146: Variable set but not used
In reply to Peter Senna TschudinIn function fops_open variable type was set but not used.
Tested by compilation only.
--- drivers/media/common/saa7146_fops.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/common/saa7146_fops.c +0 -5
@@ -198,7 +198,6 @@ static int fops_open(struct file *file)struct saa7146_dev *dev =video_drvdata (file);struct saa7146_fh *fh =NULL ;int result =0 ; -enum v4l2_buf_type type;DEB_EE ("file:%p, dev:%s\n" , file,video_device_node_name (vdev));
@@ -207,10 +206,6 @@ static int fops_open(struct file *file)DEB_D ("using: %p\n" , dev); - type = vdev->vfl_type ==VFL_TYPE_GRABBER - ?V4L2_BUF_TYPE_VIDEO_CAPTURE - :V4L2_BUF_TYPE_VBI_CAPTURE ; -/* check if an extension is registered */ if (NULL == dev->ext ) {DEB_S ("no extension registered for this device\n" );
Signature · 1 line
1.7.10.2
Re: [PATCH 3/8] [RESEND] saa7146: Variable set but not used
Hello Peter,
on 14.06.2012 19:58 Peter Senna Tschudin said the following:
Quoted 1 line
In function
fops_openvariable type was set but not used.
thanks for your patch, but I think it does not work.
Quoted 20 lines
Tested by compilation only.
Signed-off-by Peter Senna Tschudin <[email protected]>--- drivers/media/common/saa7146_fops.c | 5 ----- 1 file changed, 5 deletions(-)drivers/media/common/saa7146_fops.c +0
-1@@ -198,7 +198,6 @@ static int fops_open(struct file *file)struct saa7146_dev *dev =video_drvdata (file);struct saa7146_fh *fh =NULL ;int result =0 ; -enum v4l2_buf_type type;DEB_EE ("file:%p, dev:%s\n" , file,video_device_node_name (vdev));
drivers/media/common/saa7146_fops.c static int fops_open(struct file *file) · line 211
Quoted 10 lines
drivers/media/common/saa7146_fops.c +0
-4@@ -207,10 +206,6 @@ static int fops_open(struct file *file)DEB_D ("using: %p\n" , dev); - type = vdev->vfl_type ==VFL_TYPE_GRABBER - ?V4L2_BUF_TYPE_VIDEO_CAPTURE - :V4L2_BUF_TYPE_VBI_CAPTURE ; -/* check if an extension is registered */ if (NULL == dev->ext ) {DEB_S ("no extension registered for this device\n" );
A few lines below "fh" is allocated and "fh->type" is set to "type". Simply removing "type" will result in a compilation error IMO, so I wonder if your compile-test really worked.
Can you have a look again?
CU
Michael.
Re: [PATCH 3/8] [RESEND] saa7146: Variable set but not used
Quoted 42 lines · Michael Hunold
Hello Peter,
on 14.06.2012 19:58 Peter Senna Tschudin said the following:
Quoted 1 line
In function
fops_openvariable type was set but not used.thanks for your patch, but I think it does not work.
Quoted 20 lines
Tested by compilation only.
Signed-off-by Peter Senna Tschudin<[email protected]>--- drivers/media/common/saa7146_fops.c | 5 ----- 1 file changed, 5 deletions(-)drivers/media/common/saa7146_fops.c +0
-1@@ -198,7 +198,6 @@ static int fops_open(struct file *file)struct saa7146_dev *dev =video_drvdata (file);struct saa7146_fh *fh =NULL ;int result =0 ; -enum v4l2_buf_type type;DEB_EE ("file:%p, dev:%s\n" , file,video_device_node_name (vdev));drivers/media/common/saa7146_fops.c static int fops_open(struct file *file) · line 211
Quoted 10 lines
drivers/media/common/saa7146_fops.c +0
-4@@ -207,10 +206,6 @@ static int fops_open(struct file *file)DEB_D ("using: %p\n" , dev); - type = vdev->vfl_type ==VFL_TYPE_GRABBER - ?V4L2_BUF_TYPE_VIDEO_CAPTURE - :V4L2_BUF_TYPE_VBI_CAPTURE ; -/* check if an extension is registered */ if (NULL == dev->ext ) {DEB_S ("no extension registered for this device\n" );A few lines below "fh" is allocated and "
fh->type" is set to "type". Simply removing "type" will result in a compilation error IMO, so I wonder if your compile-test really worked.
Quoted 1 line
Can you have a look again?
Are you perhaps looking at an older version of this source? 'fh->type' no longer exists. Anyway, this patch is correct.
Regards,
Hans
Re: [PATCH 3/8] [RESEND] saa7146: Variable set but not used
Hello Hans,
on 15.06.2012 08:24 Hans Verkuil said the following:
Quoted 9 lines · Michael Hunold
Quoted 6 lines
A few lines below "fh" is allocated and "
fh->type" is set to "type". Simply removing "type" will result in a compilation error IMO, so I wonder if your compile-test really worked.Can you have a look again?
Are you perhaps looking at an older version of this source?
most likely. :-/
Quoted 4 lines
'
fh->type'
no longer exists.Anyway, this patch is correct.
Ok, then feel free to pick it. :-)
Quoted 3 lines
Regards,
Hans
Best regards
Michael.
PATCH RESEND 4/8 saa7164: Variable set but not used
In reply to Peter Senna TschudinIn function saa7164_api_i2c_read variable regval was set but not used.
Tested by compilation only.
--- drivers/media/video/saa7164/saa7164-api.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/media/video/saa7164/saa7164-api.c +0 -14
@@ -1367,7 +1367,6 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg,struct saa7164_dev *dev = bus->dev;u16 len =0 ;int unitid; -u32 regval;u8 buf[256 ];int ret;
@@ -1376,19 +1375,6 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg,if (reglen >4 )return -EIO ; -if (reglen ==1 ) - regval = *(reg); -else -if (reglen ==2 ) - regval = ((*(reg) <<8 ) || *(reg+1 )); -else -if (reglen ==3 ) - regval = ((*(reg) <<16 ) | (*(reg+1 ) <<8 ) | *(reg+2 )); -else -if (reglen ==4 ) - regval = ((*(reg) <<24 ) | (*(reg+1 ) <<16 ) | - (*(reg+2 ) <<8 ) | *(reg+3 )); -/* Prepare the send buffer */ /* Bytes 00-03 source register length * 04-07 source bytes to read
Signature · 1 line
1.7.10.2
PATCH 5/8 nuvoton-cir: Code cleanup: remove unused variable and function
In reply to Peter Senna TschudinTested by compilation only.
--- drivers/media/rc/nuvoton-cir.c | 37 ------------------------------------- 1 file changed, 37 deletions(-)
drivers/media/rc/nuvoton-cir.c +0 -37
@@ -473,39 +473,6 @@ static void nvt_enable_wake(struct nvt_dev *nvt)nvt_cir_wake_reg_write (nvt,0 ,CIR_WAKE_IREN ); } -/* rx carrier detect only works in learning mode, must be called w/nvt_lock */ -static u32 nvt_rx_carrier_detect (struct nvt_dev *nvt) -{ -u32 count, carrier, duration =0 ; -int i; - - count =nvt_cir_reg_read (nvt,CIR_FCCL ) | -nvt_cir_reg_read (nvt,CIR_FCCH ) <<8 ; - -for (i =0 ; i < nvt->pkts; i++) { -if (nvt->buf[i] &BUF_PULSE_BIT ) - duration += nvt->buf[i] &BUF_LEN_MASK ; - } - - duration *=SAMPLE_PERIOD ; - -if (!count || !duration) { -nvt_pr (KERN_NOTICE ,"Unable to determine carrier! (c:%u, d:%u)" , - count, duration); -return 0 ; - } - - carrier =MS_TO_NS (count) / duration; - -if ((carrier >MAX_CARRIER ) || (carrier <MIN_CARRIER )) -nvt_dbg ("WTF? Carrier frequency out of range!" ); - -nvt_dbg ("Carrier frequency: %u (count %u, duration %u)" , - carrier, count, duration); - -return carrier; -} -/* * set carrier frequency *
@@ -618,7 +585,6 @@ static void nvt_dump_rx_buf(struct nvt_dev *nvt)static void nvt_process_rx_ir_data (struct nvt_dev *nvt) {DEFINE_IR_RAW_EVENT (rawir); -u32 carrier;u8 sample;int i;
@@ -627,9 +593,6 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt)if (debug)nvt_dump_rx_buf (nvt); -if (nvt->carrier_detect_enabled) - carrier =nvt_rx_carrier_detect (nvt); -nvt_dbg_verbose ("Processing buffer of len %d" , nvt->pkts);init_ir_raw_event (&rawir);
Signature · 1 line
1.7.10.2
Re: [PATCH 5/8] nuvoton-cir: Code cleanup: remove unused variable and function
Quoted 1 line · Peter Senna Tschudin
Tested by compilation only.
[...]
I can't say whether this is correct since I never used the driver either, but the function you remove is reading registers so it may have important side-effects.
Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert CamusRe: [PATCH 5/8] nuvoton-cir: Code cleanup: remove unused variable and function
In reply to Peter Senna TschudinQuoted 1 line · Peter Senna Tschudin
Tested by compilation only.
Making use of this code is on the TODO list, possibly even happens by way of David's pending patches for lirc interface parity, so I'm against removing it.
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 6/8 stv0367: variable 'tps_rcvd' set but not used
In reply to Peter Senna TschudinTested by compilation only.
--- drivers/media/dvb/frontends/stv0367.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/dvb/frontends/stv0367.c +1 -4
@@ -1584,7 +1584,7 @@ static int stv0367ter_algo(struct dvb_frontend *fe)struct stv0367ter_state *ter_state = state->ter_state;int offset =0 , tempo =0 ;u8 u_var; -u8 /*constell,*/ counter, tps_rcvd[2 ]; +u8 /*constell,*/ counter;s8 step;s32 timing_offset =0 ;u32 trl_nomrate =0 , InternalFreq =0 , temp =0 ;
@@ -1709,9 +1709,6 @@ static int stv0367ter_algo(struct dvb_frontend *fe)return 0 ; ter_state->state =FE_TER_LOCKOK ; -/* update results */ - tps_rcvd[0 ] =stv0367_readreg (state,R367TER_TPS_RCVD2 ); - tps_rcvd[1 ] =stv0367_readreg (state,R367TER_TPS_RCVD3 ); ter_state->mode =stv0367_readbits (state,F367TER_SYR_MODE ); ter_state->guard =stv0367_readbits (state,F367TER_SYR_GUARD );
Signature · 1 line
1.7.10.2
PATCH 7/8 stv090x: variable 'no_signal' set but not used
In reply to Peter Senna TschudinTested by compilation only.
--- drivers/media/dvb/frontends/stv090x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/media/dvb/frontends/stv090x.c +3 -4
@@ -3172,7 +3172,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)enum stv090x_signal_state signal_state = STV090x_NOCARRIER;u32 reg;s32 agc1_power, power_iq =0 , i; -int lock =0 , low_sr =0 , no_signal =0 ; +int lock =0 , low_sr =0 ; reg =STV090x_READ_DEMOD (state,TSCFGH );STV090x_SETFIELD_Px (reg,RST_HWARE_FIELD ,1 );/* Stop path 1 stream merger */
@@ -3411,10 +3411,9 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)/* Reset the packet Error counter2 */ if (STV090x_WRITE_DEMOD (state,ERRCTRL2 ,0xc1 ) <0 ) goto err; - }else { + }else signal_state = STV090x_NODATA; - no_signal =stv090x_chk_signal (state); - } + }return signal_state;
Signature · 1 line
1.7.10.2
PATCH 8/8 s5h1420: Unused variable clock_setting
In reply to Peter Senna TschudinThe switch/case was setting clock_setting that is not being used. Both switch/case and the variable definition were removed.
Currently clock is being calculated by the formula:
(state->fclk/1000000 - 8)
Tested by compilation only.
--- drivers/media/dvb/frontends/s5h1420.c | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/media/dvb/frontends/s5h1420.c +0 -20
@@ -634,7 +634,6 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe)struct s5h1420_state * state = fe->demodulator_priv;int frequency_delta;struct dvb_frontend_tune_settings fesettings; -uint8_t clock_setting;dprintk ("enter %s\n" , __func__);
@@ -679,25 +678,6 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe)else state->fclk =44000000 ; -/* Clock */ -switch (state->fclk) { -default : -case 88000000 : - clock_setting =80 ; -break ; -case 86000000 : - clock_setting =78 ; -break ; -case 80000000 : - clock_setting =72 ; -break ; -case 59000000 : - clock_setting =51 ; -break ; -case 44000000 : - clock_setting =36 ; -break ; - }dprintk ("pll01: %d, ToneFreq: %d\n" , state->fclk/1000000 -8 , (state->fclk + (TONE_FREQ *32 ) -1 ) / (TONE_FREQ *32 ));s5h1420_writereg (state,PLL01 , state->fclk/1000000 -8 );s5h1420_writereg (state,PLL02 ,0x40 );
Signature · 1 line
1.7.10.2