The patch number 8821 was added via Jean-Francois Moine <[EMAIL PROTECTED]> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: [EMAIL PROTECTED] ------ merge: v4l-dvb --- linux/drivers/media/video/meye.c | 4 +- linux/drivers/media/video/v4l2-dev.c | 3 + linux/drivers/media/video/vivi.c | 44 ++++++++++++++++++++++----- mailimport | 6 +++ 4 files changed, 47 insertions(+), 10 deletions(-) diff -r b2400767f4be -r a8e02e6d1e14 linux/drivers/media/video/meye.c --- a/linux/drivers/media/video/meye.c Sun Aug 24 16:25:27 2008 +0200 +++ b/linux/drivers/media/video/meye.c Mon Aug 25 12:52:13 2008 +0200 @@ -1784,6 +1784,7 @@ static int __devinit meye_probe(struct p goto outnotdev; } + ret = -ENOMEM; meye.mchip_dev = pcidev; meye.video_dev = video_device_alloc(); if (!meye.video_dev) { @@ -1791,7 +1792,6 @@ static int __devinit meye_probe(struct p goto outnotdev; } - ret = -ENOMEM; meye.grab_temp = vmalloc(MCHIP_NB_PAGES_MJPEG * PAGE_SIZE); if (!meye.grab_temp) { printk(KERN_ERR "meye: grab buffer allocation failed\n"); @@ -1816,6 +1816,7 @@ static int __devinit meye_probe(struct p memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); meye.video_dev->parent = &meye.mchip_dev->dev; + ret = -EIO; if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { printk(KERN_ERR "meye: unable to power on the camera\n"); printk(KERN_ERR "meye: did you enable the camera in " @@ -1823,7 +1824,6 @@ static int __devinit meye_probe(struct p goto outsonypienable; } - ret = -EIO; if ((ret = pci_enable_device(meye.mchip_dev))) { printk(KERN_ERR "meye: pci_enable_device failed\n"); goto outenabledev; diff -r b2400767f4be -r a8e02e6d1e14 linux/drivers/media/video/v4l2-dev.c --- a/linux/drivers/media/video/v4l2-dev.c Sun Aug 24 16:25:27 2008 +0200 +++ b/linux/drivers/media/video/v4l2-dev.c Mon Aug 25 12:52:13 2008 +0200 @@ -291,6 +291,9 @@ int video_register_device_index(struct v int end; int ret; char *name_base; + + if (vfd == NULL) + return -EINVAL; switch (type) { case VFL_TYPE_GRABBER: diff -r b2400767f4be -r a8e02e6d1e14 linux/drivers/media/video/vivi.c --- a/linux/drivers/media/video/vivi.c Sun Aug 24 16:25:27 2008 +0200 +++ b/linux/drivers/media/video/vivi.c Mon Aug 25 12:52:13 2008 +0200 @@ -1112,18 +1112,28 @@ static struct video_device vivi_template Initialization and module stuff ------------------------------------------------------------------*/ +/* This routine allocates from 1 to n_devs virtual drivers. + + The real maximum number of virtual drivers will depend on how many drivers + will succeed. This is limited to the maximum number of devices that + videodev supports. Since there are 64 minors for video grabbers, this is + currently the theoretical maximum limit. However, a further limit does + exist at videodev that forbids any driver to register more than 32 video + grabbers. + */ static int __init vivi_init(void) { int ret = -ENOMEM, i; struct vivi_dev *dev; struct video_device *vfd; + if (n_devs <= 0) + n_devs = 1; + for (i = 0; i < n_devs; i++) { dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (NULL == dev) + if (!dev) break; - - list_add_tail(&dev->vivi_devlist, &vivi_devlist); /* init video dma queues */ INIT_LIST_HEAD(&dev->vidq.active); @@ -1134,14 +1144,27 @@ static int __init vivi_init(void) mutex_init(&dev->mutex); vfd = video_device_alloc(); - if (NULL == vfd) + if (!vfd) { + kfree(dev); break; + } *vfd = vivi_template; ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); - if (ret < 0) + if (ret < 0) { + video_device_release(vfd); + kfree(dev); + + /* If some registers succeeded, keep driver */ + if (i) + ret = 0; + break; + } + + /* Now that everything is fine, let's add it to device list */ + list_add_tail(&dev->vivi_devlist, &vivi_devlist); snprintf(vfd->name, sizeof(vfd->name), "%s (%i)", vivi_template.name, vfd->minor); @@ -1157,11 +1180,16 @@ static int __init vivi_init(void) if (ret < 0) { vivi_release(); printk(KERN_INFO "Error %d while loading vivi driver\n", ret); - } else + } else { printk(KERN_INFO "Video Technology Magazine Virtual Video " "Capture Board ver %u.%u.%u successfully loaded.\n", (VIVI_VERSION >> 16) & 0xFF, (VIVI_VERSION >> 8) & 0xFF, VIVI_VERSION & 0xFF); + + /* n_devs will reflect the actual number of allocated devices */ + n_devs = i; + } + return ret; } @@ -1177,10 +1205,10 @@ MODULE_AUTHOR("Mauro Carvalho Chehab, Te MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); MODULE_LICENSE("Dual BSD/GPL"); -module_param(video_nr, int, 0); +module_param(video_nr, uint, 0444); MODULE_PARM_DESC(video_nr, "video iminor start number"); -module_param(n_devs, int, 0); +module_param(n_devs, uint, 0444); MODULE_PARM_DESC(n_devs, "number of video devices to create"); module_param_named(debug, vivi_template.debug, int, 0444); diff -r b2400767f4be -r a8e02e6d1e14 mailimport --- a/mailimport Sun Aug 24 16:25:27 2008 +0200 +++ b/mailimport Mon Aug 25 12:52:13 2008 +0200 @@ -165,6 +165,12 @@ proccess_patch () { i="$_" + CHECK="`cat $i| perl -ne 'if (m/^Subject:.*FOLDER INTERNAL DATA/) { print -1; }'`" + + if [ "$CHECK" != "" ]; then + return + fi + echo $i if [ "`diffstat -p1 -l "$i"`" == "" ]; then echo "*** ERROR nothing to commit" --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/a8e02e6d1e14f6b336db42ea35d3f1339d1b9db3 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits