Commit 4d167f63 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman

tty: serial: altera_jtaguart: remove struct altera_jtaguart

It contains only struct uart_port, so no need for another structure.
Remove it and convert the rest to use struct uart_port directly.

Cc: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarJiri Slaby (SUSE) <jirislaby@kernel.org>
Reviewed-by: default avatarTobias Klauser <tklauser@distanz.ch>
Link: https://lore.kernel.org/r/20221115071724.5185-4-jirislaby@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e2b16a6
...@@ -50,13 +50,6 @@ ...@@ -50,13 +50,6 @@
#define ALTERA_JTAGUART_CONTROL_AC_MSK 0x00000400 #define ALTERA_JTAGUART_CONTROL_AC_MSK 0x00000400
#define ALTERA_JTAGUART_CONTROL_WSPACE_MSK 0xFFFF0000 #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) static unsigned int altera_jtaguart_tx_space(struct uart_port *port, u32 *ctlp)
{ {
u32 ctl = readl(port->membase + ALTERA_JTAGUART_CONTROL_REG); u32 ctl = readl(port->membase + ALTERA_JTAGUART_CONTROL_REG);
...@@ -115,9 +108,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port, ...@@ -115,9 +108,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port,
tty_termios_copy_hw(termios, old); 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 char ch;
unsigned long status; unsigned long status;
...@@ -134,9 +126,8 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp) ...@@ -134,9 +126,8 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp)
tty_flip_buffer_push(&port->state->port); 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; unsigned int count;
u8 ch; u8 ch;
...@@ -151,8 +142,6 @@ static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp) ...@@ -151,8 +142,6 @@ static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp)
static irqreturn_t altera_jtaguart_interrupt(int irq, void *data) static irqreturn_t altera_jtaguart_interrupt(int irq, void *data)
{ {
struct uart_port *port = data; struct uart_port *port = data;
struct altera_jtaguart *pp =
container_of(port, struct altera_jtaguart, port);
unsigned int isr; unsigned int isr;
isr = (readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) >> isr = (readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) >>
...@@ -161,9 +150,9 @@ static irqreturn_t altera_jtaguart_interrupt(int irq, void *data) ...@@ -161,9 +150,9 @@ static irqreturn_t altera_jtaguart_interrupt(int irq, void *data)
spin_lock(&port->lock); spin_lock(&port->lock);
if (isr & ALTERA_JTAGUART_CONTROL_RE_MSK) if (isr & ALTERA_JTAGUART_CONTROL_RE_MSK)
altera_jtaguart_rx_chars(pp); altera_jtaguart_rx_chars(port);
if (isr & ALTERA_JTAGUART_CONTROL_WE_MSK) if (isr & ALTERA_JTAGUART_CONTROL_WE_MSK)
altera_jtaguart_tx_chars(pp); altera_jtaguart_tx_chars(port);
spin_unlock(&port->lock); spin_unlock(&port->lock);
...@@ -265,7 +254,7 @@ static const struct uart_ops altera_jtaguart_ops = { ...@@ -265,7 +254,7 @@ static const struct uart_ops altera_jtaguart_ops = {
}; };
#define ALTERA_JTAGUART_MAXPORTS 1 #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) #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE)
...@@ -308,7 +297,7 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c ...@@ -308,7 +297,7 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c
static void altera_jtaguart_console_write(struct console *co, const char *s, static void altera_jtaguart_console_write(struct console *co, const char *s,
unsigned int count) 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); uart_console_write(port, s, count, altera_jtaguart_console_putc);
} }
...@@ -320,7 +309,7 @@ static int __init altera_jtaguart_console_setup(struct console *co, ...@@ -320,7 +309,7 @@ static int __init altera_jtaguart_console_setup(struct console *co,
if (co->index < 0 || co->index >= ALTERA_JTAGUART_MAXPORTS) if (co->index < 0 || co->index >= ALTERA_JTAGUART_MAXPORTS)
return -EINVAL; return -EINVAL;
port = &altera_jtaguart_ports[co->index].port; port = &altera_jtaguart_ports[co->index];
if (port->membase == NULL) if (port->membase == NULL)
return -ENODEV; return -ENODEV;
return 0; return 0;
...@@ -400,7 +389,7 @@ static int altera_jtaguart_probe(struct platform_device *pdev) ...@@ -400,7 +389,7 @@ static int altera_jtaguart_probe(struct platform_device *pdev)
if (i >= ALTERA_JTAGUART_MAXPORTS) if (i >= ALTERA_JTAGUART_MAXPORTS)
return -EINVAL; return -EINVAL;
port = &altera_jtaguart_ports[i].port; port = &altera_jtaguart_ports[i];
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res_mem) if (res_mem)
...@@ -444,7 +433,7 @@ static int altera_jtaguart_remove(struct platform_device *pdev) ...@@ -444,7 +433,7 @@ static int altera_jtaguart_remove(struct platform_device *pdev)
if (i == -1) if (i == -1)
i = 0; i = 0;
port = &altera_jtaguart_ports[i].port; port = &altera_jtaguart_ports[i];
uart_remove_one_port(&altera_jtaguart_driver, port); uart_remove_one_port(&altera_jtaguart_driver, port);
iounmap(port->membase); iounmap(port->membase);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment