serial: 8250_exar: Consolidate callback assignments in default_setup()
For better maintenance consolidate port callbacks in default_setup(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20190805142535.21948-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
44e60d527e
commit
653d00c8d0
|
@ -166,6 +166,26 @@ static void xr17v35x_set_divisor(struct uart_port *p, unsigned int baud,
|
|||
serial_port_out(p, 0x2, quot_frac);
|
||||
}
|
||||
|
||||
static void exar_shutdown(struct uart_port *port)
|
||||
{
|
||||
unsigned char lsr;
|
||||
bool tx_complete = 0;
|
||||
struct uart_8250_port *up = up_to_u8250p(port);
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
lsr = serial_in(up, UART_LSR);
|
||||
if (lsr & (UART_LSR_TEMT | UART_LSR_THRE))
|
||||
tx_complete = 1;
|
||||
else
|
||||
tx_complete = 0;
|
||||
msleep(1);
|
||||
} while (!uart_circ_empty(xmit) && !tx_complete && i++ < 1000);
|
||||
|
||||
serial8250_do_shutdown(port);
|
||||
}
|
||||
|
||||
static int default_setup(struct exar8250 *priv, struct pci_dev *pcidev,
|
||||
int idx, unsigned int offset,
|
||||
struct uart_8250_port *port)
|
||||
|
@ -197,6 +217,7 @@ static int default_setup(struct exar8250 *priv, struct pci_dev *pcidev,
|
|||
}
|
||||
|
||||
port->port.pm = exar_pm;
|
||||
port->port.shutdown = exar_shutdown;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -519,27 +540,6 @@ static irqreturn_t exar_misc_handler(int irq, void *data)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void
|
||||
exar_shutdown(struct uart_port *port)
|
||||
{
|
||||
unsigned char lsr;
|
||||
bool tx_complete = 0;
|
||||
struct uart_8250_port *up = up_to_u8250p(port);
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
lsr = serial_in(up, UART_LSR);
|
||||
if (lsr & (UART_LSR_TEMT | UART_LSR_THRE))
|
||||
tx_complete = 1;
|
||||
else
|
||||
tx_complete = 0;
|
||||
msleep(1);
|
||||
} while (!uart_circ_empty(xmit) && !tx_complete && i++ < 1000);
|
||||
|
||||
serial8250_do_shutdown(port);
|
||||
}
|
||||
|
||||
static int
|
||||
exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
|
||||
{
|
||||
|
@ -580,7 +580,6 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
|
|||
uart.port.flags = UPF_SHARE_IRQ | UPF_EXAR_EFR | UPF_FIXED_TYPE | UPF_FIXED_PORT;
|
||||
uart.port.irq = pci_irq_vector(pcidev, 0);
|
||||
uart.port.dev = &pcidev->dev;
|
||||
uart.port.shutdown = exar_shutdown;
|
||||
|
||||
rc = devm_request_irq(&pcidev->dev, uart.port.irq, exar_misc_handler,
|
||||
IRQF_SHARED, "exar_uart", priv);
|
||||
|
|
Loading…
Reference in New Issue