summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManu Abraham <devnull@localhost>2005-10-18 19:06:11 +0000
committerManu Abraham <devnull@localhost>2005-10-18 19:06:11 +0000
commitba23c40866d76c68ae1dd0575120656bd47a6525 (patch)
tree63d04df272efdcbc4de885120048bd9c4d33ff10
parent738383e6622e344ce00e605fc2cfae92af2717cc (diff)
downloadmediapointer-dvb-s2-ba23c40866d76c68ae1dd0575120656bd47a6525.tar.gz
mediapointer-dvb-s2-ba23c40866d76c68ae1dd0575120656bd47a6525.tar.bz2
dst_ci_command also need to be protected, missed out in the previous checkin.
Signed-off-by: Manu Abraham <manu@linuxtv.org>
-rw-r--r--linux/drivers/media/dvb/bt8xx/dst_ca.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/dst_ca.c b/linux/drivers/media/dvb/bt8xx/dst_ca.c
index 1587aa719..c8d38ecf8 100644
--- a/linux/drivers/media/dvb/bt8xx/dst_ca.c
+++ b/linux/drivers/media/dvb/bt8xx/dst_ca.c
@@ -81,36 +81,41 @@ static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8
{
u8 reply;
+ down(&state->dst_mutex);
dst_comm_init(state);
msleep(65);
if (write_dst(state, data, len)) {
dprintk(verbose, DST_CA_INFO, 1, " Write not successful, trying to recover");
dst_error_recovery(state);
- return -1;
+ goto error;
}
if ((dst_pio_disable(state)) < 0) {
dprintk(verbose, DST_CA_ERROR, 1, " DST PIO disable failed.");
- return -1;
+ goto error;
}
if (read_dst(state, &reply, GET_ACK) < 0) {
dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover");
dst_error_recovery(state);
- return -1;
+ goto error;
}
if (read) {
if (! dst_wait_dst_ready(state, LONG_DELAY)) {
dprintk(verbose, DST_CA_NOTICE, 1, " 8820 not ready");
- return -1;
+ goto error;
}
if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */
dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover");
dst_error_recovery(state);
- return -1;
+ goto error;
}
}
-
+ up(&state->dst_mutex);
return 0;
+
+error:
+ up(&state->dst_mutex);
+ return -EIO;
}