[linuxtv-commits] [hg:v4l-dvb] merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-dev

2008-10-11 Thread Patch from Mauro Carvalho Chehab
The patch number 9134 was added via Mauro Carvalho Chehab <[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]

--

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-dev


Priority: normal

Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/Kconfig   |9 +
 linux/drivers/media/video/cx18/cx18-driver.c|4 
 linux/drivers/media/video/cx18/cx18-streams.c   |   41 +++---
 linux/drivers/media/video/em28xx/em28xx-video.c |8 -
 linux/drivers/media/video/ivtv/ivtv-driver.c|6 
 linux/drivers/media/video/ivtv/ivtv-streams.c   |   40 +++---
 linux/drivers/media/video/v4l2-dev.c|  100 ++--
 linux/include/media/v4l2-dev.h  |   12 -
 v4l/scripts/make_kconfig.pl |1 
 9 files changed, 131 insertions(+), 90 deletions(-)

diff -r b064509ec4af -r 9abfea2b7f56 linux/drivers/media/video/Kconfig
--- a/linux/drivers/media/video/Kconfig Sat Oct 04 18:09:41 2008 -0400
+++ b/linux/drivers/media/video/Kconfig Sat Oct 11 12:31:04 2008 -0300
@@ -71,6 +71,15 @@ config VIDEO_ADV_DEBUG
  Say Y here to enable advanced debugging functionality on some
  V4L devices.
  In doubt, say N.
+
+config VIDEO_FIXED_MINOR_RANGES
+   bool "Enable old-style fixed minor ranges for video devices"
+   default n
+   ---help---
+ Say Y here to enable the old-style fixed-range minor assignments.
+ Only useful if you rely on the old behavior and use mknod instead of 
udev.
+
+ When in doubt, say N.
 
 config VIDEO_HELPER_CHIPS_AUTO
bool "Autoselect pertinent encoders/decoders and other helper chips"
diff -r b064509ec4af -r 9abfea2b7f56 
linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c  Sat Oct 04 18:09:41 
2008 -0400
+++ b/linux/drivers/media/video/cx18/cx18-driver.c  Sat Oct 11 12:31:04 
2008 -0300
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(enc_pcm_buffers,
 "Encoder PCM buffers (in MB)\n"
 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_PCM_BUFFERS));
 
-MODULE_PARM_DESC(cx18_first_minor, "Set minor assigned to first card");
+MODULE_PARM_DESC(cx18_first_minor, "Set kernel number assigned to first card");
 
 MODULE_AUTHOR("Hans Verkuil");
 MODULE_DESCRIPTION("CX23418 driver");
@@ -959,7 +959,7 @@ static int module_start(void)
 
