Skip to content

Commit

Permalink
V4L/DVB (7607): CodingStyle fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Douglas Schilling Landgraf authored and Mauro Carvalho Chehab committed Apr 24, 2008
1 parent e6a353b commit 6ea54d9
Show file tree
Hide file tree
Showing 7 changed files with 240 additions and 188 deletions.
4 changes: 2 additions & 2 deletions drivers/media/video/em28xx/em28xx-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,10 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table);

/* Board Hauppauge WinTV HVR 900 analog */
struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
{ -1, -1, 6},
{ -1, -1, 6},
{0x08, 0x2d, 10},
{0x08, 0x3d, 5},
{ -1, -1, -1},
{ -1, -1, -1},
};
/* Board Hauppauge WinTV HVR 900 digital */
struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
Expand Down
63 changes: 39 additions & 24 deletions drivers/media/video/em28xx/em28xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0x0000, reg, buf, len, HZ);

if (reg_debug){
if (reg_debug) {
printk(ret < 0 ? " failed!\n" : "%02x values: ", ret);
for (byte = 0; byte < len; byte++) {
printk(" %02x", (unsigned char)buf[byte]);
}
printk("\n");
for (byte = 0; byte < len; byte++)
printk(KERN_INFO " %02x", (unsigned char)buf[byte]);

printk(KERN_INFO "\n");
}

return ret;
Expand Down Expand Up @@ -143,8 +143,8 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
if (reg_debug) {
int i;
for (i = 0; i < len; ++i)
printk (" %02x", (unsigned char)buf[i]);
printk ("\n");
printk(KERN_INFO " %02x", (unsigned char)buf[i]);
printk(KERN_INFO "\n");
}

if (!bufs)
Expand Down Expand Up @@ -173,8 +173,12 @@ static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
{
int oldval;
u8 newval;
if ((oldval = em28xx_read_reg(dev, reg)) < 0)

oldval = em28xx_read_reg(dev, reg);

if (oldval < 0)
return oldval;

newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
return em28xx_write_regs(dev, reg, &newval, 1);
}
Expand All @@ -187,20 +191,26 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
{
int ret, i;
u8 addr = reg & 0x7f;
if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0)

ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2);
if (ret < 0)
return ret;
if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0)

ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1);
if (ret < 0)
return ret;

/* Wait up to 50 ms for AC97 command to complete */
for (i = 0; i < 10; i++) {
if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
ret = em28xx_read_reg(dev, AC97BUSY_REG);
if (ret < 0)
return ret;

if (!(ret & 0x01))
return 0;
msleep(5);
}
em28xx_warn ("AC97 command still being executed: not handled properly!\n");
em28xx_warn("AC97 command still being executed: not handled properly!\n");
return 0;
}

Expand Down Expand Up @@ -338,11 +348,11 @@ int em28xx_capture_start(struct em28xx *dev, int start)
rc = em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);

if (dev->mode == EM28XX_ANALOG_MODE)
rc = em28xx_write_regs(dev, VINENABLE_REG,"\x67", 1);
rc = em28xx_write_regs(dev, VINENABLE_REG, "\x67", 1);
else
rc = em28xx_write_regs(dev, VINENABLE_REG,"\x37", 1);
rc = em28xx_write_regs(dev, VINENABLE_REG, "\x37", 1);

msleep (6);
msleep(6);

return rc;
}
Expand All @@ -357,7 +367,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev)
static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
u8 ymin, u8 ymax)
{
em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax);
em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n",
xmin, ymin, xmax, ymax);

em28xx_write_regs(dev, XMIN_REG, &xmin, 1);
em28xx_write_regs(dev, XMAX_REG, &xmax, 1);
Expand All @@ -372,7 +383,8 @@ static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
u8 cheight = height;
u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01);

