[media] cx25821: the audio channel was registered as a video node
authorHans Verkuil <hans.verkuil@cisco.com>
Sun, 14 Apr 2013 14:07:02 +0000 (11:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 15 Apr 2013 11:35:21 +0000 (08:35 -0300)
Skip the audio channel when registering the video nodes. This fixes a bug
where that incorrectly registered 'video' node was never unregistered.
Note: this bug only surfaces if the video output nodes are enabled again
after the previous patch disabled them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/cx25821/cx25821-core.c
drivers/media/pci/cx25821/cx25821-video.c

index 1884e2cc35e9426805e589f2e53cd024a3ceff6c..1f47422d48896b0c237145a88417a814c369cceb 100644 (file)
@@ -1051,11 +1051,9 @@ void cx25821_dev_unregister(struct cx25821_dev *dev)
        if (!atomic_dec_and_test(&dev->refcount))
                return;
 
-       for (i = 0; i < VID_CHANNEL_NUM; i++)
-               cx25821_video_unregister(dev, i);
-
-       for (i = VID_UPSTREAM_SRAM_CHANNEL_I;
-            i <= AUDIO_UPSTREAM_SRAM_CHANNEL_B; i++) {
+       for (i = 0; i < MAX_VID_CHANNEL_NUM - 1; i++) {
+               if (i == SRAM_CH08) /* audio channel */
+                       continue;
                cx25821_video_unregister(dev, i);
        }
 
index 6b18320ebef1f0e1e1fa2a0efe1c823bde49fb4d..8bf9c890883bf30107531b75ea5fc7614814c510 100644 (file)
@@ -462,6 +462,9 @@ int cx25821_video_register(struct cx25821_dev *dev)
        spin_lock_init(&dev->slock);
 
        for (i = 0; i < VID_CHANNEL_NUM; ++i) {
+               if (i == SRAM_CH08) /* audio channel */
+                       continue;
+
                cx25821_init_controls(dev, i);
 
                cx25821_risc_stopper(dev->pci, &dev->channels[i].vidq.stopper,
@@ -788,7 +791,7 @@ static int video_open(struct file *file)
        {
                h = list_entry(list, struct cx25821_dev, devlist);
 
-               for (i = 0; i < MAX_VID_CHANNEL_NUM; i++) {
+               for (i = 0; i < MAX_VID_CHANNEL_NUM - 1; i++) {
                        if (h->channels[i].video_dev &&
                            h->channels[i].video_dev->minor == minor) {
                                dev = h;