From: Chris Rankin <rankincj@yahoo.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Subject: [PATCH] EM28xx - replug locking cleanup
Date: Sun, 25 Sep 2011 23:43:12 +0100 [thread overview]
Message-ID: <4E7FAE80.50802@yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
Mauro,
This patch simplifies the locking by moving the em28xx_init_extension() call
until em28xx_usb_probe() has finished with the dev->lock mutex. It therefore
makes the second and subsequent "plugging" events logically identical to the
first "plugging" event when the em28xx-dvb and em28xx-alsa modules must be
loaded (i.e. registered).
Basically, em28xx_usb_probe() requests that em28xx-dvb be loaded and also
triggers udev to initialise the V4L2 devices. These two events are serialised by
the dev->lock mutex but the order that they happen in is undefined. But this has
always been the case anyway.
Signed-off-by: Chris Rankin <rankincj@yahoo.com>
Cheers,
Chris
[-- Attachment #2: EM28xx-replug-deadlock-cleanup.diff --]
[-- Type: text/x-patch, Size: 729 bytes --]
--- linux/drivers/media/video/em28xx/em28xx-cards.c.orig 2011-09-25 22:51:59.000000000 +0100
+++ linux/drivers/media/video/em28xx/em28xx-cards.c 2011-09-25 23:24:06.000000000 +0100
@@ -3005,10 +3005,6 @@
goto fail;
}
- mutex_unlock(&dev->lock);
- em28xx_init_extension(dev);
- mutex_lock(&dev->lock);
-
/* Save some power by putting tuner to sleep */
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
@@ -3243,6 +3239,13 @@
*/
mutex_unlock(&dev->lock);
+ /*
+ * These extensions can be modules. If the modules are already
+ * loaded then we can initialise the device now, otherwise we
+ * will initialise it when the modules load instead.
+ */
+ em28xx_init_extension(dev);
+
return 0;
err:
reply other threads:[~2011-09-25 22:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E7FAE80.50802@yahoo.com \
--to=rankincj@yahoo.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.