Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 1047 → Rev 1048

/shark/trunk/drivers/usb/media/pwc-if.c
131,7 → 131,7
/***/
 
/*static*/ int pwc_video_open(struct inode *inode, struct file *file);
static int pwc_video_close(struct inode *inode, struct file *file);
/*static*/ int pwc_video_close(struct inode *inode, struct file *file);
static void pwc_video_release(struct video_device *);
/*static*/ ssize_t pwc_video_read(struct file *file, char *buf,
size_t count, loff_t *ppos);
207,6 → 207,8
return adr;
}
 
extern void * vmaloc_32_usb(size_t size);
 
static void * rvmalloc(unsigned long size)
{
void * mem;
213,8 → 215,8
unsigned long adr;
 
// size=PAGE_ALIGN(size);
// mem=vmalloc_32(size);
mem=malloc(size);
// mem=vmalloc_32_usb(size);
mem=vmalloc_32_usb(size);
if (mem)
{
memset(mem, 0, size); /* Clear the ram out, no junk to the user */
233,6 → 235,8
{
unsigned long adr;
 
vfree(mem);
 
// if (mem)
// {
// adr=(unsigned long) mem;
962,7 → 966,7
/*static*/ int pwc_video_open(struct inode *inode, struct file *file)
{
int i;
struct video_device *vdev = video_device[0]; //video_devdata(file);
struct video_device *vdev = video_devdata(file);
struct pwc_device *pdev;
 
Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev);
1071,7 → 1075,7
}
 
pdev->vopen++;
//file->private_data = vdev;
file->private_data = vdev;
/* lock decompressor; this has a small race condition, since we
could in theory unload pwcx.o between pwc_find_decompressor()
above and this call. I doubt it's ever going to be a problem.
1084,9 → 1088,9
}
 
/* Note that all cleanup is done in the reverse order as in _open */
static int pwc_video_close(struct inode *inode, struct file *file)
/*static*/ int pwc_video_close(struct inode *inode, struct file *file)
{
struct video_device *vdev = video_device[0]; //file->private_data;
struct video_device *vdev = file->private_data;
struct pwc_device *pdev;
int i;
 
1149,24 → 1153,21
/*static*/ ssize_t pwc_video_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
struct video_device *vdev = video_device[0]; //file->private_data;
struct video_device *vdev = file->private_data;
struct pwc_device *pdev;
int noblock = 0; //file->f_flags & O_NONBLOCK;
DECLARE_WAITQUEUE(wait, current);
int bytes_to_read;
 
//printk(KERN_INFO "@0\n");
//wait_ms(1000);
// Trace(TRACE_READ, "video_read(0x%p, %p, %d) called.\n", vdev, buf, count);
if (vdev == NULL)
return -EFAULT;
pdev = vdev->priv;
 
if (pdev == NULL)
return -EFAULT;
if (pdev->error_status)
return -pdev->error_status; /* Something happened, report what. */
//printk(KERN_INFO "@1\n");
//wait_ms(1000);
 
/* In case we're doing partial reads, we don't have to wait for a frame */
if (pdev->image_read_pos == 0) {
1194,26 → 1195,18
}
remove_wait_queue(&pdev->frameq, &wait);
set_current_state(TASK_RUNNING);
//printk(KERN_INFO "@5\n");
//wait_ms(1000);
/* Decompress and release frame */
if (pwc_handle_frame(pdev))
return -EFAULT;
}
 
//printk(KERN_INFO "@6\n");
//wait_ms(1000);
// Trace(TRACE_READ, "Copying data to user space.\n");
if (pdev->vpalette == VIDEO_PALETTE_RAW) {
//printk(KERN_INFO "@7\n");
//wait_ms(1000);
bytes_to_read = pdev->frame_size;
} else
bytes_to_read = pdev->view.size;
 
/* copy bytes to user space; we allow for partial reads */
//printk(KERN_INFO "@8\n");
//wait_ms(1000);
if (count + pdev->image_read_pos > bytes_to_read)
count = bytes_to_read - pdev->image_read_pos;
if (copy_to_user(buf, pdev->image_ptr[pdev->fill_image] + pdev->image_read_pos, count))
1220,8 → 1213,6
return -EFAULT;
pdev->image_read_pos += count;
if (pdev->image_read_pos >= bytes_to_read) { /* All data has been read */
//printk(KERN_INFO "@9\n");
//wait_ms(1000);
pdev->image_read_pos = 0;
pwc_next_image(pdev);
}
1230,7 → 1221,7
 
static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
{
struct video_device *vdev = video_device[0]; //file->private_data;
struct video_device *vdev = file->private_data;
struct pwc_device *pdev;
 
if (vdev == NULL)
1251,7 → 1242,7
/*static*/ int pwc_video_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)
{
struct video_device *vdev = video_device[0]; //file->private_data;
struct video_device *vdev = file->private_data;
struct pwc_device *pdev;
DECLARE_WAITQUEUE(wait, current);
 
1595,7 → 1586,7
 
static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
{
struct video_device *vdev = video_device[0]; //file->private_data;
struct video_device *vdev = file->private_data;
struct pwc_device *pdev;
unsigned long start = vma->vm_start;
unsigned long size = vma->vm_end-vma->vm_start;