From 2bd49a75f4b1151dce0da00d950c499ad1b5273a Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Sun, 31 Aug 2003 20:25:05 -0700 Subject: [PATCH] [PATCH] meye driver update This implements the needed 'release' callback in order to make videodev/sysfs happy again. --- drivers/media/video/meye.c | 24 ++++++++++++++++++------ drivers/media/video/meye.h | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index f45f37f23eef5..a8f623903b46e 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -920,7 +920,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, case VIDIOCGCAP: { struct video_capability *b = arg; - strcpy(b->name,meye.video_dev.name); + strcpy(b->name,meye.video_dev->name); b->type = VID_TYPE_CAPTURE; b->channels = 1; b->audios = 0; @@ -1225,6 +1225,8 @@ static struct video_device meye_template = { .type = VID_TYPE_CAPTURE, .hardware = VID_HARDWARE_MEYE, .fops = &meye_fops, + .release = video_device_release, + .minor = -1, }; #ifdef CONFIG_PM @@ -1275,10 +1277,17 @@ static int __devinit meye_probe(struct pci_dev *pcidev, goto out1; } - sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 1); - meye.mchip_dev = pcidev; - memcpy(&meye.video_dev, &meye_template, sizeof(meye_template)); + meye.video_dev = video_device_alloc(); + if (!meye.video_dev) { + printk(KERN_ERR "meye: video_device_alloc() failed!\n"); + ret = -EBUSY; + goto out1; + } + memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); + meye.video_dev->dev = &meye.mchip_dev->dev; + + sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 1); if ((ret = pci_enable_device(meye.mchip_dev))) { printk(KERN_ERR "meye: pci_enable_device failed\n"); @@ -1335,7 +1344,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev, wait_ms(1); mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); - if (video_register_device(&meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) { + if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) { printk(KERN_ERR "meye: video_register_device failed\n"); ret = -EIO; @@ -1383,6 +1392,9 @@ out4: out3: pci_disable_device(meye.mchip_dev); out2: + video_device_release(meye.video_dev); + meye.video_dev = NULL; + sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 0); out1: return ret; @@ -1390,7 +1402,7 @@ out1: static void __devexit meye_remove(struct pci_dev *pcidev) { - video_unregister_device(&meye.video_dev); + video_unregister_device(meye.video_dev); mchip_hic_stop(); diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h index 4c3e5884aec9a..67fff33ce5b3c 100644 --- a/drivers/media/video/meye.h +++ b/drivers/media/video/meye.h @@ -312,7 +312,7 @@ struct meye { struct meye_queue grabq; /* queue for buffers to be grabbed */ - struct video_device video_dev; /* video device parameters */ + struct video_device *video_dev; /* video device parameters */ struct video_picture picture; /* video picture parameters */ struct meye_params params; /* additional parameters */ #ifdef CONFIG_PM -- 2.53.0