Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363935
b: refs/heads/master
c: 32ef0e3
h: refs/heads/master
i:
  363933: 44c5174
  363931: 7d32eb1
  363927: 98b2e04
  363919: 212a582
  363903: 49deb8c
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Apr 8, 2013
1 parent 8b3cb75 commit 0a50104
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 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: 4445d254cdc59d535616d61f3b7b7cd573e95cf4
refs/heads/master: 32ef0e3e308f59413ba2da42717a884362bf2efc
25 changes: 14 additions & 11 deletions trunk/drivers/staging/comedi/drivers/serial2002.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,26 @@ static long tty_ioctl(struct file *f, unsigned op, unsigned long param)

static int tty_write(struct file *f, unsigned char *buf, int count)
{
const char __user *p = (__force const char __user *)buf;
int result;
mm_segment_t oldfs;

oldfs = get_fs();
set_fs(KERNEL_DS);
f->f_pos = 0;
result = f->f_op->write(f, buf, count, &f->f_pos);
result = f->f_op->write(f, p, count, &f->f_pos);
set_fs(oldfs);
return result;
}

static int __tty_readb(struct file *f, unsigned char *buf)
{
char __user *p = (__force char __user *)buf;

f->f_pos = 0;
return f->f_op->read(f, p, 1, &f->f_pos);
}

#if 0
/*
* On 2.6.26.3 this occaisonally gave me page faults, worked around by
Expand All @@ -113,6 +122,7 @@ static int tty_available(struct file *f)

static int tty_read(struct file *f, int timeout)
{
unsigned char ch;
int result;

result = -1;
Expand Down Expand Up @@ -147,25 +157,18 @@ static int tty_read(struct file *f, int timeout)
elapsed) * HZ) / 10000);
}
poll_freewait(&table);
{
unsigned char ch;

f->f_pos = 0;
if (f->f_op->read(f, &ch, 1, &f->f_pos) == 1)
result = ch;
}
if (__tty_readb(f, &ch) == 1)
result = ch;
} else {
/* Device does not support poll, busy wait */
int retries = 0;
while (1) {
unsigned char ch;

retries++;
if (retries >= timeout)
break;

f->f_pos = 0;
if (f->f_op->read(f, &ch, 1, &f->f_pos) == 1) {
if (__tty_readb(f, &ch) == 1) {
result = ch;
break;
}
Expand Down

0 comments on commit 0a50104

Please sign in to comment.