#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/slab.h>
+#include <linux/sched/signal.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/of.h>
#include <linux/mutex.h>
#include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
/*
* This is used to lock changes in serial line configuration.
static inline void uart_port_deref(struct uart_port *uport)
{
- if (uport && atomic_dec_and_test(&uport->state->refcount))
+ if (atomic_dec_and_test(&uport->state->refcount))
wake_up(&uport->state->remove_wait);
}
#define uart_port_unlock(uport, flags) \
({ \
struct uart_port *__uport = uport; \
- if (__uport) \
+ if (__uport) { \
spin_unlock_irqrestore(&__uport->lock, flags); \
- uart_port_deref(__uport); \
+ uart_port_deref(__uport); \
+ } \
})
static inline struct uart_port *uart_port_check(struct uart_state *state)
unsigned long char_time, expire;
port = uart_port_ref(state);
- if (!port || port->type == PORT_UNKNOWN || port->fifosize == 0) {
+ if (!port)
+ return;
+
+ if (port->type == PORT_UNKNOWN || port->fifosize == 0) {
uart_port_deref(port);
return;
}
if (state) {
port = uart_port_ref(state);
- if (port)
+ if (port) {
ret = port->ops->poll_get_char(port);
- uart_port_deref(port);
+ uart_port_deref(port);
+ }
}
return ret;
}