V4L/DVB (11085): au0828/au8522: Codingstyle fixes

Take a pass over all of the au0828/au8522 files and cleanup all the codingstyle
issues.  This patch does not make *any* functional change to the code.

Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Devin Heitmueller 2009-03-15 18:48:52 -03:00 committed by Mauro Carvalho Chehab
parent 3d62287e2c
commit 62899a2800
6 changed files with 226 additions and 236 deletions

View File

@ -99,7 +99,8 @@ struct au8522_register_config filter_coef[] = {
{AU8522_FILTER_COEF_R42D, {0x01, 0x34, 0x01, 0x01, 0x34, 0x34, 0x34} },
};
#define NUM_FILTER_COEF (sizeof (filter_coef) / sizeof(struct au8522_register_config))
#define NUM_FILTER_COEF (sizeof(filter_coef)\
/ sizeof(struct au8522_register_config))
/* Registers 0x060b through 0x0652 are the LP Filter coefficients
@ -181,7 +182,8 @@ struct au8522_register_config lpfilter_coef[] = {
{0x0651, {0x40, 0x40} },
{0x0652, {0x01, 0x01} },
};
#define NUM_LPFILTER_COEF (sizeof (lpfilter_coef) / sizeof(struct au8522_register_config))
#define NUM_LPFILTER_COEF (sizeof(lpfilter_coef)\
/ sizeof(struct au8522_register_config))
static inline struct au8522_state *to_state(struct v4l2_subdev *sd)
{
@ -202,14 +204,17 @@ static void setup_vbi(struct au8522_state *state, int aud_input)
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_PAT2_REG01EH, 0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_PAT1_REG01FH, 0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_PAT0_REG020H, 0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK2_REG021H,0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK1_REG022H,0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK0_REG023H,0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK2_REG021H,
0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK1_REG022H,
0x00);
au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK0_REG023H,
0x00);
/* Setup the VBI registers */
for (i = 0x30; i < 0x60; i++) {
for (i = 0x30; i < 0x60; i++)
au8522_writereg(state, i, 0x40);
}
/* For some reason, every register is 0x40 except register 0x44
(confirmed via the HVR-950q USB capture) */
au8522_writereg(state, 0x44, 0x60);
@ -448,7 +453,7 @@ static void set_audio_input(struct au8522_state *state, int aud_input)
if (aud_input != AU8522_AUDIO_SIF) {
/* The caller asked for a mode we don't currently support */
printk("Unsupported audio mode requested! mode=%d\n",
printk(KERN_ERR "Unsupported audio mode requested! mode=%d\n",
aud_input);
return;
}
@ -668,7 +673,7 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd,
} else if (route->input == AU8522_COMPOSITE_CH4_SIF) {
au8522_setup_cvbs_tuner_mode(state);
} else {
printk("au8522 mode not currently supported\n");
printk(KERN_ERR "au8522 mode not currently supported\n");
return -EINVAL;
}
return 0;
@ -782,15 +787,15 @@ static int au8522_probe(struct i2c_client *client,
instance = au8522_get_state(&state, client->adapter, client->addr);
switch (instance) {
case 0:
printk("au8522_decoder allocation failed\n");
printk(KERN_ERR "au8522_decoder allocation failed\n");
return -EIO;
case 1:
/* new demod instance */
printk("au8522_decoder creating new instance...\n");
printk(KERN_INFO "au8522_decoder creating new instance...\n");
break;
default:
/* existing demod instance */
printk("au8522_decoder attaching to existing instance...\n");
printk(KERN_INFO "au8522_decoder attach existing instance.\n");
break;
}

View File

@ -36,8 +36,8 @@ static int debug;
static LIST_HEAD(hybrid_tuner_instance_list);
static DEFINE_MUTEX(au8522_list_mutex);
#define dprintk(arg...) do { \
if (debug) \
#define dprintk(arg...)\
do { if (debug)\
printk(arg);\
} while (0)

View File

@ -150,13 +150,13 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
/* Make sure we support the board model */
switch (tv.model) {
case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */
case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */
case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */
case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
break;
default:
@ -202,9 +202,8 @@ void au0828_card_setup(struct au0828_dev *dev)
demod) */
sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "au8522", "au8522",
0x8e >> 1);
if (sd == NULL) {
printk("analog subdev registration failure\n");
}
if (sd == NULL)
printk(KERN_ERR "analog subdev registration failed\n");
}
/* Setup tuners */
@ -212,9 +211,8 @@ void au0828_card_setup(struct au0828_dev *dev)
/* Load the tuner module, which does the attach */
sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner",
dev->board.tuner_addr);
if (sd == NULL) {
printk("analog tuner subdev registration failure\n");
}
if (sd == NULL)
printk(KERN_ERR "tuner subdev registration fail\n");
tun_setup.mode_mask = mode_mask;
tun_setup.type = dev->board.tuner_type;

