Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150856
b: refs/heads/master
c: 4db7589
h: refs/heads/master
v: v3
  • Loading branch information
Marcel Holtmann committed Jun 8, 2009
1 parent 52cebc0 commit fddb503
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 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: ac28494c51ad20c7ff9cb991eaeee359a500d88e
refs/heads/master: 4db7589f3d88c09d740560f1dcf2d4d843d918f2
43 changes: 15 additions & 28 deletions trunk/drivers/bluetooth/hci_vhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,41 +179,31 @@ static inline ssize_t vhci_put_user(struct vhci_data *data,
static ssize_t vhci_read(struct file *file,
char __user *buf, size_t count, loff_t *pos)
{
DECLARE_WAITQUEUE(wait, current);
struct vhci_data *data = file->private_data;
struct sk_buff *skb;
ssize_t ret = 0;

add_wait_queue(&data->read_wait, &wait);
while (count) {
set_current_state(TASK_INTERRUPTIBLE);

skb = skb_dequeue(&data->readq);
if (!skb) {
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}

if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}

schedule();
continue;
if (skb) {
ret = vhci_put_user(data, skb, buf, count);
if (ret < 0)
skb_queue_head(&data->readq, skb);
else
kfree_skb(skb);
break;
}

if (access_ok(VERIFY_WRITE, buf, count))
ret = vhci_put_user(data, skb, buf, count);
else
ret = -EFAULT;
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}

kfree_skb(skb);
break;
ret = wait_event_interruptible(data->read_wait,
!skb_queue_empty(&data->readq));
if (ret < 0)
break;
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&data->read_wait, &wait);

return ret;
}
Expand All @@ -223,9 +213,6 @@ static ssize_t vhci_write(struct file *file,
{
struct vhci_data *data = file->private_data;

if (!access_ok(VERIFY_READ, buf, count))
return -EFAULT;

return vhci_get_user(data, buf, count);
}

Expand Down

0 comments on commit fddb503

Please sign in to comment.