int i2c_access;
int init_done;
- struct semaphore mutex;
+ struct mutex mutex;
u8 chip_adr;
u16 hi_cfg_timing_div;
{
int status = 0;
- down(&state->mutex);
+ mutex_lock(&state->mutex);
Write16(state, HI_RA_RAM_SRV_CFG_KEY__A, HI_RA_RAM_SRV_RST_KEY_ACT, 0);
Write16(state, HI_RA_RAM_SRV_CFG_DIV__A, state->hi_cfg_timing_div, 0);
Write16(state, HI_RA_RAM_SRV_CFG_BDL__A, state->hi_cfg_bridge_delay, 0);
HI_RA_RAM_SRV_CMD_CONFIG, 0);
else
status = HI_Command(state, HI_RA_RAM_SRV_CMD_CONFIG, 0);
- up(&state->mutex);
+ mutex_unlock(&state->mutex);
return status;
}
{
int status;
- down(&state->mutex);
+ mutex_lock(&state->mutex);
status = Write16(state, HI_RA_RAM_SRV_RST_KEY__A,
HI_RA_RAM_SRV_RST_KEY_ACT, 0);
if (status == 0)
status = HI_Command(state, HI_RA_RAM_SRV_CMD_RESET, 0);
- up(&state->mutex);
+ mutex_unlock(&state->mutex);
msleep(1);
return status;
}
if ((!pData) || ((DataSize & 1) != 0))
return -1;
- down(&state->mutex);
+ mutex_lock(&state->mutex);
do {
/* Instruct HI to read n bytes */
pData[(2 * i) + 1] = (u8) (word >> 8);
}
}
- up(&state->mutex);
+ mutex_unlock(&state->mutex);
return status;
}
int status = 0;
u16 scExec;
- down(&state->mutex);
+ mutex_lock(&state->mutex);
do {
Read16(state, SC_COMM_EXEC__A, &scExec, 0);
if (scExec != 1) {
SC_SendCommand(state, SC_RA_RAM_CMD_PROC_START);
} while (0);
- up(&state->mutex);
+ mutex_unlock(&state->mutex);
return status;
}
{
int status;
- down(&state->mutex);
+ mutex_lock(&state->mutex);
do {
status = SC_WaitForReady(state);
if (status < 0)
if (status < 0)
break;
} while (0);
- up(&state->mutex);
+ mutex_unlock(&state->mutex);
return status;
}
{
int status = 0;
- down(&state->mutex);
+ mutex_lock(&state->mutex);
do {
status = SC_WaitForReady(state);
if (status < 0)
if (status < 0)
break;
} while (0);
- up(&state->mutex);
+ mutex_unlock(&state->mutex);
return status;
}
#endif
state->i2c = i2c;
state->priv = priv;
- sema_init(&state->mutex, 1);
+ mutex_init(&state->mutex);
if (Read16(state, 0, 0, 0) < 0)
goto error;