tty: serial: altera_jtaguart: remove flag from altera_jtaguart_rx_chars()
Jiri Slaby (SUSE)
maintainerPATCH 1/4 tty: serial: altera_jtaguart: remove flag from altera_jtaguart_rx_chars()
TTY_NORMAL is the only value it contains, so remove the variable and use the constant instead.
--- drivers/tty/serial/altera_jtaguart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/altera_jtaguart.c +2 -3
@@ -126,18 +126,17 @@ static void altera_jtaguart_set_termios(struct uart_port *port,static void altera_jtaguart_rx_chars (struct altera_jtaguart *pp) {struct uart_port *port = &pp->port; -unsigned char ch, flag; +unsigned char ch;unsigned long status;while ((status =readl (port->membase +ALTERA_JTAGUART_DATA_REG )) &ALTERA_JTAGUART_DATA_RVALID_MSK ) { ch = status &ALTERA_JTAGUART_DATA_DATA_MSK ; - flag =TTY_NORMAL ; port->icount.rx++;if (uart_handle_sysrq_char (port, ch))continue ; -uart_insert_char (port,0 ,0 , ch, flag); +uart_insert_char (port,0 ,0 , ch,TTY_NORMAL ); }tty_flip_buffer_push (&port->state->port);
Signature · 1 line
2.38.1
Jiri Slaby (SUSE)
maintainerPATCH 2/4 tty: serial: altera_jtaguart: remove unused altera_jtaguart::sigs
Nothing uses struct altera_jtaguart::sigs. Remove it.
--- drivers/tty/serial/altera_jtaguart.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/serial/altera_jtaguart.c +0 -1
@@ -55,7 +55,6 @@*/ struct altera_jtaguart {struct uart_port port; -unsigned int sigs;/* Local copy of line sigs */ unsigned long imr;/* Local IMR mirror */ };
Signature · 1 line
2.38.1
Re: [PATCH 2/4] tty: serial: altera_jtaguart: remove unused altera_jtaguart::sigs
Quoted 4 lines · Jiri Slaby (SUSE)
Nothing uses struct
altera_jtaguart::sigs. Remove it.Cc Tobias Klauser <[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Thanks
Jiri Slaby (SUSE)
maintainerPATCH 3/4 tty: serial: altera_jtaguart: use uart_port::read_status_mask
In reply to Jiri Slaby (SUSE)Instead of self-defined struct altera_jtaguart::imr, use preexisting uart_port::read_status_mask.
Note that imr was ulong. But there is no reason for that, its values are uints. And readl/writel's are used to read it/write to it.
--- drivers/tty/serial/altera_jtaguart.c | 41 +++++++++++----------------- 1 file changed, 16 insertions(+), 25 deletions(-)
drivers/tty/serial/altera_jtaguart.c +16 -25
@@ -55,7 +55,6 @@*/ struct altera_jtaguart {struct uart_port port; -unsigned long imr;/* Local IMR mirror */ };static unsigned int altera_jtaguart_tx_space (struct uart_port *port,u32 *ctlp)
@@ -84,29 +83,23 @@ static void altera_jtaguart_set_mctrl(struct uart_port *port, unsigned int sigs)static void altera_jtaguart_start_tx (struct uart_port *port) { -struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); - - pp->imr |=ALTERA_JTAGUART_CONTROL_WE_MSK ; -writel (pp->imr, port->membase +ALTERA_JTAGUART_CONTROL_REG ); + port->read_status_mask |=ALTERA_JTAGUART_CONTROL_WE_MSK ; +writel (port->read_status_mask, + port->membase +ALTERA_JTAGUART_CONTROL_REG ); }static void altera_jtaguart_stop_tx (struct uart_port *port) { -struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); - - pp->imr &= ~ALTERA_JTAGUART_CONTROL_WE_MSK ; -writel (pp->imr, port->membase +ALTERA_JTAGUART_CONTROL_REG ); + port->read_status_mask &= ~ALTERA_JTAGUART_CONTROL_WE_MSK ; +writel (port->read_status_mask, + port->membase +ALTERA_JTAGUART_CONTROL_REG ); }static void altera_jtaguart_stop_rx (struct uart_port *port) { -struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); - - pp->imr &= ~ALTERA_JTAGUART_CONTROL_RE_MSK ; -writel (pp->imr, port->membase +ALTERA_JTAGUART_CONTROL_REG ); + port->read_status_mask &= ~ALTERA_JTAGUART_CONTROL_RE_MSK ; +writel (port->read_status_mask, + port->membase +ALTERA_JTAGUART_CONTROL_REG ); }static void altera_jtaguart_break_ctl (struct uart_port *port,int break_state)
@@ -163,7 +156,7 @@ static irqreturn_t altera_jtaguart_interrupt(int irq, void *data)unsigned int isr; isr = (readl (port->membase +ALTERA_JTAGUART_CONTROL_REG ) >> -ALTERA_JTAGUART_CONTROL_RI_OFF ) & pp->imr; +ALTERA_JTAGUART_CONTROL_RI_OFF ) & port->read_status_mask;spin_lock (&port->lock);
@@ -187,8 +180,6 @@ static void altera_jtaguart_config_port(struct uart_port *port, int flags)static int altera_jtaguart_startup (struct uart_port *port) { -struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port);unsigned long flags;int ret;
@@ -203,8 +194,9 @@ static int altera_jtaguart_startup(struct uart_port *port)spin_lock_irqsave (&port->lock, flags);/* Enable RX interrupts now */ - pp->imr =ALTERA_JTAGUART_CONTROL_RE_MSK ; -writel (pp->imr, port->membase +ALTERA_JTAGUART_CONTROL_REG ); + port->read_status_mask =ALTERA_JTAGUART_CONTROL_RE_MSK ; +writel (port->read_status_mask, + port->membase +ALTERA_JTAGUART_CONTROL_REG );spin_unlock_irqrestore (&port->lock, flags);
@@ -213,15 +205,14 @@ static int altera_jtaguart_startup(struct uart_port *port)static void altera_jtaguart_shutdown (struct uart_port *port) { -struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port);unsigned long flags;spin_lock_irqsave (&port->lock, flags);/* Disable all interrupts now */ - pp->imr =0 ; -writel (pp->imr, port->membase +ALTERA_JTAGUART_CONTROL_REG ); + port->read_status_mask =0 ; +writel (port->read_status_mask, + port->membase +ALTERA_JTAGUART_CONTROL_REG );spin_unlock_irqrestore (&port->lock, flags);
Signature · 1 line
2.38.1
Re: [PATCH 3/4] tty: serial: altera_jtaguart: use uart_port::read_status_mask
Quoted 8 lines · Jiri Slaby (SUSE)
Instead of self-defined struct
altera_jtaguart::imr, use preexistinguart_port::read_status_mask.Note that imr was ulong. But there is no reason for that, its values are uints. And readl/writel's are used to read it/write to it.
Cc Tobias Klauser <[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Thanks
Jiri Slaby (SUSE)
maintainerPATCH 4/4 tty: serial: altera_jtaguart: remove struct altera_jtaguart
In reply to Jiri Slaby (SUSE)It contains only struct uart_port, so no need for another structure. Remove it and convert the rest to use struct uart_port directly.
--- drivers/tty/serial/altera_jtaguart.c | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
drivers/tty/serial/altera_jtaguart.c +9 -20
@@ -50,13 +50,6 @@#define ALTERA_JTAGUART_CONTROL_AC_MSK 0x00000400#define ALTERA_JTAGUART_CONTROL_WSPACE_MSK 0xFFFF0000 -/* -* Local per-uart structure. -*/ -struct altera_jtaguart { -struct uart_port port; -}; -static unsigned int altera_jtaguart_tx_space (struct uart_port *port,u32 *ctlp) {u32 ctl =readl (port->membase +ALTERA_JTAGUART_CONTROL_REG );
@@ -115,9 +108,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port,tty_termios_copy_hw (termios, old); } -static void altera_jtaguart_rx_chars (struct altera_jtaguart *pp) +static void altera_jtaguart_rx_chars (struct uart_port *port) { -struct uart_port *port = &pp->port;unsigned char ch;unsigned long status;
@@ -134,9 +126,8 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp)tty_flip_buffer_push (&port->state->port); } -static void altera_jtaguart_tx_chars (struct altera_jtaguart *pp) +static void altera_jtaguart_tx_chars (struct uart_port *port) { -struct uart_port *port = &pp->port;unsigned int count;u8 ch;
@@ -151,8 +142,6 @@ static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp)static irqreturn_t altera_jtaguart_interrupt (int irq,void *data) {struct uart_port *port = data; -struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port);unsigned int isr; isr = (readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) >>
@@ -161,9 +150,9 @@ static irqreturn_t altera_jtaguart_interrupt(int irq, void *data)spin_lock (&port->lock);if (isr &ALTERA_JTAGUART_CONTROL_RE_MSK ) -altera_jtaguart_rx_chars (pp); +altera_jtaguart_rx_chars (port);if (isr &ALTERA_JTAGUART_CONTROL_WE_MSK ) -altera_jtaguart_tx_chars (pp); +altera_jtaguart_tx_chars (port);spin_unlock (&port->lock);
@@ -265,7 +254,7 @@ static const struct uart_ops altera_jtaguart_ops = { };#define ALTERA_JTAGUART_MAXPORTS 1 -static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS ]; +static struct uart_port altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS ];#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE )
@@ -308,7 +297,7 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char cstatic void altera_jtaguart_console_write (struct console *co,const char *s,unsigned int count) { -struct uart_port *port = &(altera_jtaguart_ports + co->index)->port; +struct uart_port *port = &altera_jtaguart_ports[co->index];uart_console_write (port, s, count, altera_jtaguart_console_putc); }
@@ -320,7 +309,7 @@ static int __init altera_jtaguart_console_setup(struct console *co,if (co->index <0 || co->index >=ALTERA_JTAGUART_MAXPORTS )return -EINVAL ; - port = &altera_jtaguart_ports[co->index].port; + port = &altera_jtaguart_ports[co->index];if (port->membase ==NULL )return -ENODEV ;return 0 ;
@@ -400,7 +389,7 @@ static int altera_jtaguart_probe(struct platform_device *pdev)if (i >=ALTERA_JTAGUART_MAXPORTS )return -EINVAL ; - port = &altera_jtaguart_ports[i].port; + port = &altera_jtaguart_ports[i]; res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (res_mem)
@@ -444,7 +433,7 @@ static int altera_jtaguart_remove(struct platform_device *pdev)if (i ==-1 ) i =0 ; - port = &altera_jtaguart_ports[i].port; + port = &altera_jtaguart_ports[i];uart_remove_one_port (&altera_jtaguart_driver, port);iounmap (port->membase);
Signature · 1 line
2.38.1
Re: [PATCH 4/4] tty: serial: altera_jtaguart: remove struct altera_jtaguart
Quoted 5 lines · Jiri Slaby (SUSE)
It contains only struct
uart_port, so no need for another structure. Remove it and convert the rest to use structuart_portdirectly.Cc Tobias Klauser <[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Thanks
Quoted 5 lines · Jiri Slaby (SUSE)
TTY_NORMALis the only value it contains, so remove the variable and use the constant instead.Cc Tobias Klauser <[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Thanks