Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269502
b: refs/heads/master
c: 843e784
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov committed Oct 11, 2011
1 parent bc1da14 commit cdd3893
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 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: 7c5bbb2eb7ad047b53c205b1f500bae7b0a88c06
refs/heads/master: 843e784afe164ac8c75a97259d54cf489be74bb9
8 changes: 5 additions & 3 deletions trunk/drivers/input/serio/serio_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ static int serio_raw_open(struct inode *inode, struct file *file)
file->private_data = client;

kref_get(&serio_raw->kref);

serio_pause_rx(serio_raw->serio);
list_add_tail(&client->node, &serio_raw->client_list);
serio_continue_rx(serio_raw->serio);

out:
mutex_unlock(&serio_raw_mutex);
Expand Down Expand Up @@ -138,18 +141,17 @@ static int serio_raw_release(struct inode *inode, struct file *file)

static int serio_raw_fetch_byte(struct serio_raw *serio_raw, char *c)
{
unsigned long flags;
int empty;

spin_lock_irqsave(&serio_raw->serio->lock, flags);
serio_pause_rx(serio_raw->serio);

empty = serio_raw->head == serio_raw->tail;
if (!empty) {
*c = serio_raw->queue[serio_raw->tail];
serio_raw->tail = (serio_raw->tail + 1) % SERIO_RAW_QUEUE_LEN;
}

spin_unlock_irqrestore(&serio_raw->serio->lock, flags);
serio_continue_rx(serio_raw->serio);

return !empty;
}
Expand Down

0 comments on commit cdd3893

Please sign in to comment.