summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/common/saa7146_video.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index 9ccda048a..d59946c27 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -257,7 +257,6 @@ int saa7146_start_preview(struct saa7146_fh *fh)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
int ret = 0, err = 0;
- unsigned long flags;
DEB_EE(("dev:%p, fh:%p\n",dev,fh));
@@ -283,19 +282,15 @@ int saa7146_start_preview(struct saa7146_fh *fh)
return -EBUSY;
}
- spin_lock_irqsave(&dev->slock,flags);
-
if (0 == saa7146_res_get(fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP)) {
DEB_D(("cannot get necessary overlay resources\n"));
- err = -EBUSY;
- goto out;
+ return -EBUSY;
}
err = try_win(dev,&fh->ov.win);
if (0 != err) {
saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
- err = -EBUSY;
- goto out;
+ return -EBUSY;
}
vv->ov_data = &fh->ov;
@@ -308,25 +303,20 @@ int saa7146_start_preview(struct saa7146_fh *fh)
if (0 != (ret = saa7146_enable_overlay(fh))) {
DEB_D(("enabling overlay failed: %d\n",ret));
saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
- err = ret;
- goto out;
+ return ret;
}
vv->video_status = STATUS_OVERLAY;
vv->video_fh = fh;
- err = 0;
-out:
- spin_unlock_irqrestore(&dev->slock,flags);
- return err;
+ return 0;
}
int saa7146_stop_preview(struct saa7146_fh *fh)
{
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
- unsigned long flags;
-
+
DEB_EE(("dev:%p, fh:%p\n",dev,fh));
/* check if streaming capture is running */
@@ -334,6 +324,7 @@ int saa7146_stop_preview(struct saa7146_fh *fh)
DEB_D(("streaming capture is active.\n"));
return -EBUSY;
}
+
/* check if overlay is running at all */
if ((vv->video_status & STATUS_OVERLAY) == 0) {
DEB_D(("no active streaming capture.\n"));
@@ -345,16 +336,13 @@ int saa7146_stop_preview(struct saa7146_fh *fh)
return -EBUSY;
}
- spin_lock_irqsave(&dev->slock,flags);
-
- saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
-
vv->video_status = 0;
vv->video_fh = NULL;
saa7146_disable_overlay(fh);
- spin_unlock_irqrestore(&dev->slock,flags);
+ saa7146_res_free(fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
+
return 0;
}
@@ -717,7 +705,6 @@ static int video_begin(struct saa7146_fh *fh)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
struct saa7146_format *fmt = NULL;
- unsigned long flags;
unsigned int resource;
int ret = 0, err = 0;
@@ -762,8 +749,6 @@ static int video_begin(struct saa7146_fh *fh)
return -EBUSY;
}
- spin_lock_irqsave(&dev->slock,flags);
-
/* clear out beginning of streaming bit (rps register 0)*/
saa7146_write(dev, MC2, MASK_27 );
@@ -773,7 +758,6 @@ static int video_begin(struct saa7146_fh *fh)
vv->video_fh = fh;
vv->video_status = STATUS_CAPTURE;
- spin_unlock_irqrestore(&dev->slock,flags);
return 0;
}
@@ -808,8 +792,6 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
resource = RESOURCE_DMA1_HPS;
dmas = MASK_22;
}
- saa7146_res_free(fh, resource);
-
spin_lock_irqsave(&dev->slock,flags);
/* disable rps0 */
@@ -821,10 +803,12 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
/* shut down all used video dma transfers */
saa7146_write(dev, MC1, dmas);
+ spin_unlock_irqrestore(&dev->slock, flags);
+
vv->video_fh = NULL;
vv->video_status = 0;
- spin_unlock_irqrestore(&dev->slock, flags);
+ saa7146_res_free(fh, resource);
if (vv->ov_suspend != NULL) {
saa7146_start_preview(vv->ov_suspend);