diff options
| author | Chris Rankin <rankincj@yahoo.com> | 2011-09-25 17:43:12 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-25 22:12:35 -0400 |
| commit | 778f295080b62cbce1af402e1704566531e01233 (patch) | |
| tree | 3ed8deb39ebedd89c9255c3ac6681393526595b1 | |
| parent | f055815fd0e4dd22ffd523f0e5117132c0a49e3d (diff) | |
[media] em28xx: replug locking cleanup
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| -rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 2e1c1214c38f..4240f0b720fa 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
| @@ -3005,10 +3005,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
| 3005 | goto fail; | 3005 | goto fail; |
| 3006 | } | 3006 | } |
| 3007 | 3007 | ||
| 3008 | mutex_unlock(&dev->lock); | ||
| 3009 | em28xx_init_extension(dev); | ||
| 3010 | mutex_lock(&dev->lock); | ||
| 3011 | |||
| 3012 | /* Save some power by putting tuner to sleep */ | 3008 | /* Save some power by putting tuner to sleep */ |
| 3013 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0); | 3009 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0); |
| 3014 | 3010 | ||
| @@ -3243,6 +3239,13 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
| 3243 | */ | 3239 | */ |
| 3244 | mutex_unlock(&dev->lock); | 3240 | mutex_unlock(&dev->lock); |
| 3245 | 3241 | ||
| 3242 | /* | ||
| 3243 | * These extensions can be modules. If the modules are already | ||
| 3244 | * loaded then we can initialise the device now, otherwise we | ||
| 3245 | * will initialise it when the modules load instead. | ||
| 3246 | */ | ||
| 3247 | em28xx_init_extension(dev); | ||
| 3248 | |||
| 3246 | return 0; | 3249 | return 0; |
| 3247 | 3250 | ||
| 3248 | err: | 3251 | err: |
