Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76543
b: refs/heads/master
c: f905c44
h: refs/heads/master
i:
  76541: 78982e2
  76539: 083eab2
  76535: 3bb969a
  76527: 3bce82d
  76511: 6d2d451
  76479: 2c704f9
  76415: 9f23e8a
  76287: 9c66f64
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Jan 25, 2008
1 parent e91f423 commit b89e3e9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d2761f227162f610d35b9d68564f5c64774be581
refs/heads/master: f905c442e5b19f75fe4e8ce96f2acffa565f2392
40 changes: 32 additions & 8 deletions trunk/drivers/media/video/vivi.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct vivi_dev {
int users;

/* various device info */
struct video_device vfd;
struct video_device *vfd;

struct vivi_dmaqueue vidq;

Expand Down Expand Up @@ -986,7 +986,7 @@ static int vivi_open(struct inode *inode, struct file *file)
printk(KERN_DEBUG "vivi: open called (minor=%d)\n",minor);

list_for_each_entry(dev, &vivi_devlist, vivi_devlist)
if (dev->vfd.minor == minor)
if (dev->vfd->minor == minor)
goto found;
return -ENODEV;
found:
Expand Down Expand Up @@ -1067,7 +1067,7 @@ vivi_poll(struct file *file, struct poll_table_struct *wait)
return videobuf_poll_stream(file, q, wait);
}

static int vivi_release(struct inode *inode, struct file *file)
static int vivi_close(struct inode *inode, struct file *file)
{
struct vivi_fh *fh = file->private_data;
struct vivi_dev *dev = fh->dev;
Expand All @@ -1088,6 +1088,18 @@ static int vivi_release(struct inode *inode, struct file *file)
return 0;
}

static int vivi_release(struct vivi_dev *dev)
{
if (-1 != dev->vfd->minor)
video_unregister_device(dev->vfd);
else
video_device_release(dev->vfd);

dev->vfd = NULL;

return 0;
}

static int
vivi_mmap(struct file *file, struct vm_area_struct * vma)
{
Expand All @@ -1109,20 +1121,20 @@ vivi_mmap(struct file *file, struct vm_area_struct * vma)
static const struct file_operations vivi_fops = {
.owner = THIS_MODULE,
.open = vivi_open,
.release = vivi_release,
.release = vivi_close,
.read = vivi_read,
.poll = vivi_poll,
.ioctl = video_ioctl2, /* V4L2 ioctl handler */
.mmap = vivi_mmap,
.llseek = no_llseek,
};

static struct video_device vivi = {
static struct video_device vivi_template = {
.name = "vivi",
.type = VID_TYPE_CAPTURE,
.fops = &vivi_fops,
.minor = -1,
// .release = video_device_release,
.release = video_device_release,

.vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_cap = vidioc_enum_fmt_cap,
Expand Down Expand Up @@ -1156,6 +1168,7 @@ static int __init vivi_init(void)
{
int ret;
struct vivi_dev *dev;
struct video_device *vfd;

dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev)
Expand All @@ -1174,7 +1187,18 @@ static int __init vivi_init(void)
dev->vidq.timeout.data = (unsigned long)dev;
init_timer(&dev->vidq.timeout);

ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr);
vfd = video_device_alloc();
if (NULL == vfd)
return -ENOMEM;

*vfd = vivi_template;

ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr);
snprintf(vfd->name, sizeof(vfd->name), "%s (%i)",
vivi_template.name, vfd->minor);

dev->vfd = vfd;

printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret);
return ret;
}
Expand All @@ -1188,9 +1212,9 @@ static void __exit vivi_exit(void)
list = vivi_devlist.next;
list_del(list);
h = list_entry(list, struct vivi_dev, vivi_devlist);
vivi_release(h);
kfree (h);
}
video_unregister_device(&vivi);
}

module_init(vivi_init);
Expand Down

0 comments on commit b89e3e9

Please sign in to comment.