Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181612
b: refs/heads/master
c: b4729dc
h: refs/heads/master
v: v3
  • Loading branch information
Andy Walls authored and Mauro Carvalho Chehab committed Feb 26, 2010
1 parent 1f74437 commit 2335e6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 83695009a439b86c520f9001c80cc5a042c2d940
refs/heads/master: b4729dcbba5431bf636d3d6615709383ad5e0d34
10 changes: 9 additions & 1 deletion trunk/drivers/media/video/cx18/cx18-alsa-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,15 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream)
int ret;

/* Instruct the cx18 to start sending packets */
snd_cx18_lock(cxsc);
s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM];

/* Allocate memory */
item = kmalloc(sizeof(struct cx18_open_id), GFP_KERNEL);
if (NULL == item)
if (NULL == item) {
snd_cx18_unlock(cxsc);
return -ENOMEM;
}

item->cx = cx;
item->type = s->type;
Expand All @@ -171,12 +174,14 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream)
if (cx18_claim_stream(item, item->type)) {
/* No, it's already in use */
kfree(item);
snd_cx18_unlock(cxsc);
return -EBUSY;
}

if (test_bit(CX18_F_S_STREAMOFF, &s->s_flags) ||
test_and_set_bit(CX18_F_S_STREAMING, &s->s_flags)) {
/* We're already streaming. No additional action required */
snd_cx18_unlock(cxsc);
return 0;
}

Expand All @@ -191,6 +196,7 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream)
/* Not currently streaming, so start it up */
set_bit(CX18_F_S_STREAMING, &s->s_flags);
ret = cx18_start_v4l2_encode_stream(s);
snd_cx18_unlock(cxsc);

return 0;
}
Expand All @@ -204,13 +210,15 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream)
int ret;

/* Instruct the cx18 to stop sending packets */
snd_cx18_lock(cxsc);
s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM];
ret = cx18_stop_v4l2_encode_stream(s, 0);
clear_bit(CX18_F_S_STREAMING, &s->s_flags);

cx18_release_stream(s);

cx->pcm_announce_callback = NULL;
snd_cx18_unlock(cxsc);

return 0;
}
Expand Down

0 comments on commit 2335e6e

Please sign in to comment.