From 2e124b4a390ca85325fae75764bef92f0547fa25 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:06 +0100 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pxa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/tty/serial/pxa.c') diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 2764828251f5..3b671bc3f966 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -98,7 +98,6 @@ static void serial_pxa_stop_rx(struct uart_port *port) static inline void receive_chars(struct uart_pxa_port *up, int *status) { - struct tty_struct *tty = up->port.state->port.tty; unsigned int ch, flag; int max_count = 256; @@ -168,7 +167,7 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status) ignore_char: *status = serial_in(up, UART_LSR); } while ((*status & UART_LSR_DR) && (max_count-- > 0)); - tty_flip_buffer_push(tty); + tty_flip_buffer_push(&up->port.state->port); /* work around Errata #20 according to * Intel(R) PXA27x Processor Family -- cgit v1.2.3 From ed35e09248c12d246b49b6b3ce9fdcec8a5badb6 Mon Sep 17 00:00:00 2001 From: Haojun Bao Date: Thu, 17 Jan 2013 00:01:51 -0800 Subject: serial: pxa: Do not tweak clock in pxa serial write() function The write() function could be used by printk(), which is atomic and tweaking clock there can cause "BUG: sleeping function called from invalid context". Signed-off-by: Bao Haojun Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pxa.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/tty/serial/pxa.c') diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 3b671bc3f966..a67f9e156ada 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -672,7 +672,6 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) unsigned long flags; int locked = 1; - clk_prepare_enable(up->clk); local_irq_save(flags); if (up->port.sysrq) @@ -701,7 +700,6 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) spin_unlock(&up->port.lock); local_irq_restore(flags); - clk_disable_unprepare(up->clk); } #ifdef CONFIG_CONSOLE_POLL -- cgit v1.2.3 From 9429ccbf386c9fce9d998a96474a0926391208cf Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Wed, 23 Jan 2013 09:52:25 +0800 Subject: serial: pxa: fine-tune clk useage 1) add clk_enable/disable in serial_pxa_console_write() 2) add clk_prepare() to follow common clock driver Signed-off-by: Yi Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pxa.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'drivers/tty/serial/pxa.c') diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index a67f9e156ada..05f504e0c271 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -672,7 +672,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) unsigned long flags; int locked = 1; - + clk_enable(up->clk); local_irq_save(flags); if (up->port.sysrq) locked = 0; @@ -699,6 +699,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) if (locked) spin_unlock(&up->port.lock); local_irq_restore(flags); + clk_disable(up->clk); } @@ -896,6 +897,12 @@ static int serial_pxa_probe(struct platform_device *dev) goto err_free; } + ret = clk_prepare(sport->clk); + if (ret) { + clk_put(sport->clk); + goto err_free; + } + sport->port.type = PORT_PXA; sport->port.iotype = UPIO_MEM; sport->port.mapbase = mmres->start; @@ -927,6 +934,7 @@ static int serial_pxa_probe(struct platform_device *dev) return 0; err_clk: + clk_unprepare(sport->clk); clk_put(sport->clk); err_free: kfree(sport); @@ -940,6 +948,8 @@ static int serial_pxa_remove(struct platform_device *dev) platform_set_drvdata(dev, NULL); uart_remove_one_port(&serial_pxa_reg, &sport->port); + + clk_unprepare(sport->clk); clk_put(sport->clk); kfree(sport); -- cgit v1.2.3