em28xx_coredbg("em28xx Area Set: (%d,%d)\n", (width | (overflow & 2) << 7),
em28xx_coredbg("em28xx Area Set: (%d,%d)\n",
(width | (overflow & 2) << 7),
(height | (overflow & 1) << 8));

em28xx_write_regs(dev, HSTART_REG, &hstart, 1);
Expand All @@ -386,7 +398,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
{
u8 mode;
/* the em2800 scaler only supports scaling down to 50% */
if(dev->is_em2800)
if (dev->is_em2800)
mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00);
else {
u8 buf[2];
Expand All @@ -396,7 +408,8 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
buf[0] = v;
buf[1] = v >> 8;
em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
/* it seems that both H and V scalers must be active to work correctly */
/* it seems that both H and V scalers must be active
to work correctly */
mode = (h || v)? 0x30: 0x00;
}
return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30);
Expand Down Expand Up @@ -449,7 +462,7 @@ int em28xx_set_alternate(struct em28xx *dev)
dev->alt, dev->max_pkt_size);
errCode = usb_set_interface(dev->udev, 0, dev->alt);
if (errCode < 0) {
em28xx_errdev ("cannot change alternate number to %d (error=%i)\n",
em28xx_errdev("cannot change alternate number to %d (error=%i)\n",
dev->alt, errCode);
return errCode;
}
Expand Down Expand Up @@ -507,9 +520,9 @@ void em28xx_uninit_isoc(struct em28xx *dev)
usb_unlink_urb(urb);
if (dev->isoc_ctl.transfer_buffer[i]) {
usb_buffer_free(dev->udev,
urb->transfer_buffer_length,
dev->isoc_ctl.transfer_buffer[i],
urb->transfer_dma);
urb->transfer_buffer_length,
dev->isoc_ctl.transfer_buffer[i],
urb->transfer_dma);
}
usb_free_urb(urb);
dev->isoc_ctl.urb[i] = NULL;
Expand Down Expand Up @@ -596,7 +609,9 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets,
'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK'
should also be using 'desc.bInterval'
*/
pipe = usb_rcvisocpipe(dev->udev, cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);
pipe = usb_rcvisocpipe(dev->udev,
cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);

usb_fill_int_urb(urb, dev->udev, pipe,
dev->isoc_ctl.transfer_buffer[i], sb_size,
em28xx_irq_callback, dma_q, 1);
Expand Down
29 changes: 17 additions & 12 deletions drivers/media/video/em28xx/em28xx-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static inline void print_err_status(struct em28xx *dev,
if (packet < 0) {
dprintk(1, "URB status %d [%s].\n", status, errmsg);
} else {
dprintk(1, "URB packet %d, status %d [%s].\n", packet, status, errmsg);
dprintk(1, "URB packet %d, status %d [%s].\n",
packet, status, errmsg);
}
}

Expand Down Expand Up @@ -134,18 +135,20 @@ static inline int dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
return 0;
}

static int start_streaming(struct em28xx_dvb* dvb) {
static int start_streaming(struct em28xx_dvb *dvb)
{
struct em28xx *dev = dvb->adapter.priv;

usb_set_interface(dev->udev, 0, 1);
dev->em28xx_write_regs_req(dev,0x00,0x48,"\x00",1);
dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);

return em28xx_init_isoc(dev, EM28XX_DVB_MAX_PACKETS,
EM28XX_DVB_NUM_BUFS, EM28XX_DVB_MAX_PACKETSIZE,
dvb_isoc_copy, EM28XX_DIGITAL_CAPTURE);
}

static int stop_streaming(struct em28xx_dvb* dvb) {
static int stop_streaming(struct em28xx_dvb *dvb)
{
struct em28xx *dev = dvb->adapter.priv;

em28xx_uninit_isoc(dev);
Expand All @@ -167,7 +170,8 @@ static int start_feed(struct dvb_demux_feed *feed)

if (dvb->nfeeds == 1) {
ret = start_streaming(dvb);
if(ret < 0) rc = ret;
if (ret < 0)
rc = ret;
}

mutex_unlock(&dvb->lock);
Expand All @@ -182,9 +186,10 @@ static int stop_feed(struct dvb_demux_feed *feed)

mutex_lock(&dvb->lock);
dvb->nfeeds--;
if (0 == dvb->nfeeds) {

if (0 == dvb->nfeeds)
err = stop_streaming(dvb);
}

mutex_unlock(&dvb->lock);
return err;
}
Expand Down Expand Up @@ -212,7 +217,7 @@ static int attach_xc3028(u8 addr, struct em28xx *dev)
struct xc2028_ctrl ctl;
struct xc2028_config cfg;

memset (&cfg, 0, sizeof(cfg));
memset(&cfg, 0, sizeof(cfg));
cfg.i2c_adap = &dev->i2c_adap;
cfg.i2c_addr = addr;
cfg.ctrl = &ctl;
Expand Down Expand Up @@ -360,8 +365,9 @@ static int dvb_init(struct em28xx *dev)
struct em28xx_dvb *dvb;

dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
if(dvb == NULL) {
printk("em28xx_dvb: memory allocation failed\n");

if (dvb == NULL) {
printk(KERN_INFO "em28xx_dvb: memory allocation failed\n");
return -ENOMEM;
}
dev->dvb = dvb;
Expand Down Expand Up @@ -410,9 +416,8 @@ static int dvb_init(struct em28xx *dev)
/* register everything */
result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);

if (result < 0) {
if (result < 0)
goto out_free;
}

printk(KERN_INFO "Successfully loaded em28xx-dvb\n");
return 0;
Expand Down
Loading

0 comments on commit 6ea54d9

Please sign in to comment.