Merge tag 'xtensa-20210902' of git://github.com/jcmvbkbc/linux-xtensa
[linux-2.6-microblaze.git] / arch / xtensa / platforms / iss / console.c
index 9c3cf36..81d7c7e 100644 (file)
@@ -139,9 +139,9 @@ static int __init rs_init(void)
        struct tty_driver *driver;
        int ret;
 
-       driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES);
-       if (!driver)
-               return -ENOMEM;
+       driver = tty_alloc_driver(SERIAL_MAX_NUM_LINES, TTY_DRIVER_REAL_RAW);
+       if (IS_ERR(driver))
+               return PTR_ERR(driver);
 
        tty_port_init(&serial_port);
 
@@ -156,7 +156,6 @@ static int __init rs_init(void)
        driver->init_termios = tty_std_termios;
        driver->init_termios.c_cflag =
                B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-       driver->flags = TTY_DRIVER_REAL_RAW;
 
        tty_set_operations(driver, &serial_ops);
        tty_port_link_device(&serial_port, driver, 0);
@@ -179,7 +178,7 @@ static int __init rs_init(void)
 static __exit void rs_exit(void)
 {
        tty_unregister_driver(serial_driver);
-       put_tty_driver(serial_driver);
+       tty_driver_kref_put(serial_driver);
        tty_port_destroy(&serial_port);
 }
 
@@ -200,10 +199,10 @@ late_initcall(rs_init);
 
 static void iss_console_write(struct console *co, const char *s, unsigned count)
 {
-       int len = strlen(s);
-
-       if (s != 0 && *s != 0)
+       if (s && *s != 0) {
+               int len = strlen(s);
                simc_write(1, s, count < len ? count : len);
+       }
 }
 
 static struct tty_driver* iss_console_device(struct console *c, int *index)