Commit a1a6ee74 authored by Nicola Soranzo's avatar Nicola Soranzo Committed by Mauro Carvalho Chehab

V4L/DVB (10525): em28xx: Coding style fixes and a typo correction

Lots of coding style fixes and a typo correction for em28xx.

[dougsland@redhat.com: fixed a reject due to a change on em28xx-audio.c]
Signed-off-by: default avatarNicola Soranzo <nsoranzo@tiscali.it>
Signed-off-by: default avatarDouglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7aa0eabd
...@@ -245,7 +245,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, ...@@ -245,7 +245,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs,
{ {
struct snd_pcm_runtime *runtime = subs->runtime; struct snd_pcm_runtime *runtime = subs->runtime;
dprintk("Alocating vbuffer\n"); dprintk("Allocating vbuffer\n");
if (runtime->dma_area) { if (runtime->dma_area) {
if (runtime->dma_bytes > size) if (runtime->dma_bytes > size)
return 0; return 0;
...@@ -410,7 +410,6 @@ static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream ...@@ -410,7 +410,6 @@ static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream
*substream) *substream)
{ {
unsigned long flags; unsigned long flags;
struct em28xx *dev; struct em28xx *dev;
snd_pcm_uframes_t hwptr_done; snd_pcm_uframes_t hwptr_done;
......
...@@ -244,7 +244,7 @@ struct em28xx_board em28xx_boards[] = { ...@@ -244,7 +244,7 @@ struct em28xx_board em28xx_boards[] = {
.name = "Hauppauge WinTV USB 2", .name = "Hauppauge WinTV USB 2",
.tuner_type = TUNER_PHILIPS_FM1236_MK3, .tuner_type = TUNER_PHILIPS_FM1236_MK3,
.tda9887_conf = TDA9887_PRESENT | .tda9887_conf = TDA9887_PRESENT |
TDA9887_PORT1_ACTIVE| TDA9887_PORT1_ACTIVE |
TDA9887_PORT2_ACTIVE, TDA9887_PORT2_ACTIVE,
.decoder = EM28XX_TVP5150, .decoder = EM28XX_TVP5150,
.has_msp34xx = 1, .has_msp34xx = 1,
...@@ -1217,7 +1217,9 @@ struct em28xx_board em28xx_boards[] = { ...@@ -1217,7 +1217,9 @@ struct em28xx_board em28xx_boards[] = {
.has_dvb = 1, .has_dvb = 1,
.dvb_gpio = kworld_330u_digital, .dvb_gpio = kworld_330u_digital,
.xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_EEPROM_ON_BOARD | EM28XX_I2C_EEPROM_KEY_VALID, .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
EM28XX_I2C_EEPROM_ON_BOARD |
EM28XX_I2C_EEPROM_KEY_VALID,
.input = { { .input = { {
.type = EM28XX_VMUX_TELEVISION, .type = EM28XX_VMUX_TELEVISION,
.vmux = TVP5150_COMPOSITE0, .vmux = TVP5150_COMPOSITE0,
...@@ -1299,7 +1301,7 @@ struct em28xx_board em28xx_boards[] = { ...@@ -1299,7 +1301,7 @@ struct em28xx_board em28xx_boards[] = {
const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
/* table of devices that work with this driver */ /* table of devices that work with this driver */
struct usb_device_id em28xx_id_table [] = { struct usb_device_id em28xx_id_table[] = {
{ USB_DEVICE(0xeb1a, 0x2750), { USB_DEVICE(0xeb1a, 0x2750),
.driver_info = EM2750_BOARD_UNKNOWN }, .driver_info = EM2750_BOARD_UNKNOWN },
{ USB_DEVICE(0xeb1a, 0x2751), { USB_DEVICE(0xeb1a, 0x2751),
...@@ -1401,7 +1403,7 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table); ...@@ -1401,7 +1403,7 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table);
/* /*
* EEPROM hash table for devices with generic USB IDs * EEPROM hash table for devices with generic USB IDs
*/ */
static struct em28xx_hash_table em28xx_eeprom_hash [] = { static struct em28xx_hash_table em28xx_eeprom_hash[] = {
/* P/N: SA 60002070465 Tuner: TVF7533-MF */ /* P/N: SA 60002070465 Tuner: TVF7533-MF */
{0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF}, {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
{0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF}, {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
...@@ -1433,7 +1435,7 @@ int em28xx_tuner_callback(void *ptr, int component, int command, int arg) ...@@ -1433,7 +1435,7 @@ int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
} }
EXPORT_SYMBOL_GPL(em28xx_tuner_callback); EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
static void inline em28xx_set_model(struct em28xx *dev) static inline void em28xx_set_model(struct em28xx *dev)
{ {
memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board)); memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
/* #define ENABLE_DEBUG_ISOC_FRAMES */ /* #define ENABLE_DEBUG_ISOC_FRAMES */
static unsigned int core_debug; static unsigned int core_debug;
module_param(core_debug,int,0644); module_param(core_debug, int, 0644);
MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); MODULE_PARM_DESC(core_debug, "enable debug messages [core]");
#define em28xx_coredbg(fmt, arg...) do {\ #define em28xx_coredbg(fmt, arg...) do {\
if (core_debug) \ if (core_debug) \
...@@ -42,8 +42,8 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); ...@@ -42,8 +42,8 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]");
dev->name, __func__ , ##arg); } while (0) dev->name, __func__ , ##arg); } while (0)
static unsigned int reg_debug; static unsigned int reg_debug;
module_param(reg_debug,int,0644); module_param(reg_debug, int, 0644);
MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); MODULE_PARM_DESC(reg_debug, "enable debug messages [URB reg]");
#define em28xx_regdbg(fmt, arg...) do {\ #define em28xx_regdbg(fmt, arg...) do {\
if (reg_debug) \ if (reg_debug) \
...@@ -77,7 +77,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, ...@@ -77,7 +77,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
return -EINVAL; return -EINVAL;
if (reg_debug) { if (reg_debug) {
printk( KERN_DEBUG "(pipe 0x%08x): " printk(KERN_DEBUG "(pipe 0x%08x): "
"IN: %02x %02x %02x %02x %02x %02x %02x %02x ", "IN: %02x %02x %02x %02x %02x %02x %02x %02x ",
pipe, pipe,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
...@@ -154,7 +154,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, ...@@ -154,7 +154,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
if (reg_debug) { if (reg_debug) {
int byte; int byte;
printk( KERN_DEBUG "(pipe 0x%08x): " printk(KERN_DEBUG "(pipe 0x%08x): "
"OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>", "OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>",
pipe, pipe,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
...@@ -462,7 +462,8 @@ int em28xx_audio_analog_set(struct em28xx *dev) ...@@ -462,7 +462,8 @@ int em28xx_audio_analog_set(struct em28xx *dev)
if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) { if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) {
int sel = ac97_return_record_select(dev->ctl_aoutput); int sel = ac97_return_record_select(dev->ctl_aoutput);
/* Use the same input for both left and right channels */ /* Use the same input for both left and right
channels */
sel |= (sel << 8); sel |= (sel << 8);
em28xx_write_ac97(dev, AC97_RECORD_SELECT, sel); em28xx_write_ac97(dev, AC97_RECORD_SELECT, sel);
...@@ -698,7 +699,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) ...@@ -698,7 +699,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2); em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2);
/* it seems that both H and V scalers must be active /* it seems that both H and V scalers must be active
to work correctly */ to work correctly */
mode = (h || v)? 0x30: 0x00; mode = (h || v) ? 0x30 : 0x00;
} }
return em28xx_write_reg_bits(dev, EM28XX_R26_COMPR, mode, 0x30); return em28xx_write_reg_bits(dev, EM28XX_R26_COMPR, mode, 0x30);
} }
...@@ -958,7 +959,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, ...@@ -958,7 +959,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets,
em28xx_err("unable to allocate %i bytes for transfer" em28xx_err("unable to allocate %i bytes for transfer"
" buffer %i%s\n", " buffer %i%s\n",
sb_size, i, sb_size, i,
in_interrupt()?" while in int":""); in_interrupt() ? " while in int" : "");
em28xx_uninit_isoc(dev); em28xx_uninit_isoc(dev);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -402,10 +402,12 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) ...@@ -402,10 +402,12 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
dev->name); dev->name);
break; break;
case 2: case 2:
printk(KERN_INFO "%s:\tI2S audio, sample rate=32k\n", dev->name); printk(KERN_INFO "%s:\tI2S audio, sample rate=32k\n",
dev->name);
break; break;
case 3: case 3:
printk(KERN_INFO "%s:\tI2S audio, 3 sample rates\n", dev->name); printk(KERN_INFO "%s:\tI2S audio, 3 sample rates\n",
dev->name);
break; break;
} }
......
...@@ -186,7 +186,8 @@ static void em28xx_copy_video(struct em28xx *dev, ...@@ -186,7 +186,8 @@ static void em28xx_copy_video(struct em28xx *dev,
em28xx_isocdbg("Overflow of %zi bytes past buffer end (1)\n", em28xx_isocdbg("Overflow of %zi bytes past buffer end (1)\n",
((char *)startwrite + lencopy) - ((char *)startwrite + lencopy) -
((char *)outp + buf->vb.size)); ((char *)outp + buf->vb.size));
lencopy = remain = (char *)outp + buf->vb.size - (char *)startwrite; remain = (char *)outp + buf->vb.size - (char *)startwrite;
lencopy = remain;
} }
if (lencopy <= 0) if (lencopy <= 0)
return; return;
...@@ -202,7 +203,8 @@ static void em28xx_copy_video(struct em28xx *dev, ...@@ -202,7 +203,8 @@ static void em28xx_copy_video(struct em28xx *dev,
else else
lencopy = bytesperline; lencopy = bytesperline;
if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) { if ((char *)startwrite + lencopy > (char *)outp +
buf->vb.size) {
em28xx_isocdbg("Overflow of %zi bytes past buffer end (2)\n", em28xx_isocdbg("Overflow of %zi bytes past buffer end (2)\n",
((char *)startwrite + lencopy) - ((char *)startwrite + lencopy) -
((char *)outp + buf->vb.size)); ((char *)outp + buf->vb.size));
...@@ -347,7 +349,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb) ...@@ -347,7 +349,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
} }
if (p[0] == 0x22 && p[1] == 0x5a) { if (p[0] == 0x22 && p[1] == 0x5a) {
em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2],
len, (p[2] & 1)? "odd" : "even"); len, (p[2] & 1) ? "odd" : "even");
if (!(p[2] & 1)) { if (!(p[2] & 1)) {
if (buf != NULL) if (buf != NULL)
...@@ -476,7 +478,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, ...@@ -476,7 +478,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
static void static void
buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
{ {
struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); struct em28xx_buffer *buf = container_of(vb,
struct em28xx_buffer,
vb);
struct em28xx_fh *fh = vq->priv_data; struct em28xx_fh *fh = vq->priv_data;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
struct em28xx_dmaqueue *vidq = &dev->vidq; struct em28xx_dmaqueue *vidq = &dev->vidq;
...@@ -489,7 +493,9 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) ...@@ -489,7 +493,9 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
static void buffer_release(struct videobuf_queue *vq, static void buffer_release(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); struct em28xx_buffer *buf = container_of(vb,
struct em28xx_buffer,
vb);
struct em28xx_fh *fh = vq->priv_data; struct em28xx_fh *fh = vq->priv_data;
struct em28xx *dev = (struct em28xx *)fh->dev; struct em28xx *dev = (struct em28xx *)fh->dev;
...@@ -557,7 +563,7 @@ static int res_get(struct em28xx_fh *fh) ...@@ -557,7 +563,7 @@ static int res_get(struct em28xx_fh *fh)
static int res_check(struct em28xx_fh *fh) static int res_check(struct em28xx_fh *fh)
{ {
return (fh->stream_on); return fh->stream_on;
} }
static void res_free(struct em28xx_fh *fh) static void res_free(struct em28xx_fh *fh)
...@@ -791,7 +797,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -791,7 +797,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return rc; return rc;
} }
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm) static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
{ {
struct em28xx_fh *fh = priv; struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
...@@ -1436,7 +1442,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, ...@@ -1436,7 +1442,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_reqbufs(&fh->vb_vidq, rb)); return videobuf_reqbufs(&fh->vb_vidq, rb);
} }
static int vidioc_querybuf(struct file *file, void *priv, static int vidioc_querybuf(struct file *file, void *priv,
...@@ -1450,7 +1456,7 @@ static int vidioc_querybuf(struct file *file, void *priv, ...@@ -1450,7 +1456,7 @@ static int vidioc_querybuf(struct file *file, void *priv,
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_querybuf(&fh->vb_vidq, b)); return videobuf_querybuf(&fh->vb_vidq, b);
} }
static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
...@@ -1463,7 +1469,7 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) ...@@ -1463,7 +1469,7 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_qbuf(&fh->vb_vidq, b)); return videobuf_qbuf(&fh->vb_vidq, b);
} }
static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
...@@ -1476,8 +1482,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) ...@@ -1476,8 +1482,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_dqbuf(&fh->vb_vidq, b, return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK);
file->f_flags & O_NONBLOCK));
} }
#ifdef CONFIG_VIDEO_V4L1_COMPAT #ifdef CONFIG_VIDEO_V4L1_COMPAT
...@@ -1786,7 +1791,7 @@ em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count, ...@@ -1786,7 +1791,7 @@ em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count,
* em28xx_v4l2_poll() * em28xx_v4l2_poll()
* will allocate buffers when called for the first time * will allocate buffers when called for the first time
*/ */
static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait) static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table *wait)
{ {
struct em28xx_fh *fh = filp->private_data; struct em28xx_fh *fh = filp->private_data;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
...@@ -1990,7 +1995,8 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -1990,7 +1995,8 @@ int em28xx_register_analog_devices(struct em28xx *dev)
/* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */ /* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */
val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK); val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK);
em28xx_write_reg(dev, EM28XX_R0F_XCLK, (EM28XX_XCLK_AUDIO_UNMUTE | val)); em28xx_write_reg(dev, EM28XX_R0F_XCLK,
(EM28XX_XCLK_AUDIO_UNMUTE | val));
em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51); em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51);
em28xx_set_outfmt(dev); em28xx_set_outfmt(dev);
...@@ -2025,7 +2031,8 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -2025,7 +2031,8 @@ int em28xx_register_analog_devices(struct em28xx *dev)
} }
if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) {
dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, "radio"); dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template,
"radio");
if (!dev->radio_dev) { if (!dev->radio_dev) {
em28xx_errdev("cannot allocate video_device.\n"); em28xx_errdev("cannot allocate video_device.\n");
return -ENODEV; return -ENODEV;
......
...@@ -161,7 +161,8 @@ ...@@ -161,7 +161,8 @@
*/ */
/* time to wait when stopping the isoc transfer */ /* time to wait when stopping the isoc transfer */
#define EM28XX_URB_TIMEOUT msecs_to_jiffies(EM28XX_NUM_BUFS * EM28XX_NUM_PACKETS) #define EM28XX_URB_TIMEOUT \
msecs_to_jiffies(EM28XX_NUM_BUFS * EM28XX_NUM_PACKETS)
/* time in msecs to wait for i2c writes to finish */ /* time in msecs to wait for i2c writes to finish */
#define EM2800_I2C_WRITE_TIMEOUT 20 #define EM2800_I2C_WRITE_TIMEOUT 20
...@@ -530,7 +531,8 @@ struct em28xx { ...@@ -530,7 +531,8 @@ struct em28xx {
int num_alt; /* Number of alternative settings */ int num_alt; /* Number of alternative settings */
unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */ unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */
char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc
transfer */
char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */
/* helper funcs that call usb_control_msg */ /* helper funcs that call usb_control_msg */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment