Skip to content

Commit

Permalink
V4L/DVB (8757): v4l-dvb: fix a bunch of sparse warnings
Browse files Browse the repository at this point in the history
Fixed a lot of sparse warnings: mostly warnings about shadowed variables
and signed/unsigned mismatches.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Sep 3, 2008
1 parent 980d4f1 commit c6eb8ea
Show file tree
Hide file tree
Showing 23 changed files with 146 additions and 131 deletions.
4 changes: 1 addition & 3 deletions drivers/media/common/saa7146_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
{
v4l2_std_id *id = arg;
int found = 0;
int i, err;
int i;

DEB_EE(("VIDIOC_S_STD\n"));

Expand Down Expand Up @@ -1116,7 +1116,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
case VIDIOC_OVERLAY:
{
int on = *(int *)arg;
int err = 0;

DEB_D(("VIDIOC_OVERLAY on:%d\n",on));
if (on != 0) {
Expand Down Expand Up @@ -1192,7 +1191,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
case VIDIOCGMBUF:
{
struct video_mbuf *mbuf = arg;
struct videobuf_queue *q;
int i;

/* fixme: number of capture buffers and sizes for v4l apps */
Expand Down
33 changes: 17 additions & 16 deletions drivers/media/common/tuners/tuner-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static struct tuner_params *simple_tuner_params(struct dvb_frontend *fe,

static int simple_config_lookup(struct dvb_frontend *fe,
struct tuner_params *t_params,
int *frequency, u8 *config, u8 *cb)
unsigned *frequency, u8 *config, u8 *cb)
{
struct tuner_simple_priv *priv = fe->tuner_priv;
int i;
Expand Down Expand Up @@ -587,45 +587,45 @@ static int simple_set_tv_freq(struct dvb_frontend *fe,
priv->last_div = div;
if (t_params->has_tda9887) {
struct v4l2_priv_tun_config tda9887_cfg;
int config = 0;
int tda_config = 0;
int is_secam_l = (params->std & (V4L2_STD_SECAM_L |
V4L2_STD_SECAM_LC)) &&
!(params->std & ~(V4L2_STD_SECAM_L |
V4L2_STD_SECAM_LC));

tda9887_cfg.tuner = TUNER_TDA9887;
tda9887_cfg.priv = &config;
tda9887_cfg.priv = &tda_config;

if (params->std == V4L2_STD_SECAM_LC) {
if (t_params->port1_active ^ t_params->port1_invert_for_secam_lc)
config |= TDA9887_PORT1_ACTIVE;
tda_config |= TDA9887_PORT1_ACTIVE;
if (t_params->port2_active ^ t_params->port2_invert_for_secam_lc)
config |= TDA9887_PORT2_ACTIVE;
tda_config |= TDA9887_PORT2_ACTIVE;
} else {
if (t_params->port1_active)
config |= TDA9887_PORT1_ACTIVE;
tda_config |= TDA9887_PORT1_ACTIVE;
if (t_params->port2_active)
config |= TDA9887_PORT2_ACTIVE;
tda_config |= TDA9887_PORT2_ACTIVE;
}
if (t_params->intercarrier_mode)
config |= TDA9887_INTERCARRIER;
tda_config |= TDA9887_INTERCARRIER;
if (is_secam_l) {
if (i == 0 && t_params->default_top_secam_low)
config |= TDA9887_TOP(t_params->default_top_secam_low);
tda_config |= TDA9887_TOP(t_params->default_top_secam_low);
else if (i == 1 && t_params->default_top_secam_mid)
config |= TDA9887_TOP(t_params->default_top_secam_mid);
tda_config |= TDA9887_TOP(t_params->default_top_secam_mid);
else if (t_params->default_top_secam_high)
config |= TDA9887_TOP(t_params->default_top_secam_high);
tda_config |= TDA9887_TOP(t_params->default_top_secam_high);
} else {
if (i == 0 && t_params->default_top_low)
config |= TDA9887_TOP(t_params->default_top_low);
tda_config |= TDA9887_TOP(t_params->default_top_low);
else if (i == 1 && t_params->default_top_mid)
config |= TDA9887_TOP(t_params->default_top_mid);
tda_config |= TDA9887_TOP(t_params->default_top_mid);
else if (t_params->default_top_high)
config |= TDA9887_TOP(t_params->default_top_high);
tda_config |= TDA9887_TOP(t_params->default_top_high);
}
if (t_params->default_pll_gating_18)
config |= TDA9887_GATING_18;
tda_config |= TDA9887_GATING_18;
i2c_clients_command(priv->i2c_props.adap, TUNER_SET_CONFIG,
&tda9887_cfg);
}
Expand Down Expand Up @@ -813,7 +813,8 @@ static u32 simple_dvb_configure(struct dvb_frontend *fe, u8 *buf,
static struct tuner_params *t_params;
u8 config, cb;
u32 div;
int ret, frequency = params->frequency / 62500;
int ret;
unsigned frequency = params->frequency / 62500;

t_params = simple_tuner_params(fe, TUNER_PARAM_TYPE_DIGITAL);
ret = simple_config_lookup(fe, t_params, &frequency, &config, &cb);
Expand Down
1 change: 0 additions & 1 deletion drivers/media/dvb/dvb-core/dmxdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter)
struct timespec timeout = { 0 };
struct dmx_pes_filter_params *para = &filter->params.pes;
dmx_output_t otype;
int ret;
int ts_type;
enum dmx_ts_pes ts_pes;
struct dmx_ts_feed **tsfeed = &filter->feed.ts;
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/dvb/dvb-core/dvb_ca_en50221.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ static int dvb_ca_en50221_thread(void *data)
/* we need this extra check for annoying interfaces like the budget-av */
if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) &&
(ca->pub->poll_slot_status)) {
int status = ca->pub->poll_slot_status(ca->pub, slot, 0);
status = ca->pub->poll_slot_status(ca->pub, slot, 0);
if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) {
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE;
dvb_ca_en50221_thread_update_delay(ca);
Expand Down Expand Up @@ -1089,7 +1089,7 @@ static int dvb_ca_en50221_thread(void *data)
/* we need this extra check for annoying interfaces like the budget-av */
if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) &&
(ca->pub->poll_slot_status)) {
int status = ca->pub->poll_slot_status(ca->pub, slot, 0);
status = ca->pub->poll_slot_status(ca->pub, slot, 0);
if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) {
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE;
dvb_ca_en50221_thread_update_delay(ca);
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/dvb/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,13 +889,13 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
* initialization, so parg is 8 bits and does not
* include the initialization or start bit
*/
unsigned long cmd = ((unsigned long) parg) << 1;
unsigned long swcmd = ((unsigned long) parg) << 1;
struct timeval nexttime;
struct timeval tv[10];
int i;
u8 last = 1;
if (dvb_frontend_debug)
printk("%s switch command: 0x%04lx\n", __func__, cmd);
printk("%s switch command: 0x%04lx\n", __func__, swcmd);
do_gettimeofday(&nexttime);
if (dvb_frontend_debug)
memcpy(&tv[0], &nexttime, sizeof(struct timeval));
Expand All @@ -908,12 +908,12 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
for (i = 0; i < 9; i++) {
if (dvb_frontend_debug)
do_gettimeofday(&tv[i + 1]);
if ((cmd & 0x01) != last) {
if ((swcmd & 0x01) != last) {
/* set voltage to (last ? 13V : 18V) */
fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18);
last = (last) ? 0 : 1;
}
cmd = cmd >> 1;
swcmd = swcmd >> 1;
if (i != 8)
dvb_frontend_sleep_until(&nexttime, 8000);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb/dvb-usb/cxusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
if (d->state == DVB_USB_STATE_INIT &&
usb_set_interface(d->udev, 0, 0) < 0)
err("set interface failed");
do; while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
!(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) &&
!(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0);
if (!ret) {
Expand Down
26 changes: 13 additions & 13 deletions drivers/media/radio/radio-maxiradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,28 +156,28 @@ static void set_freq(__u16 io, __u32 freq)
{
unsigned long int si;
int bl;
int data = FREQ2BITS(freq);
int val = FREQ2BITS(freq);

/* TEA5757 shift register bits (see pdf) */

outbit(0,io); // 24 search
outbit(1,io); // 23 search up/down
outbit(0, io); /* 24 search */
outbit(1, io); /* 23 search up/down */

outbit(0,io); // 22 stereo/mono
outbit(0, io); /* 22 stereo/mono */

outbit(0,io); // 21 band
outbit(0,io); // 20 band (only 00=FM works I think)
outbit(0, io); /* 21 band */
outbit(0, io); /* 20 band (only 00=FM works I think) */

outbit(0,io); // 19 port ?
outbit(0,io); // 18 port ?
outbit(0, io); /* 19 port ? */
outbit(0, io); /* 18 port ? */

outbit(0,io); // 17 search level
outbit(0,io); // 16 search level
outbit(0, io); /* 17 search level */
outbit(0, io); /* 16 search level */

si = 0x8000;
for (bl = 1; bl <= 16 ; bl++) {
outbit(data & si,io);
si >>=1;
for (bl = 1; bl <= 16; bl++) {
outbit(val & si, io);
si >>= 1;
}

dprintk(1, "Radio freq set to %d.%02d MHz\n",
Expand Down
70 changes: 40 additions & 30 deletions drivers/media/video/bt8xx/bttv-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -3144,8 +3144,9 @@ static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])

static void flyvideo_gpio(struct bttv *btv)
{
int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
int tuner=UNSET,ttype;
int gpio, has_remote, has_radio, is_capture_only;
int is_lr90, has_tda9820_tda9821;
int tuner_type = UNSET, ttype;

gpio_inout(0xffffff, 0);
udelay(8); /* without this we would see the 0x1800 mask */
Expand All @@ -3163,20 +3164,26 @@ static void flyvideo_gpio(struct bttv *btv)
* xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
* Note: Some bits are Audio_Mask !
*/
ttype=(gpio&0x0f0000)>>16;
switch(ttype) {
case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */
ttype = (gpio & 0x0f0000) >> 16;
switch (ttype) {
case 0x0:
tuner_type = 2; /* NTSC, e.g. TPI8NSR11P */
break;
case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */
case 0x2:
tuner_type = 39; /* LG NTSC (newer TAPC series) TAPC-H701P */
break;
case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
case 0x4:
tuner_type = 5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
break;
case 0x6: tuner=37;/* LG PAL (newer TAPC series) TAPC-G702P */
case 0x6:
tuner_type = 37; /* LG PAL (newer TAPC series) TAPC-G702P */
break;
case 0xC: tuner=3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
case 0xC:
tuner_type = 3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
break;
default:
printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
break;
}

has_remote = gpio & 0x800000;
Expand All @@ -3189,23 +3196,26 @@ static void flyvideo_gpio(struct bttv *btv)
/*
* gpio & 0x001000 output bit for audio routing */

if(is_capture_only)
tuner = TUNER_ABSENT; /* No tuner present */
if (is_capture_only)
tuner_type = TUNER_ABSENT; /* No tuner present */

printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
btv->c.nr, has_radio ? "yes" : "no ",
has_remote ? "yes" : "no ", tuner_type, gpio);
printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
is_capture_only?"yes":"no ");
btv->c.nr, is_lr90 ? "yes" : "no ",
has_tda9820_tda9821 ? "yes" : "no ",
is_capture_only ? "yes" : "no ");

if (tuner != UNSET) /* only set if known tuner autodetected, else let insmod option through */
btv->tuner_type = tuner;
if (tuner_type != UNSET) /* only set if known tuner autodetected, else let insmod option through */
btv->tuner_type = tuner_type;
btv->has_radio = has_radio;

/* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
* LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
* Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
if(has_tda9820_tda9821) btv->audio_mode_gpio = lt9415_audio;
if (has_tda9820_tda9821)
btv->audio_mode_gpio = lt9415_audio;
/* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */
}

Expand Down Expand Up @@ -3962,32 +3972,32 @@ static int tuner_1_table[] = {

static void __devinit avermedia_eeprom(struct bttv *btv)
{
int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0;

tuner_make = (eeprom_data[0x41] & 0x7);
tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
btv->has_remote = (eeprom_data[0x42] & 0x01);

if (tuner_make == 0 || tuner_make == 2)
if(tuner_format <=0x0a)
tuner = tuner_0_table[tuner_format];
if (tuner_format <= 0x0a)
tuner_type = tuner_0_table[tuner_format];
if (tuner_make == 1)
if(tuner_format <=9)
tuner = tuner_1_table[tuner_format];
if (tuner_format <= 9)
tuner_type = tuner_1_table[tuner_format];

if (tuner_make == 4)
if(tuner_format == 0x09)
tuner = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */
if (tuner_format == 0x09)
tuner_type = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */

printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
if(tuner) {
btv->tuner_type=tuner;
printk("%d",tuner);
btv->c.nr, eeprom_data[0x41], eeprom_data[0x42]);
if (tuner_type) {
btv->tuner_type = tuner_type;
printk(KERN_CONT "%d", tuner_type);
} else
printk("Unknown type");
printk(" radio:%s remote control:%s\n",
printk(KERN_CONT "Unknown type");
printk(KERN_CONT " radio:%s remote control:%s\n",
tuner_tv_fm ? "yes" : "no",
btv->has_remote ? "yes" : "no");
}
Expand Down
1 change: 0 additions & 1 deletion drivers/media/video/bt8xx/bttv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ static unsigned int irq_iswitch;
static unsigned int uv_ratio = 50;
static unsigned int full_luma_range;
static unsigned int coring;
extern int no_overlay;

/* API features (turn on/off stuff for testing) */
static unsigned int v4l2 = 1;
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/bt8xx/bttv-risc.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
const struct bttv_format *fmt, struct bttv_overlay *ov,
int skip_even, int skip_odd)
{
int dwords,rc,line,maxy,start,end,skip,nskips;
int dwords, rc, line, maxy, start, end;
unsigned skip, nskips;
struct btcx_skiplist *skips;
__le32 *rp;
u32 ri,ra;
Expand Down
5 changes: 5 additions & 0 deletions drivers/media/video/bt8xx/bttvp.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ extern struct bus_type bttv_sub_bus_type;
int bttv_sub_add_device(struct bttv_core *core, char *name);
int bttv_sub_del_devices(struct bttv_core *core);

/* ---------------------------------------------------------- */
/* bttv-cards.c */

extern int no_overlay;

/* ---------------------------------------------------------- */
/* bttv-driver.c */

Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/btcx-risc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips)
}

void
btcx_calc_skips(int line, int width, unsigned int *maxy,
btcx_calc_skips(int line, int width, int *maxy,
struct btcx_skiplist *skips, unsigned int *nskips,
const struct v4l2_clip *clips, unsigned int nclips)
{
unsigned int clip,skip;
int end,maxline;
int end, maxline;

skip=0;
maxline = 9999;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/btcx-risc.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int btcx_screen_clips(int swidth, int sheight, struct v4l2_rect *win,
int btcx_align(struct v4l2_rect *win, struct v4l2_clip *clips,
unsigned int n, int mask);
void btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips);
void btcx_calc_skips(int line, int width, unsigned int *maxy,
void btcx_calc_skips(int line, int width, int *maxy,
struct btcx_skiplist *skips, unsigned int *nskips,
const struct v4l2_clip *clips, unsigned int nclips);

Expand Down
Loading

0 comments on commit c6eb8ea

Please sign in to comment.