diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-08-25 04:41:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:07:13 -0400 |
commit | 26e9d599561e9a964bd4d7c2be0029db8aaff852 (patch) | |
tree | 0355d57f557d08771630cabdb1573381c7b99c14 /drivers/media/video/ivtv | |
parent | 49ebf14e249734a5f64d5bdd9aaa2ddf4bcedc51 (diff) |
V4L/DVB (6115): ivtv/ivtv-fb: improve locking to avoid initialization problems
ivtv/ivtv-fb: improve locking to prevent ivtv/ivtv-fb initialization problems
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fb.c | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 855697c1c968..2a5e0facca7d 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -1003,6 +1003,8 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1003 | 1003 | ||
1004 | IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); | 1004 | IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); |
1005 | 1005 | ||
1006 | mutex_lock(&itv->serialize_lock); | ||
1007 | |||
1006 | /* PCI Device Setup */ | 1008 | /* PCI Device Setup */ |
1007 | if ((retval = ivtv_setup_pci(itv, dev, pci_id)) != 0) { | 1009 | if ((retval = ivtv_setup_pci(itv, dev, pci_id)) != 0) { |
1008 | if (retval == -EIO) | 1010 | if (retval == -EIO) |
@@ -1174,6 +1176,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1174 | IVTV_ERR("Failed to register irq %d\n", retval); | 1176 | IVTV_ERR("Failed to register irq %d\n", retval); |
1175 | goto free_streams; | 1177 | goto free_streams; |
1176 | } | 1178 | } |
1179 | mutex_unlock(&itv->serialize_lock); | ||
1177 | IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name); | 1180 | IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name); |
1178 | return 0; | 1181 | return 0; |
1179 | 1182 | ||
@@ -1192,6 +1195,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1192 | release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); | 1195 | release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); |
1193 | free_workqueue: | 1196 | free_workqueue: |
1194 | destroy_workqueue(itv->irq_work_queues); | 1197 | destroy_workqueue(itv->irq_work_queues); |
1198 | mutex_unlock(&itv->serialize_lock); | ||
1195 | err: | 1199 | err: |
1196 | if (retval == 0) | 1200 | if (retval == 0) |
1197 | retval = -ENODEV; | 1201 | retval = -ENODEV; |
diff --git a/drivers/media/video/ivtv/ivtv-fb.c b/drivers/media/video/ivtv/ivtv-fb.c index e80564aed632..ffe6478682ae 100644 --- a/drivers/media/video/ivtv/ivtv-fb.c +++ b/drivers/media/video/ivtv/ivtv-fb.c | |||
@@ -1011,10 +1011,13 @@ static int ivtvfb_init_io(struct ivtv *itv) | |||
1011 | { | 1011 | { |
1012 | struct osd_info *oi = itv->osd_info; | 1012 | struct osd_info *oi = itv->osd_info; |
1013 | 1013 | ||
1014 | mutex_lock(&itv->serialize_lock); | ||
1014 | if (ivtv_init_on_first_open(itv)) { | 1015 | if (ivtv_init_on_first_open(itv)) { |
1016 | mutex_unlock(&itv->serialize_lock); | ||
1015 | IVTV_FB_ERR("Failed to initialize ivtv\n"); | 1017 | IVTV_FB_ERR("Failed to initialize ivtv\n"); |
1016 | return -ENXIO; | 1018 | return -ENXIO; |
1017 | } | 1019 | } |
1020 | mutex_unlock(&itv->serialize_lock); | ||
1018 | 1021 | ||
1019 | ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size); | 1022 | ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size); |
1020 | 1023 | ||