mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
V4L/DVB (12828): tm6000: fixes several CodingStyle and do some cleanups
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
204193d959
commit
c4acf48cad
1 changed files with 144 additions and 165 deletions
|
@ -33,9 +33,6 @@
|
|||
#include <linux/version.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/videodev2.h>
|
||||
#ifdef CONFIG_VIDEO_V4L1_COMPAT
|
||||
#include <linux/videodev.h>
|
||||
#endif
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/highmem.h>
|
||||
|
@ -93,7 +90,7 @@ static struct v4l2_queryctrl tm6000_qctrl[] = {
|
|||
.minimum = -128,
|
||||
.maximum = 127,
|
||||
.step = 0x1,
|
||||
.default_value = 0, //4 ?
|
||||
.default_value = 0,
|
||||
.flags = 0,
|
||||
}
|
||||
};
|
||||
|
@ -125,14 +122,13 @@ static LIST_HEAD(tm6000_corelist);
|
|||
#define norm_maxw(a) 720
|
||||
#define norm_maxh(a) 576
|
||||
|
||||
//#define norm_minw(a) norm_maxw(a)
|
||||
#define norm_minw(a) norm_maxw(a)
|
||||
#define norm_minh(a) norm_maxh(a)
|
||||
|
||||
/*
|
||||
* video-buf generic routine to get the next available buffer
|
||||
*/
|
||||
static int inline get_next_buf (struct tm6000_dmaqueue *dma_q,
|
||||
static inline int get_next_buf(struct tm6000_dmaqueue *dma_q,
|
||||
struct tm6000_buffer **buf)
|
||||
{
|
||||
struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq);
|
||||
|
@ -151,7 +147,7 @@ static int inline get_next_buf (struct tm6000_dmaqueue *dma_q,
|
|||
/*
|
||||
* Announces that a buffer were filled and request the next
|
||||
*/
|
||||
static void inline buffer_filled (struct tm6000_core *dev,
|
||||
static inline void buffer_filled(struct tm6000_core *dev,
|
||||
struct tm6000_dmaqueue *dma_q,
|
||||
struct tm6000_buffer *buf)
|
||||
{
|
||||
|
@ -175,26 +171,15 @@ static void inline buffer_filled (struct tm6000_core *dev,
|
|||
wake_up(&buf->vb.done);
|
||||
}
|
||||
|
||||
/*
|
||||
* Macro to allow copying data into the proper memory type
|
||||
*/
|
||||
|
||||
#define bufcpy(buf,out_ptr,in_ptr,size) \
|
||||
{ \
|
||||
if (__copy_to_user(out_ptr,in_ptr,size)!=0) \
|
||||
tm6000_err("copy_to_user failed.\n"); \
|
||||
}
|
||||
|
||||
|
||||
const char *tm6000_msg_type[] = {
|
||||
"unknown(0)", //0
|
||||
"video", //1
|
||||
"audio", //2
|
||||
"vbi", //3
|
||||
"pts", //4
|
||||
"err", //5
|
||||
"unknown(6)", //6
|
||||
"unknown(7)", //7
|
||||
"unknown(0)", /* 0 */
|
||||
"video", /* 1 */
|
||||
"audio", /* 2 */
|
||||
"vbi", /* 3 */
|
||||
"pts", /* 4 */
|
||||
"err", /* 5 */
|
||||
"unknown(6)", /* 6 */
|
||||
"unknown(7)", /* 7 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -291,10 +276,9 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp,
|
|||
(last_field != field)) {
|
||||
|
||||
dev->isoc_ctl.nfields++;
|
||||
if (dev->isoc_ctl.nfields>=2) {
|
||||
if (dev->isoc_ctl.nfields >= 2)
|
||||
dev->isoc_ctl.nfields = 0;
|
||||
}
|
||||
}
|
||||
|
||||
start_line = line;
|
||||
last_field = field;
|
||||
|
@ -303,7 +287,7 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp,
|
|||
|
||||
pktsize = TM6000_URB_MSG_LEN;
|
||||
|
||||
cpysize=(endp-(*ptr)>size)?size:endp-(*ptr);
|
||||
cpysize = (endp-(*ptr) > size) ? size : endp - *ptr;
|
||||
|
||||
if (cpysize) {
|
||||
/* handles each different URB message */
|
||||
|
@ -318,7 +302,7 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp,
|
|||
break;
|
||||
case TM6000_URB_MSG_AUDIO:
|
||||
/* Need some code to process audio */
|
||||
printk ("%ld: cmd=%s, size=%d\n", jiffies,
|
||||
printk(KERN_INFO "%ld: cmd=%s, size=%d\n", jiffies,
|
||||
tm6000_msg_type[cmd], size);
|
||||
break;
|
||||
default:
|
||||
|
@ -426,8 +410,10 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len,
|
|||
|
||||
while (len > 0) {
|
||||
cpysize = min(len, (*buf)->vb.size-pos);
|
||||
//printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos);
|
||||
bufcpy(*buf,&out_p[pos],ptr,cpysize);
|
||||
|
||||
if (__copy_to_user(&out_p[pos], ptr, cpysize) != 0)
|
||||
tm6000_err("copy_to_user failed.\n");
|
||||
|
||||
pos += cpysize;
|
||||
ptr += cpysize;
|
||||
len -= cpysize;
|
||||
|
@ -448,7 +434,7 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void inline print_err_status (struct tm6000_core *dev,
|
||||
static inline void print_err_status(struct tm6000_core *dev,
|
||||
int packet, int status)
|
||||
{
|
||||
char *errmsg = "Unknown";
|
||||
|
@ -483,7 +469,8 @@ static void inline print_err_status (struct tm6000_core *dev,
|
|||
dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n",
|
||||
status, errmsg);
|
||||
} else {
|
||||
dprintk(dev, V4L2_DEBUG_QUEUE, "URB packet %d, status %d [%s].\n",
|
||||
dprintk(dev, V4L2_DEBUG_QUEUE,
|
||||
"URB packet %d, status %d [%s].\n",
|
||||
packet, status, errmsg);
|
||||
}
|
||||
}
|
||||
|
@ -500,9 +487,7 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf)
|
|||
int i, len = 0, rc = 1;
|
||||
int size = (*buf)->vb.size;
|
||||
char *p;
|
||||
unsigned long copied;
|
||||
|
||||
copied=0;
|
||||
unsigned long copied = 0;
|
||||
|
||||
if (urb->status < 0) {
|
||||
print_err_status(dev, -1, urb->status);
|
||||
|
@ -519,21 +504,18 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf)
|
|||
|
||||
len = urb->iso_frame_desc[i].actual_length;
|
||||
|
||||
// if (len>=TM6000_URB_MSG_LEN) {
|
||||
p = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
|
||||
if (!urb->iso_frame_desc[i].status) {
|
||||
if (((*buf)->fmt->fourcc) == V4L2_PIX_FMT_TM6000) {
|
||||
rc = copy_multiplexed(p, outp, len, urb, buf);
|
||||
if (rc <= 0)
|
||||
return rc;
|
||||
} else {
|
||||
} else
|
||||
copy_streams(p, outp, len, urb, buf);
|
||||
}
|
||||
}
|
||||
copied += len;
|
||||
if (copied >= size)
|
||||
break;
|
||||
// }
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
@ -573,18 +555,16 @@ ret:
|
|||
urb->iso_frame_desc[i].status = 0;
|
||||
urb->iso_frame_desc[i].actual_length = 0;
|
||||
}
|
||||
urb->status = 0;
|
||||
|
||||
if ((urb->status = usb_submit_urb(urb, GFP_ATOMIC))) {
|
||||
urb->status = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (urb->status)
|
||||
tm6000_err("urb resubmit failed (error=%i)\n",
|
||||
urb->status);
|
||||
}
|
||||
|
||||
if (rc>=0) {
|
||||
/* Data filled, reset watchdog */
|
||||
if (rc >= 0)
|
||||
mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
|
||||
// }
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
}
|
||||
|
||||
|
@ -641,7 +621,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev,
|
|||
int max_packets, int num_bufs)
|
||||
{
|
||||
struct tm6000_dmaqueue *dma_q = &dev->vidq;
|
||||
int i, rc;
|
||||
int i;
|
||||
int sb_size, pipe;
|
||||
struct urb *urb;
|
||||
int j, k;
|
||||
|
@ -700,7 +680,6 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev,
|
|||
}
|
||||
memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size);
|
||||
|
||||
|
||||
pipe=usb_rcvisocpipe(dev->udev,
|
||||
dev->isoc_in->desc.bEndpointAddress &
|
||||
USB_ENDPOINT_NUMBER_MASK);
|
||||
|
|
Loading…
Add table
Reference in a new issue