Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the code to support Linux 6.x #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions tty/tiny_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,13 @@ static void tiny_set_mctrl(struct uart_port *port, unsigned int mctrl)
static void tiny_break_ctl(struct uart_port *port, int break_state)
{
}

static void tiny_set_termios(struct uart_port *port,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
static void tiny_set_termios(struct uart_port *port,
struct ktermios *new, struct ktermios *old)
#else
static void tiny_set_termios(struct uart_port *port,
struct ktermios *new, const struct ktermios *old)
#endif
{
int baud, quot, cflag = new->c_cflag;
/* get the byte size */
Expand Down
12 changes: 12 additions & 0 deletions tty/tiny_tty.c
Original file line number Diff line number Diff line change
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, struct ktermios *old_termios)
#else
static void tiny_set_termios(struct tty_struct *tty, const 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 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
tiny_tty_driver = alloc_tty_driver(TINY_TTY_MINORS);
#else
tiny_tty_driver = tty_alloc_driver(TINY_TTY_MINORS, 0);
#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");
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
put_tty_driver(tiny_tty_driver);
#else
tty_driver_kref_put(tiny_tty_driver);
#endif
return retval;
}

Expand Down