Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tty/tiny_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ static void tiny_break_ctl(struct uart_port *port, int break_state)
{
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void tiny_set_termios(struct uart_port *port,
struct ktermios *new, const struct ktermios *old)
#else
static void tiny_set_termios(struct uart_port *port,
struct ktermios *new, struct ktermios *old)
#endif
{
int baud, quot, cflag = new->c_cflag;
/* get the byte size */
Expand Down Expand Up @@ -186,7 +191,7 @@ static void tiny_set_termios(struct uart_port *port,
/* Set baud rate */
baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16);
quot = uart_get_divisor(port, baud);

//UART_PUT_DIV_LO(port, (quot & 0xff));
//UART_PUT_DIV_HI(port, ((quot & 0xf00) >> 8));
}
Expand Down
18 changes: 15 additions & 3 deletions tty/tiny_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static int tiny_write(struct tty_struct *tty,
return retval;
}

#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
static int tiny_write_room(struct tty_struct *tty)
#else
static unsigned int tiny_write_room(struct tty_struct *tty)
Expand Down Expand Up @@ -223,7 +223,11 @@ static unsigned int tiny_write_room(struct tty_struct *tty)

#define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void tiny_set_termios(struct tty_struct *tty, const struct ktermios *old_termios)
#else
static void tiny_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
#endif
{
unsigned int cflag;

Expand Down Expand Up @@ -511,7 +515,11 @@ static int __init tiny_init(void)
int i;

/* allocate the tty driver */
tiny_tty_driver = alloc_tty_driver(TINY_TTY_MINORS);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
tiny_tty_driver = tty_alloc_driver(TINY_TTY_MINORS, 0);
#else
tiny_tty_driver = alloc_tty_driver(TINY_TTY_MINORS);
#endif
if (!tiny_tty_driver)
return -ENOMEM;

Expand All @@ -535,7 +543,11 @@ static int __init tiny_init(void)
retval = tty_register_driver(tiny_tty_driver);
if (retval) {
pr_err("failed to register tiny tty driver");
put_tty_driver(tiny_tty_driver);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
tty_driver_kref_put(tiny_tty_driver);
#else
put_tty_driver(tiny_tty_driver);
#endif
return retval;
}

Expand Down