diff options
author | Roland Stoll <roland@xindex.de> | 2008-02-11 11:00:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-02-18 09:15:19 -0500 |
commit | 27d0fe189437803d5ad146d508ec2fd77252c73f (patch) | |
tree | 848a078d589dfe3abc969a4fd75859812242d0b6 /drivers | |
parent | 968fb08912880e34a05a0cca7907392bac920aa2 (diff) |
V4L/DVB (7194): cx88-mpeg: Allow concurrent access to cx88-mpeg devices
It currently isn't possible to open the frontend device of cx88-mpeg devices
(DVB or Blackbird) multiple times concurrently. (for instance, to attach a
signal monitoring tool while reading a stream, or to send a frequency change
ioctl) This patch fixes that condition.
Signed-off-by: Roland Stoll <roland@xindex.de>
Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx88/cx88-mpeg.c | 16 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88.h | 1 |
2 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 0aedbeaf94cd..f12733d6bf72 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -609,13 +609,19 @@ static int cx8802_request_acquire(struct cx8802_driver *drv) | |||
609 | struct cx88_core *core = drv->core; | 609 | struct cx88_core *core = drv->core; |
610 | 610 | ||
611 | /* Fail a request for hardware if the device is busy. */ | 611 | /* Fail a request for hardware if the device is busy. */ |
612 | if (core->active_type_id != CX88_BOARD_NONE) | 612 | if (core->active_type_id != CX88_BOARD_NONE && |
613 | core->active_type_id != drv->type_id) | ||
613 | return -EBUSY; | 614 | return -EBUSY; |
614 | 615 | ||
615 | if (drv->advise_acquire) | 616 | if (drv->advise_acquire) |
616 | { | 617 | { |
617 | core->active_type_id = drv->type_id; | 618 | core->active_ref++; |
618 | drv->advise_acquire(drv); | 619 | mutex_lock(&drv->core->lock); |
620 | if (core->active_type_id == CX88_BOARD_NONE) { | ||
621 | core->active_type_id = drv->type_id; | ||
622 | drv->advise_acquire(drv); | ||
623 | } | ||
624 | mutex_unlock(&drv->core->lock); | ||
619 | 625 | ||
620 | mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); | 626 | mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); |
621 | } | 627 | } |
@@ -628,10 +634,12 @@ static int cx8802_request_release(struct cx8802_driver *drv) | |||
628 | { | 634 | { |
629 | struct cx88_core *core = drv->core; | 635 | struct cx88_core *core = drv->core; |
630 | 636 | ||
631 | if (drv->advise_release) | 637 | if (drv->advise_release && --core->active_ref == 0) |
632 | { | 638 | { |
639 | mutex_lock(&drv->core->lock); | ||
633 | drv->advise_release(drv); | 640 | drv->advise_release(drv); |
634 | core->active_type_id = CX88_BOARD_NONE; | 641 | core->active_type_id = CX88_BOARD_NONE; |
642 | mutex_unlock(&drv->core->lock); | ||
635 | mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); | 643 | mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); |
636 | } | 644 | } |
637 | 645 | ||
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 4e823f2a539a..37e6d2e4002f 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -336,6 +336,7 @@ struct cx88_core { | |||
336 | /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ | 336 | /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ |
337 | struct cx8802_dev *dvbdev; | 337 | struct cx8802_dev *dvbdev; |
338 | enum cx88_board_type active_type_id; | 338 | enum cx88_board_type active_type_id; |
339 | int active_ref; | ||
339 | }; | 340 | }; |
340 | 341 | ||
341 | struct cx8800_dev; | 342 | struct cx8800_dev; |