Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296424
b: refs/heads/master
c: 0fcd719
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Richard Weinberger committed Mar 24, 2012
1 parent 0107752 commit 0eeafb0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 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: 5eaa3411a80fe50b3a0333389e0e259c580869e9
refs/heads/master: 0fcd719934cd3521ae4a977f454e75e2be60b7ff
2 changes: 1 addition & 1 deletion trunk/arch/um/drivers/chan.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct chan {
void *data;
};

extern void chan_interrupt(struct line *line, struct delayed_work *task,
extern void chan_interrupt(struct line *line,
struct tty_struct *tty, int irq);
extern int parse_chan_pair(char *str, struct line *line, int device,
const struct chan_opts *opts, char **error_out);
Expand Down
15 changes: 12 additions & 3 deletions trunk/arch/um/drivers/chan_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,22 @@ void chan_enable_winch(struct chan *chan, struct tty_struct *tty)
register_winch(chan->fd, tty);
}

static void line_timer_cb(struct work_struct *work)
{
struct line *line = container_of(work, struct line, task.work);

if (!line->throttled)
chan_interrupt(line, line->tty, line->driver->read_irq);
}

int enable_chan(struct line *line)
{
struct list_head *ele;
struct chan *chan;
int err;

INIT_DELAYED_WORK(&line->task, line_timer_cb);

list_for_each(ele, &line->chan_list) {
chan = list_entry(ele, struct chan, list);
err = open_one_chan(chan);
Expand Down Expand Up @@ -552,8 +562,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
return 0;
}

void chan_interrupt(struct line *line, struct delayed_work *task,
struct tty_struct *tty, int irq)
void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
{
struct chan *chan = line->chan_in;
int err;
Expand All @@ -564,7 +573,7 @@ void chan_interrupt(struct line *line, struct delayed_work *task,

do {
if (tty && !tty_buffer_request_room(tty, 1)) {
schedule_delayed_work(task, 1);
schedule_delayed_work(&line->task, 1);
goto out;
}
err = chan->ops->read(chan->fd, &c, chan->data);
Expand Down
16 changes: 2 additions & 14 deletions trunk/arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,10 @@ static irqreturn_t line_interrupt(int irq, void *data)
struct line *line = chan->line;

if (line)
chan_interrupt(line, &line->task, line->tty, irq);
chan_interrupt(line, line->tty, irq);
return IRQ_HANDLED;
}

static void line_timer_cb(struct work_struct *work)
{
struct line *line = container_of(work, struct line, task.work);

if (!line->throttled)
chan_interrupt(line, &line->task, line->tty,
line->driver->read_irq);
}

/*
* Returns the free space inside the ring buffer of this line.
*
Expand Down Expand Up @@ -327,8 +318,7 @@ void line_unthrottle(struct tty_struct *tty)
struct line *line = tty->driver_data;

line->throttled = 0;
chan_interrupt(line, &line->task, tty,
line->driver->read_irq);
chan_interrupt(line, tty, line->driver->read_irq);

/*
* Maybe there is enough stuff pending that calling the interrupt
Expand Down Expand Up @@ -424,8 +414,6 @@ int line_open(struct line *lines, struct tty_struct *tty)
if (err) /* line_close() will be called by our caller */
goto out_unlock;

INIT_DELAYED_WORK(&line->task, line_timer_cb);

if (!line->sigio) {
chan_enable_winch(line->chan_out, tty);
line->sigio = 1;
Expand Down

0 comments on commit 0eeafb0

Please sign in to comment.