aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-01-03 09:53:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 01:30:15 -0500
commit2e124b4a390ca85325fae75764bef92f0547fa25 (patch)
tree5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /arch/um
parentd6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff)
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/chan.h3
-rw-r--r--arch/um/drivers/chan_kern.c14
-rw-r--r--arch/um/drivers/line.c7
3 files changed, 11 insertions, 13 deletions
diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h
index 02b5a76e98d9..78f1b8999964 100644
--- a/arch/um/drivers/chan.h
+++ b/arch/um/drivers/chan.h
@@ -27,8 +27,7 @@ struct chan {
27 void *data; 27 void *data;
28}; 28};
29 29
30extern void chan_interrupt(struct line *line, 30extern void chan_interrupt(struct line *line, int irq);
31 struct tty_struct *tty, int irq);
32extern int parse_chan_pair(char *str, struct line *line, int device, 31extern int parse_chan_pair(char *str, struct line *line, int device,
33 const struct chan_opts *opts, char **error_out); 32 const struct chan_opts *opts, char **error_out);
34extern int write_chan(struct chan *chan, const char *buf, int len, 33extern int write_chan(struct chan *chan, const char *buf, int len,
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 795bd8102205..15c553c239a1 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -131,11 +131,9 @@ void chan_enable_winch(struct chan *chan, struct tty_struct *tty)
131static void line_timer_cb(struct work_struct *work) 131static void line_timer_cb(struct work_struct *work)
132{ 132{
133 struct line *line = container_of(work, struct line, task.work); 133 struct line *line = container_of(work, struct line, task.work);
134 struct tty_struct *tty = tty_port_tty_get(&line->port);
135 134
136 if (!line->throttled) 135 if (!line->throttled)
137 chan_interrupt(line, tty, line->driver->read_irq); 136 chan_interrupt(line, line->driver->read_irq);
138 tty_kref_put(tty);
139} 137}
140 138
141int enable_chan(struct line *line) 139int enable_chan(struct line *line)
@@ -546,7 +544,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
546 return 0; 544 return 0;
547} 545}
548 546
549void chan_interrupt(struct line *line, struct tty_struct *tty, int irq) 547void chan_interrupt(struct line *line, int irq)
550{ 548{
551 struct tty_port *port = &line->port; 549 struct tty_port *port = &line->port;
552 struct chan *chan = line->chan_in; 550 struct chan *chan = line->chan_in;
@@ -570,8 +568,11 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
570 reactivate_fd(chan->fd, irq); 568 reactivate_fd(chan->fd, irq);
571 if (err == -EIO) { 569 if (err == -EIO) {
572 if (chan->primary) { 570 if (chan->primary) {
573 if (tty != NULL) 571 struct tty_struct *tty = tty_port_tty_get(&line->port);
572 if (tty != NULL) {
574 tty_hangup(tty); 573 tty_hangup(tty);
574 tty_kref_put(tty);
575 }
575 if (line->chan_out != chan) 576 if (line->chan_out != chan)
576 close_one_chan(line->chan_out, 1); 577 close_one_chan(line->chan_out, 1);
577 } 578 }
@@ -580,6 +581,5 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
580 return; 581 return;
581 } 582 }
582 out: 583 out:
583 if (tty) 584 tty_flip_buffer_push(port);
584 tty_flip_buffer_push(tty);
585} 585}
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 9ffc28bd4b7a..f1b38571f94e 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -19,11 +19,10 @@ static irqreturn_t line_interrupt(int irq, void *data)
19{ 19{
20 struct chan *chan = data; 20 struct chan *chan = data;
21 struct line *line = chan->line; 21 struct line *line = chan->line;
22 struct tty_struct *tty = tty_port_tty_get(&line->port);
23 22
24 if (line) 23 if (line)
25 chan_interrupt(line, tty, irq); 24 chan_interrupt(line, irq);
26 tty_kref_put(tty); 25
27 return IRQ_HANDLED; 26 return IRQ_HANDLED;
28} 27}
29 28
@@ -234,7 +233,7 @@ void line_unthrottle(struct tty_struct *tty)
234 struct line *line = tty->driver_data; 233 struct line *line = tty->driver_data;
235 234
236 line->throttled = 0; 235 line->throttled = 0;
237 chan_interrupt(line, tty, line->driver->read_irq); 236 chan_interrupt(line, line->driver->read_irq);
238 237
239 /* 238 /*
240 * Maybe there is enough stuff pending that calling the interrupt 239 * Maybe there is enough stuff pending that calling the interrupt