maxbytes = sizeof(ps2dev->cmdbuf);
}
- mutex_lock(&ps2dev->cmd_mutex);
+ down(&ps2dev->cmd_sem);
serio_pause_rx(ps2dev->serio);
ps2dev->flags = PS2_FLAG_CMD;
wait_event_timeout(ps2dev->wait,
!(ps2dev->flags & PS2_FLAG_CMD),
msecs_to_jiffies(timeout));
- mutex_unlock(&ps2dev->cmd_mutex);
+ up(&ps2dev->cmd_sem);
}
/*
return -1;
}
- mutex_lock(&ps2dev->cmd_mutex);
+ down(&ps2dev->cmd_sem);
serio_pause_rx(ps2dev->serio);
ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0;
ps2dev->flags = 0;
serio_continue_rx(ps2dev->serio);
- mutex_unlock(&ps2dev->cmd_mutex);
+ up(&ps2dev->cmd_sem);
return rc;
}
void ps2_init(struct ps2dev *ps2dev, struct serio *serio)
{
- mutex_init(&ps2dev->cmd_mutex);
+ init_MUTEX(&ps2dev->cmd_sem);
init_waitqueue_head(&ps2dev->wait);
ps2dev->serio = serio;
}