View File

@ -145,11 +145,10 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
requires us to slow down the i2c clock until we have a better
strategy (such as using the secondary i2c bus to do firmware
loading */
if ((msg->addr << 1) == 0xc2) {
if ((msg->addr << 1) == 0xc2)
au0828_write(dev, REG_202, 0x40);
} else {
else
au0828_write(dev, REG_202, 0x07);
}
/* Hardware needs 8 bit addresses */
au0828_write(dev, REG_203, msg->addr << 1);
@ -223,11 +222,10 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
requires us to slow down the i2c clock until we have a better
strategy (such as using the secondary i2c bus to do firmware
loading */
if ((msg->addr << 1) == 0xc2) {
if ((msg->addr << 1) == 0xc2)
au0828_write(dev, REG_202, 0x40);
} else {
else
au0828_write(dev, REG_202, 0x07);
}
/* Hardware needs 8 bit addresses */
au0828_write(dev, REG_203, msg->addr << 1);

View File

@ -33,7 +33,6 @@
#include <linux/device.h>
#include <linux/suspend.h>
#include <linux/version.h>
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-chip-ident.h>
@ -46,9 +45,6 @@ static DEFINE_MUTEX(au0828_sysfs_lock);
#define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1)
/* Forward declarations */
void au0828_analog_stream_reset(struct au0828_dev *dev);
/* ------------------------------------------------------------------
Videobuf operations
------------------------------------------------------------------*/
@ -107,12 +103,12 @@ static inline void print_err_status(struct au0828_dev *dev,
static int check_dev(struct au0828_dev *dev)
{
if (dev->dev_state & DEV_DISCONNECTED) {
printk("v4l2 ioctl: device not present\n");
printk(KERN_INFO "v4l2 ioctl: device not present\n");
return -ENODEV;
}
if (dev->dev_state & DEV_MISCONFIGURED) {
printk("v4l2 ioctl: device is misconfigured; "
printk(KERN_INFO "v4l2 ioctl: device is misconfigured; "
"close and open it again\n");
return -EIO;
}
@ -373,7 +369,7 @@ static void au0828_copy_video(struct au0828_dev *dev,
if ((char *)startwrite + lencopy > (char *)outp +
buf->vb.size) {
au0828_isocdbg("Overflow of %zi bytes past buffer end (2)\n",
au0828_isocdbg("Overflow %zi bytes past buf end (2)\n",
((char *)startwrite + lencopy) -
((char *)outp + buf->vb.size));
lencopy = remain = (char *)outp + buf->vb.size -
@ -389,10 +385,9 @@ static void au0828_copy_video(struct au0828_dev *dev,
if (offset > 1440) {
/* We have enough data to check for greenscreen */
if (outp[0] < 0x60 && outp[1440] < 0x60) {
if (outp[0] < 0x60 && outp[1440] < 0x60)
dev->greenscreen_detected = 1;
}
}
dma_q->pos += len;
}
@ -457,9 +452,9 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
continue;
}
if (urb->iso_frame_desc[i].actual_length <= 0) {
if (urb->iso_frame_desc[i].actual_length <= 0)
continue;
}
if (urb->iso_frame_desc[i].actual_length >
dev->max_pkt_size) {
au0828_isocdbg("packet bigger than packet size");
@ -480,26 +475,24 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
if (buf != NULL)
buffer_filled(dev, dma_q, buf);
get_next_buf(dma_q, &buf);
if (buf == NULL) {
if (buf == NULL)
outp = NULL;
} else
else
outp = videobuf_to_vmalloc(&buf->vb);
}
if (buf != NULL) {
if (fbyte & 0x40) {
if (fbyte & 0x40)
buf->top_field = 1;
} else {
else
buf->top_field = 0;
}
}
dma_q->pos = 0;
}
if (buf != NULL) {
if (buf != NULL)
au0828_copy_video(dev, dma_q, buf, p, outp, len);
}
}
return rc;
}
@ -566,7 +559,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
if (VIDEOBUF_NEEDS_INIT == buf->vb.state) {
rc = videobuf_iolock(vq, &buf->vb, NULL);
if (rc < 0) {
printk("videobuf_iolock failed\n");
printk(KERN_INFO "videobuf_iolock failed\n");
goto fail;
}
}
@ -579,7 +572,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
AU0828_MAX_ISO_BUFS, dev->max_pkt_size,
au0828_isoc_copy);
if (rc < 0) {
printk("au0828_init_isoc failed\n");
printk(KERN_INFO "au0828_init_isoc failed\n");
goto fail;
}
}
@ -685,7 +678,7 @@ static int au0828_stream_interrupt(struct au0828_dev *dev)
return -ENODEV;
else if (ret) {
dev->dev_state = DEV_MISCONFIGURED;
dprintk(1, "%s device is misconfigured!\n", __FUNCTION__);
dprintk(1, "%s device is misconfigured!\n", __func__);
return ret;
}
return 0;
@ -782,7 +775,7 @@ static int au0828_v4l2_open(struct file *filp)
/* set au0828 interface0 to AS5 here again */
ret = usb_set_interface(dev->usbdev, 0, 5);
if (ret < 0) {
printk("Au0828 can't set alt setting to 5!\n");
printk(KERN_INFO "Au0828 can't set alternate to 5!\n");
return -EBUSY;
}
dev->width = NTSC_STD_W;
@ -840,7 +833,7 @@ static int au0828_v4l2_close(struct file *filp)
USB bandwidth */
ret = usb_set_interface(dev->usbdev, 0, 0);
if (ret < 0)
printk("Au0828 can't set alt setting to 0!\n");
printk(KERN_INFO "Au0828 can't set alternate to 0!\n");
}
kfree(fh);
@ -941,19 +934,16 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd,
dprintk(1, "VBI format set: to be supported!\n");
return 0;
}
if(format->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
if (format->type == V4L2_BUF_TYPE_VBI_CAPTURE)
return 0;
}
#endif
if(format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
}
/* If they are demanding a format other than the one we support,
bail out (tvtime asks for UYVY and then retries with YUYV) */
if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY) {
if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY)
return -EINVAL;
}
/* format->fmt.pix.width only support 720 and height 480 */
if (width != 720)
@ -981,7 +971,8 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd,
if (dev->stream_state == STREAM_ON) {
dprintk(1, "VIDIOC_SET_FMT: interrupting stream!\n");
if((ret = au0828_stream_interrupt(dev))) {
ret = au0828_stream_interrupt(dev);
if (ret != 0) {
dprintk(1, "error interrupting video stream!\n");
return ret;
}
@ -990,7 +981,7 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd,
/* set au0828 interface0 to AS5 here again */
ret = usb_set_interface(dev->usbdev, 0, 5);
if (ret < 0) {
printk("Au0828 can't set alt setting to 5!\n");
printk(KERN_INFO "Au0828 can't set alt setting to 5!\n");
return -EBUSY;
}
@ -1084,13 +1075,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
int rc;
if (videobuf_queue_is_busy(&fh->vb_vidq)) {
printk("%s queue busy\n", __func__);
printk(KERN_INFO "%s queue busy\n", __func__);
rc = -EBUSY;
goto out;
}
if (dev->stream_on && !fh->stream_on) {
printk("%s device in use by another fh\n", __func__);
printk(KERN_INFO "%s device in use by another fh\n", __func__);
rc = -EBUSY;
goto out;
}
@ -1165,7 +1156,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
int i;
struct v4l2_routing route;
dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __FUNCTION__,
dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __func__,
index);
if (index >= AU0828_MAX_INPUT)
return -EINVAL;
@ -1195,9 +1186,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
for (i = 0; i < AU0828_MAX_INPUT; i++) {
int enable = 0;
if (AUVI_INPUT(i).audio_setup == NULL) {
if (AUVI_INPUT(i).audio_setup == NULL)
continue;
}
if (i == index)
enable = 1;
@ -1422,14 +1412,14 @@ static int vidioc_streamoff(struct file *file, void *priv,
if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
au0828_call_i2c_clients(dev, VIDIOC_STREAMOFF, &b);
if((ret = au0828_stream_interrupt(dev)) != 0)
ret = au0828_stream_interrupt(dev);
if (ret != 0)
return ret;
}
for (i = 0; i < AU0828_MAX_INPUT; i++) {
if (AUVI_INPUT(i).audio_setup == NULL) {
if (AUVI_INPUT(i).audio_setup == NULL)
continue;
}
(AUVI_INPUT(i).audio_setup)(dev, 0);
}
@ -1624,7 +1614,7 @@ int au0828_analog_register(struct au0828_dev *dev,
retval = usb_set_interface(dev->usbdev,
interface->cur_altsetting->desc.bInterfaceNumber, 5);
if (retval != 0) {
printk("Failure setting usb interface0 to as5\n");
printk(KERN_INFO "Failure setting usb interface0 to as5\n");
return retval;
}
@ -1632,17 +1622,20 @@ int au0828_analog_register(struct au0828_dev *dev,
iface_desc = interface->cur_altsetting;
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
endpoint = &iface_desc->endpoint[i].desc;
if(((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC)){
if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
== USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
== USB_ENDPOINT_XFER_ISOC)) {
/* we find our isoc in endpoint */
u16 tmp = le16_to_cpu(endpoint->wMaxPacketSize);
dev->max_pkt_size = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
dev->max_pkt_size = (tmp & 0x07ff) *
(((tmp & 0x1800) >> 11) + 1);
dev->isoc_in_endpointaddr = endpoint->bEndpointAddress;
}
}
if (!(dev->isoc_in_endpointaddr)) {
printk("Could not locate isoc endpoint\n");
printk(KERN_INFO "Could not locate isoc endpoint\n");
kfree(dev);
return -ENODEV;
}
@ -1679,14 +1672,12 @@ int au0828_analog_register(struct au0828_dev *dev,
/* Fill the video capture device struct */
*dev->vdev = au0828_video_template;
dev->vdev->vfl_type = VID_TYPE_CAPTURE | VID_TYPE_TUNER;
dev->vdev->parent = &dev->usbdev->dev;
strcpy(dev->vdev->name, "au0828a video");
#ifdef VBI_NOT_YET_WORKING
/* Setup the VBI device */
*dev->vbi_dev = au0828_video_template;
dev->vbi_dev->vfl_type = VFL_TYPE_VBI;
dev->vbi_dev->parent = &dev->usbdev->dev;
strcpy(dev->vbi_dev->name, "au0828a vbi");
#endif
@ -1694,8 +1685,10 @@ int au0828_analog_register(struct au0828_dev *dev,
list_add_tail(&dev->au0828list, &au0828_devlist);
/* Register the v4l2 device */
if((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1)) != 0) {
dprintk(1, "unable to register video device (error = %d).\n", retval);
retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1);
if (retval != 0) {
dprintk(1, "unable to register video device (error = %d).\n",
retval);
list_del(&dev->au0828list);
video_device_release(dev->vdev);
return -ENODEV;
@ -1703,8 +1696,10 @@ int au0828_analog_register(struct au0828_dev *dev,
#ifdef VBI_NOT_YET_WORKING
/* Register the vbi device */
if((retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1)) != 0) {
dprintk(1, "unable to register vbi device (error = %d).\n", retval);
retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1);
if (retval != 0) {
dprintk(1, "unable to register vbi device (error = %d).\n",
retval);
list_del(&dev->au0828list);
video_device_release(dev->vbi_dev);
video_device_release(dev->vdev);
@ -1712,7 +1707,7 @@ int au0828_analog_register(struct au0828_dev *dev,
}
#endif
dprintk(1, "%s completed!\n", __FUNCTION__);
dprintk(1, "%s completed!\n", __func__);
return 0;
}

View File

@ -54,16 +54,10 @@
/* Defination for AU0828 USB transfer */
#define AU0828_MAX_ISO_BUFS 12 /* maybe resize this value in the future */
#define AU0828_ISO_PACKETS_PER_URB 10
#define AU0828_ISO_MAX_FRAME_SIZE (3 * 1024)
#define AU0828_ISO_BUFFER_SIZE (AU0828_ISO_PACKETS_PER_URB * AU0828_ISO_MAX_FRAME_SIZE)
#define AU0828_MIN_BUF 4
#define AU0828_DEF_BUF 8
#define AU0828_MAX_IMAGES 10
#define AU0828_FRAME_SIZE (1028 * 1024 * 4)
#define AU0828_URB_TIMEOUT msecs_to_jiffies(AU0828_MAX_ISO_BUFS * AU0828_ISO_PACKETS_PER_URB)
#define AU0828_MAX_INPUT 4
enum au0828_itype {