/* Validate parameters */
if (cx18_first_minor < 0 || cx18_first_minor >= CX18_MAX_CARDS) {
-   printk(KERN_ERR "cx18:  Exiting, ivtv_first_minor must be 
between 0 and %d\n",
+   printk(KERN_ERR "cx18:  Exiting, cx18_first_minor must be 
between 0 and %d\n",
 CX18_MAX_CARDS - 1);
return -1;
}
diff -r b064509ec4af -r 9abfea2b7f56 
linux/drivers/media/video/cx18/cx18-streams.c
--- a/linux/drivers/media/video/cx18/cx18-streams.c Sat Oct 04 18:09:41 
2008 -0400
+++ b/linux/drivers/media/video/cx18/cx18-streams.c Sat Oct 11 12:31:04 
2008 -0300
@@ -57,7 +57,7 @@ static struct {
 static struct {
const char *name;
int vfl_type;
-   int minor_offset;
+   int num_offset;
int dma;
enum v4l2_buf_type buf_type;
struct file_operations *fops;
@@ -144,8 +144,8 @@ static int cx18_prep_dev(struct cx18 *cx
 {
struct cx18_stream *s = &cx->streams[type];
u32 cap = cx->v4l2_cap;
-   int minor_offset = cx18_stream_info[type].minor_offset;
-   int minor;
+   int num_offset = cx18_stream_info[type].num_offset;
+   int num = cx->num + cx18_first_minor + num_offset;
 
/* These four fields are always initialized. If v4l2dev == NULL, then
   this stream is not in use. In that case no other fields but these
@@ -164,9 +164,6 @@ static int cx18_prep_dev(struct cx18 *cx
!(cap & (V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE)))
return 0;
 
-   /* card number + user defined offset + device offset */
-   minor = cx->num + cx18_first_minor + minor_offset;
-
/* User explicitly selected 0 buffers for these streams, so don't
   create them. */
if (cx18_stream_info[type].dma != PCI_DMA_NONE &&
@@ -177,7 +174,7 @@ static int cx18_prep_dev(struct cx18 *cx
 
cx18_stream_init(cx, type);
 
-   if (minor_offset == -1)
+   if (num_offset == -1)
return 0;
 
/* allocate and initialize the v4l2 video device structure */
@@ -191,7 +188,7 @@ static int cx18_prep_dev(struct cx18 *cx
snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d",

[linuxtv-commits] [hg:v4l-dvb] merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-dev

2008-08-30 Thread Patch from Mauro Carvalho Chehab
The patch number 8853 was added via Mauro Carvalho Chehab <[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]

--

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-dev


Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/v4l2-dev.c |  156 ---
 linux/include/media/v4l2-dev.h   |3 
 2 files changed, 74 insertions(+), 85 deletions(-)

diff -r 32044c2a0440 -r 7f2b60cdc267 linux/drivers/media/video/v4l2-dev.c
--- a/linux/drivers/media/video/v4l2-dev.c  Sat Aug 30 07:06:39 2008 -0300
+++ b/linux/drivers/media/video/v4l2-dev.c  Sat Aug 30 07:43:57 2008 -0300
@@ -80,6 +80,12 @@ static CLASS_DEVICE_ATTR(name, S_IRUGO, 
 static CLASS_DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
 #endif
 
+/*
+ * Active devices
+ */
+static struct video_device *video_device[VIDEO_NUM_DEVICES];
+static DEFINE_MUTEX(videodev_lock);
+
 struct video_device *video_device_alloc(void)
 {
return kzalloc(sizeof(struct video_device), GFP_KERNEL);
@@ -99,6 +105,32 @@ void video_device_release_empty(struct v
 }
 EXPORT_SYMBOL(video_device_release_empty);
 
+/* Called when the last user of the character device is gone. */
+static void v4l2_chardev_release(struct kobject *kobj)
+{
+   struct video_device *vfd = container_of(kobj, struct video_device, 
cdev.kobj);
+
+   mutex_lock(&videodev_lock);
+   if (video_device[vfd->minor] != vfd)
+   panic("videodev: bad release");
+
+   /* Free up this device for reuse */
+   video_device[vfd->minor] = NULL;
+   mutex_unlock(&videodev_lock);
+
+   /* Release the character device */
+   vfd->cdev_release(kobj);
+   /* Release video_device and perform other
+  cleanups as needed. */
+   if (vfd->release)
+   vfd->release(vfd);
+}
+
+/* The new kobj_type for the character device */
+static struct kobj_type v4l2_ktype_cdev_default = {
+   .release = v4l2_chardev_release,
+};
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
 static void video_release(struct class_device *cd)
 #else
@@ -107,7 +139,11 @@ static void video_release(struct device 
 {
struct video_device *vfd = container_of(cd, struct video_device, dev);
 
-   vfd->release(vfd);
+   /* It's now safe to delete the char device.
+  This will either trigger the v4l2_chardev_release immediately (if
+  the refcount goes to 0) or later when the last user of the
+  character device closes it. */
+   cdev_del(&vfd->cdev);
 }
 
 static struct class video_class = {
@@ -120,13 +156,6 @@ static struct class video_class = {
 #endif
 };
 
-/*
- * Active devices
- */
-
-static struct video_device *video_device[VIDEO_NUM_DEVICES];
-static DEFINE_MUTEX(videodev_lock);
-
 struct video_device *video_devdata(struct file *file)
 {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
@@ -136,51 +165,6 @@ struct video_device *video_devdata(struc
 #endif
 }
 EXPORT_SYMBOL(video_devdata);
-
-/*
- * Open a video device - FIXME: Obsoleted
- */
-static int video_open(struct inode *inode, struct file *file)
-{
-   unsigned int minor = iminor(inode);
-   int err = 0;
-   struct video_device *vfl;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
-   const struct file_operations *old_fops;
-#else
-   struct file_operations *old_fops;
-#endif
-
-   if (minor >= VIDEO_NUM_DEVICES)
-   return -ENODEV;
-   mutex_lock(&videodev_lock);
-   vfl = video_device[minor];
-   if (vfl == NULL) {
-   mutex_unlock(&videodev_lock);
-   request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
-   mutex_lock(&videodev_lock);
-   vfl = video_device[minor];
-   if (vfl == NULL) {
-   mutex_unlock(&videodev_lock);
-   return -ENODEV;
-   }
-   }
-   old_fops = file->f_op;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
-   file->f_op = fops_get(vfl->fops);
-#else
-   file->f_op = (struct file_operations *)fops_get(vfl->fops);
-#endif
-   if (file->f_op->open)
-   err = file->f_op->open(inode, file);
-   if (err) {
-   fops_put(file->f_op);
-   file->f_op = fops_get(old_fops);
-   }
-   fops_put(old_fops);
-   mutex_unlock(&videodev_lock);
-   return err;
-}
 
 /**
  * get_index - assign stream number based on parent device
@@ -301,6 +285,13 @@ int video_register_device_index(struct v
return -EINVAL;
}
 
+   /* Initialize the character device */
+#if LINUX

[linuxtv-commits] [hg:v4l-dvb] merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-dev

2008-08-29 Thread Patch from Mauro Carvalho Chehab
The patch number 8793 was added via Mauro Carvalho Chehab <[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]

--

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-dev


Priority: normal

Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/drivers/media/common/saa7146_fops.c |2 
 linux/drivers/media/radio/dsbr100.c   |   16 -
 linux/drivers/media/radio/radio-aimslab.c |   39 +--
 linux/drivers/media/radio/radio-aztech.c  |   45 ++-
 linux/drivers/media/radio/radio-cadet.c   |3 
 linux/drivers/media/radio/radio-gemtek-pci.c  |   44 ++-
 linux/drivers/media/radio/radio-gemtek.c  |   42 ++-
 linux/drivers/media/radio/radio-maestro.c |   37 +--
 linux/drivers/media/radio/radio-maxiradio.c   |   44 ++-
 linux/drivers/media/radio/radio-rtrack2.c |   37 +--
 linux/drivers/media/radio/radio-sf16fmi.c |   36 +-
 linux/drivers/media/radio/radio-sf16fmr2.c|   34 +-
 linux/drivers/media/radio/radio-si470x.c  |   26 +-
 linux/drivers/media/radio/radio-terratec.c|   37 +--
 linux/drivers/media/radio/radio-trust.c   |   20 +
 linux/drivers/media/radio/radio-typhoon.c |   35 +-
 linux/drivers/media/radio/radio-zoltrix.c |   37 +--
 linux/drivers/media/video/arv.c   |   29 +-
 linux/drivers/media/video/bw-qcam.c   |   25 +-
 linux/drivers/media/video/bw-qcam.h   |1 
 linux/drivers/media/video/c-qcam.c|   26 +-
 linux/drivers/media/video/cpia.c  |   15 -
 linux/drivers/media/video/cpia2/cpia2_v4l.c   |   19 -
 linux/drivers/media/video/et61x251/et61x251_core.c|   14 -
 linux/drivers/media/video/meye.c  |   18 -
 linux/drivers/media/video/meye.h  |1 
 linux/drivers/media/video/pms.c   |   23 +
 linux/drivers/media/video/pwc/pwc-if.c|   12 
 linux/drivers/media/video/pwc/pwc-v4l.c   |2 
 linux/drivers/media/video/s2255drv.c  |2 
 linux/drivers/media/video/saa5246a.c  |   56 +---
 linux/drivers/media/video/saa5249.c   |   70 ++---
 linux/drivers/media/video/saa7115.c   |5 
 linux/drivers/media/video/se401.c |3 
 linux/drivers/media/video/sn9c102/sn9c102_core.c  |   14 -
 linux/drivers/media/video/stk-webcam.c|4 
 linux/drivers/media/video/stradis.c   |1 
 linux/drivers/media/video/stv680.c|2 
 linux/drivers/media/video/usbvideo/usbvideo.c |6 
 linux/drivers/media/video/usbvideo/vicam.c|   13 -
 linux/drivers/media/video/usbvision/usbvision-video.c |  122 ++
 linux/drivers/media/video/uvc/uvc_v4l2.c  |   13 -
 linux/drivers/media/video/v4l2-dev.c  |   77 +-
 linux/drivers/media/video/vino.c  |   18 -
 linux/drivers/media/video/w9966.c |   33 +-
 linux/drivers/media/video/wm8739.c|4 
 linux/drivers/media/video/zc0301/zc0301_core.c|   14 -
 linux/include/media/v4l2-dev.h|   70 +++--
 linux/include/sound/tea575x-tuner.h   |1 
 linux/sound/i2c/other/tea575x-tuner.c |   37 ++-
 50 files changed, 676 insertions(+), 608 deletions(-)



---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/3cca4cda1e3fd08386ba5a0064ea781467adc102

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits