summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-08-25 10:41:52 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2007-08-25 10:41:52 +0200
commitac2002e8dbbc99d7003c481dfefae21c096d9e5b (patch)
tree78646975b1d68603f88f6fb3c5110c0c8ceacfd7 /linux/drivers/media
parent9976ff45b0466fd6f4af371ea858da991303d254 (diff)
downloadmediapointer-dvb-s2-ac2002e8dbbc99d7003c481dfefae21c096d9e5b.tar.gz
mediapointer-dvb-s2-ac2002e8dbbc99d7003c481dfefae21c096d9e5b.tar.bz2
ivtv/ivtv-fb: improve locking to prevent ivtv/ivtv-fb initialization problems.
From: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.c4
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-fb.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c
index 4d496f5c9..95a674035 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c
@@ -1007,6 +1007,8 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr);
+ mutex_lock(&itv->serialize_lock);
+
/* PCI Device Setup */
if ((retval = ivtv_setup_pci(itv, dev, pci_id)) != 0) {
if (retval == -EIO)
@@ -1178,6 +1180,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
IVTV_ERR("Failed to register irq %d\n", retval);
goto free_streams;
}
+ mutex_unlock(&itv->serialize_lock);
IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name);
return 0;
@@ -1196,6 +1199,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
free_workqueue:
destroy_workqueue(itv->irq_work_queues);
+ mutex_unlock(&itv->serialize_lock);
err:
if (retval == 0)
retval = -ENODEV;
diff --git a/linux/drivers/media/video/ivtv/ivtv-fb.c b/linux/drivers/media/video/ivtv/ivtv-fb.c
index e80564aed..ffe647868 100644
--- a/linux/drivers/media/video/ivtv/ivtv-fb.c
+++ b/linux/drivers/media/video/ivtv/ivtv-fb.c
@@ -1011,10 +1011,13 @@ static int ivtvfb_init_io(struct ivtv *itv)
{
struct osd_info *oi = itv->osd_info;
+ mutex_lock(&itv->serialize_lock);
if (ivtv_init_on_first_open(itv)) {
+ mutex_unlock(&itv->serialize_lock);
IVTV_FB_ERR("Failed to initialize ivtv\n");
return -ENXIO;
}
+ mutex_unlock(&itv->serialize_lock);
ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size);