.. | .. |
---|
199 | 199 | */ |
---|
200 | 200 | } |
---|
201 | 201 | |
---|
202 | | -static void altera_uart_rx_chars(struct altera_uart *pp) |
---|
| 202 | +static void altera_uart_rx_chars(struct uart_port *port) |
---|
203 | 203 | { |
---|
204 | | - struct uart_port *port = &pp->port; |
---|
205 | 204 | unsigned char ch, flag; |
---|
206 | 205 | unsigned short status; |
---|
207 | 206 | |
---|
.. | .. |
---|
248 | 247 | spin_lock(&port->lock); |
---|
249 | 248 | } |
---|
250 | 249 | |
---|
251 | | -static void altera_uart_tx_chars(struct altera_uart *pp) |
---|
| 250 | +static void altera_uart_tx_chars(struct uart_port *port) |
---|
252 | 251 | { |
---|
253 | | - struct uart_port *port = &pp->port; |
---|
254 | 252 | struct circ_buf *xmit = &port->state->xmit; |
---|
255 | 253 | |
---|
256 | 254 | if (port->x_char) { |
---|
.. | .. |
---|
274 | 272 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
---|
275 | 273 | uart_write_wakeup(port); |
---|
276 | 274 | |
---|
277 | | - if (xmit->head == xmit->tail) { |
---|
278 | | - pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK; |
---|
279 | | - altera_uart_update_ctrl_reg(pp); |
---|
280 | | - } |
---|
| 275 | + if (uart_circ_empty(xmit)) |
---|
| 276 | + altera_uart_stop_tx(port); |
---|
281 | 277 | } |
---|
282 | 278 | |
---|
283 | 279 | static irqreturn_t altera_uart_interrupt(int irq, void *data) |
---|
284 | 280 | { |
---|
285 | 281 | struct uart_port *port = data; |
---|
286 | 282 | struct altera_uart *pp = container_of(port, struct altera_uart, port); |
---|
| 283 | + unsigned long flags; |
---|
287 | 284 | unsigned int isr; |
---|
288 | 285 | |
---|
289 | 286 | isr = altera_uart_readl(port, ALTERA_UART_STATUS_REG) & pp->imr; |
---|
290 | 287 | |
---|
291 | | - spin_lock(&port->lock); |
---|
| 288 | + spin_lock_irqsave(&port->lock, flags); |
---|
292 | 289 | if (isr & ALTERA_UART_STATUS_RRDY_MSK) |
---|
293 | | - altera_uart_rx_chars(pp); |
---|
| 290 | + altera_uart_rx_chars(port); |
---|
294 | 291 | if (isr & ALTERA_UART_STATUS_TRDY_MSK) |
---|
295 | | - altera_uart_tx_chars(pp); |
---|
296 | | - spin_unlock(&port->lock); |
---|
| 292 | + altera_uart_tx_chars(port); |
---|
| 293 | + spin_unlock_irqrestore(&port->lock, flags); |
---|
297 | 294 | |
---|
298 | 295 | return IRQ_RETVAL(isr); |
---|
299 | 296 | } |
---|