diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-25 11:46:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:26:53 -0400 |
commit | 834751d4365822f769d8af2fd37dc674997a313c (patch) | |
tree | 823450f999114585536b332b0f28c01e0b9d8f8f | |
parent | b15ca3341442e573ef49207200ad42f6abd4f5b4 (diff) |
[media] drxd: use mutex instead of semaphore
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/frontends/drxd_hard.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/media/dvb/frontends/drxd_hard.c b/drivers/media/dvb/frontends/drxd_hard.c index 117df556ec3e..30a78af424cb 100644 --- a/drivers/media/dvb/frontends/drxd_hard.c +++ b/drivers/media/dvb/frontends/drxd_hard.c | |||
@@ -132,7 +132,7 @@ struct drxd_state { | |||
132 | 132 | ||
133 | int i2c_access; | 133 | int i2c_access; |
134 | int init_done; | 134 | int init_done; |
135 | struct semaphore mutex; | 135 | struct mutex mutex; |
136 | 136 | ||
137 | u8 chip_adr; | 137 | u8 chip_adr; |
138 | u16 hi_cfg_timing_div; | 138 | u16 hi_cfg_timing_div; |
@@ -998,7 +998,7 @@ static int HI_CfgCommand(struct drxd_state *state) | |||
998 | { | 998 | { |
999 | int status = 0; | 999 | int status = 0; |
1000 | 1000 | ||
1001 | down(&state->mutex); | 1001 | mutex_lock(&state->mutex); |
1002 | Write16(state, HI_RA_RAM_SRV_CFG_KEY__A, HI_RA_RAM_SRV_RST_KEY_ACT, 0); | 1002 | Write16(state, HI_RA_RAM_SRV_CFG_KEY__A, HI_RA_RAM_SRV_RST_KEY_ACT, 0); |
1003 | Write16(state, HI_RA_RAM_SRV_CFG_DIV__A, state->hi_cfg_timing_div, 0); | 1003 | Write16(state, HI_RA_RAM_SRV_CFG_DIV__A, state->hi_cfg_timing_div, 0); |
1004 | Write16(state, HI_RA_RAM_SRV_CFG_BDL__A, state->hi_cfg_bridge_delay, 0); | 1004 | Write16(state, HI_RA_RAM_SRV_CFG_BDL__A, state->hi_cfg_bridge_delay, 0); |
@@ -1013,7 +1013,7 @@ static int HI_CfgCommand(struct drxd_state *state) | |||
1013 | HI_RA_RAM_SRV_CMD_CONFIG, 0); | 1013 | HI_RA_RAM_SRV_CMD_CONFIG, 0); |
1014 | else | 1014 | else |
1015 | status = HI_Command(state, HI_RA_RAM_SRV_CMD_CONFIG, 0); | 1015 | status = HI_Command(state, HI_RA_RAM_SRV_CMD_CONFIG, 0); |
1016 | up(&state->mutex); | 1016 | mutex_unlock(&state->mutex); |
1017 | return status; | 1017 | return status; |
1018 | } | 1018 | } |
1019 | 1019 | ||
@@ -1029,12 +1029,12 @@ static int HI_ResetCommand(struct drxd_state *state) | |||
1029 | { | 1029 | { |
1030 | int status; | 1030 | int status; |
1031 | 1031 | ||
1032 | down(&state->mutex); | 1032 | mutex_lock(&state->mutex); |
1033 | status = Write16(state, HI_RA_RAM_SRV_RST_KEY__A, | 1033 | status = Write16(state, HI_RA_RAM_SRV_RST_KEY__A, |
1034 | HI_RA_RAM_SRV_RST_KEY_ACT, 0); | 1034 | HI_RA_RAM_SRV_RST_KEY_ACT, 0); |
1035 | if (status == 0) | 1035 | if (status == 0) |
1036 | status = HI_Command(state, HI_RA_RAM_SRV_CMD_RESET, 0); | 1036 | status = HI_Command(state, HI_RA_RAM_SRV_CMD_RESET, 0); |
1037 | up(&state->mutex); | 1037 | mutex_unlock(&state->mutex); |
1038 | msleep(1); | 1038 | msleep(1); |
1039 | return status; | 1039 | return status; |
1040 | } | 1040 | } |
@@ -1066,7 +1066,7 @@ static int AtomicReadBlock(struct drxd_state *state, | |||
1066 | if ((!pData) || ((DataSize & 1) != 0)) | 1066 | if ((!pData) || ((DataSize & 1) != 0)) |
1067 | return -1; | 1067 | return -1; |
1068 | 1068 | ||
1069 | down(&state->mutex); | 1069 | mutex_lock(&state->mutex); |
1070 | 1070 | ||
1071 | do { | 1071 | do { |
1072 | /* Instruct HI to read n bytes */ | 1072 | /* Instruct HI to read n bytes */ |
@@ -1105,7 +1105,7 @@ static int AtomicReadBlock(struct drxd_state *state, | |||
1105 | pData[(2 * i) + 1] = (u8) (word >> 8); | 1105 | pData[(2 * i) + 1] = (u8) (word >> 8); |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | up(&state->mutex); | 1108 | mutex_unlock(&state->mutex); |
1109 | return status; | 1109 | return status; |
1110 | } | 1110 | } |
1111 | 1111 | ||
@@ -1334,7 +1334,7 @@ static int SC_ProcStartCommand(struct drxd_state *state, | |||
1334 | int status = 0; | 1334 | int status = 0; |
1335 | u16 scExec; | 1335 | u16 scExec; |
1336 | 1336 | ||
1337 | down(&state->mutex); | 1337 | mutex_lock(&state->mutex); |
1338 | do { | 1338 | do { |
1339 | Read16(state, SC_COMM_EXEC__A, &scExec, 0); | 1339 | Read16(state, SC_COMM_EXEC__A, &scExec, 0); |
1340 | if (scExec != 1) { | 1340 | if (scExec != 1) { |
@@ -1348,7 +1348,7 @@ static int SC_ProcStartCommand(struct drxd_state *state, | |||
1348 | 1348 | ||
1349 | SC_SendCommand(state, SC_RA_RAM_CMD_PROC_START); | 1349 | SC_SendCommand(state, SC_RA_RAM_CMD_PROC_START); |
1350 | } while (0); | 1350 | } while (0); |
1351 | up(&state->mutex); | 1351 | mutex_unlock(&state->mutex); |
1352 | return status; | 1352 | return status; |
1353 | } | 1353 | } |
1354 | 1354 | ||
@@ -1357,7 +1357,7 @@ static int SC_SetPrefParamCommand(struct drxd_state *state, | |||
1357 | { | 1357 | { |
1358 | int status; | 1358 | int status; |
1359 | 1359 | ||
1360 | down(&state->mutex); | 1360 | mutex_lock(&state->mutex); |
1361 | do { | 1361 | do { |
1362 | status = SC_WaitForReady(state); | 1362 | status = SC_WaitForReady(state); |
1363 | if (status < 0) | 1363 | if (status < 0) |
@@ -1376,7 +1376,7 @@ static int SC_SetPrefParamCommand(struct drxd_state *state, | |||
1376 | if (status < 0) | 1376 | if (status < 0) |
1377 | break; | 1377 | break; |
1378 | } while (0); | 1378 | } while (0); |
1379 | up(&state->mutex); | 1379 | mutex_unlock(&state->mutex); |
1380 | return status; | 1380 | return status; |
1381 | } | 1381 | } |
1382 | 1382 | ||
@@ -1385,7 +1385,7 @@ static int SC_GetOpParamCommand(struct drxd_state *state, u16 * result) | |||
1385 | { | 1385 | { |
1386 | int status = 0; | 1386 | int status = 0; |
1387 | 1387 | ||
1388 | down(&state->mutex); | 1388 | mutex_lock(&state->mutex); |
1389 | do { | 1389 | do { |
1390 | status = SC_WaitForReady(state); | 1390 | status = SC_WaitForReady(state); |
1391 | if (status < 0) | 1391 | if (status < 0) |
@@ -1397,7 +1397,7 @@ static int SC_GetOpParamCommand(struct drxd_state *state, u16 * result) | |||
1397 | if (status < 0) | 1397 | if (status < 0) |
1398 | break; | 1398 | break; |
1399 | } while (0); | 1399 | } while (0); |
1400 | up(&state->mutex); | 1400 | mutex_unlock(&state->mutex); |
1401 | return status; | 1401 | return status; |
1402 | } | 1402 | } |
1403 | #endif | 1403 | #endif |
@@ -2977,7 +2977,7 @@ struct dvb_frontend *drxd_attach(const struct drxd_config *config, | |||
2977 | state->i2c = i2c; | 2977 | state->i2c = i2c; |
2978 | state->priv = priv; | 2978 | state->priv = priv; |
2979 | 2979 | ||
2980 | sema_init(&state->mutex, 1); | 2980 | mutex_init(&state->mutex); |
2981 | 2981 | ||
2982 | if (Read16(state, 0, 0, 0) < 0) | 2982 | if (Read16(state, 0, 0, 0) < 0) |
2983 | goto error; | 2983 | goto error; |