Commit 81680702 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

amiserial: expand "custom"

"custom" macro is a too generic name. Expand it -- that is use
amiga_custom on all the locations.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210714091314.8292-8-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 93525619
...@@ -87,8 +87,6 @@ struct serial_state { ...@@ -87,8 +87,6 @@ struct serial_state {
int x_char; /* xon/xoff character */ int x_char; /* xon/xoff character */
}; };
#define custom amiga_custom
static struct tty_driver *serial_driver; static struct tty_driver *serial_driver;
/* number of characters left in xmit buffer before we ask for more */ /* number of characters left in xmit buffer before we ask for more */
...@@ -148,9 +146,9 @@ static void rs_stop(struct tty_struct *tty) ...@@ -148,9 +146,9 @@ static void rs_stop(struct tty_struct *tty)
if (info->IER & UART_IER_THRI) { if (info->IER & UART_IER_THRI) {
info->IER &= ~UART_IER_THRI; info->IER &= ~UART_IER_THRI;
/* disable Tx interrupt and remove any pending interrupts */ /* disable Tx interrupt and remove any pending interrupts */
custom.intena = IF_TBE; amiga_custom.intena = IF_TBE;
mb(); mb();
custom.intreq = IF_TBE; amiga_custom.intreq = IF_TBE;
mb(); mb();
} }
local_irq_restore(flags); local_irq_restore(flags);
...@@ -166,10 +164,10 @@ static void rs_start(struct tty_struct *tty) ...@@ -166,10 +164,10 @@ static void rs_start(struct tty_struct *tty)
&& info->xmit.buf && info->xmit.buf
&& !(info->IER & UART_IER_THRI)) { && !(info->IER & UART_IER_THRI)) {
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
custom.intena = IF_SETCLR | IF_TBE; amiga_custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; amiga_custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
} }
local_irq_restore(flags); local_irq_restore(flags);
...@@ -194,9 +192,9 @@ static void receive_chars(struct serial_state *info) ...@@ -194,9 +192,9 @@ static void receive_chars(struct serial_state *info)
icount = &info->icount; icount = &info->icount;
status = UART_LSR_DR; /* We obviously have a character! */ status = UART_LSR_DR; /* We obviously have a character! */
serdatr = custom.serdatr; serdatr = amiga_custom.serdatr;
mb(); mb();
custom.intreq = IF_RBF; amiga_custom.intreq = IF_RBF;
mb(); mb();
if((serdatr & 0x1ff) == 0) if((serdatr & 0x1ff) == 0)
...@@ -273,10 +271,10 @@ static void receive_chars(struct serial_state *info) ...@@ -273,10 +271,10 @@ static void receive_chars(struct serial_state *info)
static void transmit_chars(struct serial_state *info) static void transmit_chars(struct serial_state *info)
{ {
custom.intreq = IF_TBE; amiga_custom.intreq = IF_TBE;
mb(); mb();
if (info->x_char) { if (info->x_char) {
custom.serdat = info->x_char | 0x100; amiga_custom.serdat = info->x_char | 0x100;
mb(); mb();
info->icount.tx++; info->icount.tx++;
info->x_char = 0; info->x_char = 0;
...@@ -286,12 +284,12 @@ static void transmit_chars(struct serial_state *info) ...@@ -286,12 +284,12 @@ static void transmit_chars(struct serial_state *info)
|| info->tport.tty->flow.stopped || info->tport.tty->flow.stopped
|| info->tport.tty->hw_stopped) { || info->tport.tty->hw_stopped) {
info->IER &= ~UART_IER_THRI; info->IER &= ~UART_IER_THRI;
custom.intena = IF_TBE; amiga_custom.intena = IF_TBE;
mb(); mb();
return; return;
} }
custom.serdat = info->xmit.buf[info->xmit.tail++] | 0x100; amiga_custom.serdat = info->xmit.buf[info->xmit.tail++] | 0x100;
mb(); mb();
info->xmit.tail = info->xmit.tail & (SERIAL_XMIT_SIZE-1); info->xmit.tail = info->xmit.tail & (SERIAL_XMIT_SIZE-1);
info->icount.tx++; info->icount.tx++;
...@@ -305,7 +303,7 @@ static void transmit_chars(struct serial_state *info) ...@@ -305,7 +303,7 @@ static void transmit_chars(struct serial_state *info)
printk("THRE..."); printk("THRE...");
#endif #endif
if (info->xmit.head == info->xmit.tail) { if (info->xmit.head == info->xmit.tail) {
custom.intena = IF_TBE; amiga_custom.intena = IF_TBE;
mb(); mb();
info->IER &= ~UART_IER_THRI; info->IER &= ~UART_IER_THRI;
} }
...@@ -358,10 +356,10 @@ static void check_modem_status(struct serial_state *info) ...@@ -358,10 +356,10 @@ static void check_modem_status(struct serial_state *info)
#endif #endif
port->tty->hw_stopped = 0; port->tty->hw_stopped = 0;
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
custom.intena = IF_SETCLR | IF_TBE; amiga_custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; amiga_custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
tty_wakeup(port->tty); tty_wakeup(port->tty);
return; return;
...@@ -374,9 +372,9 @@ static void check_modem_status(struct serial_state *info) ...@@ -374,9 +372,9 @@ static void check_modem_status(struct serial_state *info)
port->tty->hw_stopped = 1; port->tty->hw_stopped = 1;
info->IER &= ~UART_IER_THRI; info->IER &= ~UART_IER_THRI;
/* disable Tx interrupt and remove any pending interrupts */ /* disable Tx interrupt and remove any pending interrupts */
custom.intena = IF_TBE; amiga_custom.intena = IF_TBE;
mb(); mb();
custom.intreq = IF_TBE; amiga_custom.intreq = IF_TBE;
mb(); mb();
} }
} }
...@@ -418,7 +416,7 @@ static irqreturn_t ser_tx_int(int irq, void *dev_id) ...@@ -418,7 +416,7 @@ static irqreturn_t ser_tx_int(int irq, void *dev_id)
{ {
struct serial_state *info = dev_id; struct serial_state *info = dev_id;
if (custom.serdatr & SDR_TBE) { if (amiga_custom.serdatr & SDR_TBE) {
#ifdef SERIAL_DEBUG_INTR #ifdef SERIAL_DEBUG_INTR
printk("ser_tx_int..."); printk("ser_tx_int...");
#endif #endif
...@@ -478,7 +476,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info) ...@@ -478,7 +476,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
/* Clear anything in the input buffer */ /* Clear anything in the input buffer */
custom.intreq = IF_RBF; amiga_custom.intreq = IF_RBF;
mb(); mb();
retval = request_irq(IRQ_AMIGA_VERTB, ser_vbl_int, 0, "serial status", info); retval = request_irq(IRQ_AMIGA_VERTB, ser_vbl_int, 0, "serial status", info);
...@@ -491,7 +489,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info) ...@@ -491,7 +489,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
} }
/* enable both Rx and Tx interrupts */ /* enable both Rx and Tx interrupts */
custom.intena = IF_SETCLR | IF_RBF | IF_TBE; amiga_custom.intena = IF_SETCLR | IF_RBF | IF_TBE;
mb(); mb();
info->IER = UART_IER_MSI; info->IER = UART_IER_MSI;
...@@ -557,11 +555,11 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info) ...@@ -557,11 +555,11 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
} }
info->IER = 0; info->IER = 0;
custom.intena = IF_RBF | IF_TBE; amiga_custom.intena = IF_RBF | IF_TBE;
mb(); mb();
/* disable break condition */ /* disable break condition */
custom.adkcon = AC_UARTBRK; amiga_custom.adkcon = AC_UARTBRK;
mb(); mb();
if (C_HUPCL(tty)) if (C_HUPCL(tty))
...@@ -705,7 +703,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info, ...@@ -705,7 +703,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
if(cval & UART_LCR_PARITY) if(cval & UART_LCR_PARITY)
serper |= (SERPER_PARENB); serper |= (SERPER_PARENB);
custom.serper = serper; amiga_custom.serper = serper;
mb(); mb();
} }
...@@ -749,10 +747,10 @@ static void rs_flush_chars(struct tty_struct *tty) ...@@ -749,10 +747,10 @@ static void rs_flush_chars(struct tty_struct *tty)
local_irq_save(flags); local_irq_save(flags);
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
custom.intena = IF_SETCLR | IF_TBE; amiga_custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; amiga_custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -791,10 +789,10 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count ...@@ -791,10 +789,10 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
&& !(info->IER & UART_IER_THRI)) { && !(info->IER & UART_IER_THRI)) {
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
local_irq_disable(); local_irq_disable();
custom.intena = IF_SETCLR | IF_TBE; amiga_custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; amiga_custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -841,11 +839,11 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) ...@@ -841,11 +839,11 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
/* Check this ! */ /* Check this ! */
local_irq_save(flags); local_irq_save(flags);
if(!(custom.intenar & IF_TBE)) { if(!(amiga_custom.intenar & IF_TBE)) {
custom.intena = IF_SETCLR | IF_TBE; amiga_custom.intena = IF_SETCLR | IF_TBE;
mb(); mb();
/* set a pending Tx Interrupt, transmitter should restart now */ /* set a pending Tx Interrupt, transmitter should restart now */
custom.intreq = IF_SETCLR | IF_TBE; amiga_custom.intreq = IF_SETCLR | IF_TBE;
mb(); mb();
} }
local_irq_restore(flags); local_irq_restore(flags);
...@@ -1016,7 +1014,7 @@ static int get_lsr_info(struct serial_state *info, unsigned int __user *value) ...@@ -1016,7 +1014,7 @@ static int get_lsr_info(struct serial_state *info, unsigned int __user *value)
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
status = custom.serdatr; status = amiga_custom.serdatr;
mb(); mb();
local_irq_restore(flags); local_irq_restore(flags);
result = ((status & SDR_TSRE) ? TIOCSER_TEMT : 0); result = ((status & SDR_TSRE) ? TIOCSER_TEMT : 0);
...@@ -1078,9 +1076,9 @@ static int rs_break(struct tty_struct *tty, int break_state) ...@@ -1078,9 +1076,9 @@ static int rs_break(struct tty_struct *tty, int break_state)
local_irq_save(flags); local_irq_save(flags);
if (break_state == -1) if (break_state == -1)
custom.adkcon = AC_SETCLR | AC_UARTBRK; amiga_custom.adkcon = AC_SETCLR | AC_UARTBRK;
else else
custom.adkcon = AC_UARTBRK; amiga_custom.adkcon = AC_UARTBRK;
mb(); mb();
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
...@@ -1257,10 +1255,10 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1257,10 +1255,10 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
state->read_status_mask &= ~UART_LSR_DR; state->read_status_mask &= ~UART_LSR_DR;
if (tty_port_initialized(port)) { if (tty_port_initialized(port)) {
/* disable receive interrupts */ /* disable receive interrupts */
custom.intena = IF_RBF; amiga_custom.intena = IF_RBF;
mb(); mb();
/* clear any pending receive interrupt */ /* clear any pending receive interrupt */
custom.intreq = IF_RBF; amiga_custom.intreq = IF_RBF;
mb(); mb();
/* /*
...@@ -1319,7 +1317,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1319,7 +1317,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
printk("In rs_wait_until_sent(%d) check=%lu...", timeout, char_time); printk("In rs_wait_until_sent(%d) check=%lu...", timeout, char_time);
printk("jiff=%lu...", jiffies); printk("jiff=%lu...", jiffies);
#endif #endif
while(!((lsr = custom.serdatr) & SDR_TSRE)) { while(!((lsr = amiga_custom.serdatr) & SDR_TSRE)) {
#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
printk("serdatr = %d (jiff=%lu)...", lsr, jiffies); printk("serdatr = %d (jiff=%lu)...", lsr, jiffies);
#endif #endif
...@@ -1526,7 +1524,7 @@ static int __init amiga_serial_probe(struct platform_device *pdev) ...@@ -1526,7 +1524,7 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
state = rs_table; state = rs_table;
memset(state, 0, sizeof(*state)); memset(state, 0, sizeof(*state));
state->port = (int)&custom.serdatr; /* Just to give it a value */ state->port = (int)&amiga_custom.serdatr; /* Just to give it a value */
tty_port_init(&state->tport); tty_port_init(&state->tport);
state->tport.ops = &amiga_port_ops; state->tport.ops = &amiga_port_ops;
tty_port_link_device(&state->tport, serial_driver, 0); tty_port_link_device(&state->tport, serial_driver, 0);
...@@ -1554,11 +1552,11 @@ static int __init amiga_serial_probe(struct platform_device *pdev) ...@@ -1554,11 +1552,11 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
local_irq_save(flags); local_irq_save(flags);
/* turn off Rx and Tx interrupts */ /* turn off Rx and Tx interrupts */
custom.intena = IF_RBF | IF_TBE; amiga_custom.intena = IF_RBF | IF_TBE;
mb(); mb();
/* clear any pending interrupt */ /* clear any pending interrupt */
custom.intreq = IF_RBF | IF_TBE; amiga_custom.intreq = IF_RBF | IF_TBE;
mb(); mb();
local_irq_restore(flags); local_irq_restore(flags);
...@@ -1618,8 +1616,8 @@ module_platform_driver_probe(amiga_serial_driver, amiga_serial_probe); ...@@ -1618,8 +1616,8 @@ module_platform_driver_probe(amiga_serial_driver, amiga_serial_probe);
static void amiga_serial_putc(char c) static void amiga_serial_putc(char c)
{ {
custom.serdat = (unsigned char)c | 0x100; amiga_custom.serdat = (unsigned char)c | 0x100;
while (!(custom.serdatr & 0x2000)) while (!(amiga_custom.serdatr & 0x2000))
barrier(); barrier();
} }
...@@ -1632,9 +1630,9 @@ static void amiga_serial_putc(char c) ...@@ -1632,9 +1630,9 @@ static void amiga_serial_putc(char c)
static void serial_console_write(struct console *co, const char *s, static void serial_console_write(struct console *co, const char *s,
unsigned count) unsigned count)
{ {
unsigned short intena = custom.intenar; unsigned short intena = amiga_custom.intenar;
custom.intena = IF_TBE; amiga_custom.intena = IF_TBE;
while (count--) { while (count--) {
if (*s == '\n') if (*s == '\n')
...@@ -1642,7 +1640,7 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -1642,7 +1640,7 @@ static void serial_console_write(struct console *co, const char *s,
amiga_serial_putc(*s++); amiga_serial_putc(*s++);
} }
custom.intena = IF_SETCLR | (intena & IF_TBE); amiga_custom.intena = IF_SETCLR | (intena & IF_TBE);
} }
static struct tty_driver *serial_console_device(struct console *c, int *index) static struct tty_driver *serial_console_device(struct console *c, int *index)
......
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