]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
TTY: use tty_port_link_device
authorJiri Slaby <jslaby@suse.cz>
Tue, 7 Aug 2012 19:47:51 +0000 (21:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Aug 2012 23:50:19 +0000 (16:50 -0700)
So now for those drivers that can use neither tty_port_install nor
tty_port_register_driver but still have tty_port available before
tty_register_driver we use newly added tty_port_link_device.

The rest of the drivers that still do not provide tty_struct <->
tty_port link will have to be converted to implement
tty->ops->install.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 files changed:
arch/alpha/kernel/srmcons.c
arch/ia64/hp/sim/simserial.c
arch/parisc/kernel/pdc_cons.c
arch/xtensa/platforms/iss/console.c
drivers/char/ttyprintk.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
drivers/tty/amiserial.c
drivers/tty/bfin_jtag_comm.c
drivers/tty/hvc/hvsi.c
drivers/tty/serial/68328serial.c
drivers/tty/serial/crisv10.c

index 3ea809430eda0f3ea018df2b540a75614846ce05..5d5865204a1d4739b0836bed605b5220192ad1b7 100644 (file)
@@ -223,6 +223,7 @@ srmcons_init(void)
                driver->subtype = SYSTEM_TYPE_SYSCONS;
                driver->init_termios = tty_std_termios;
                tty_set_operations(driver, &srmcons_ops);
+               tty_port_link_device(&srmcons_singleton.port, driver, 0);
                err = tty_register_driver(driver);
                if (err) {
                        put_tty_driver(driver);
index 1ce97f497d23952d1b8357f18cf2432c96ddf00e..ec536e4e36c9fcbd71646c34c7cd5914f654f695 100644 (file)
@@ -545,6 +545,7 @@ static int __init simrs_init(void)
        /* the port is imaginary */
        printk(KERN_INFO "ttyS0 at 0x03f8 (irq = %d) is a 16550\n", state->irq);
 
+       tty_port_link_device(&state->port, hp_simserial_driver, 0);
        retval = tty_register_driver(hp_simserial_driver);
        if (retval) {
                printk(KERN_ERR "Couldn't register simserial driver\n");
index 47341aa208f2b417ac2c31aabc292fadcbf008ab..88238638aee67a7c6bf84cdc23756806c16a5d77 100644 (file)
@@ -202,6 +202,7 @@ static int __init pdc_console_tty_driver_init(void)
        pdc_console_tty_driver->flags = TTY_DRIVER_REAL_RAW |
                TTY_DRIVER_RESET_TERMIOS;
        tty_set_operations(pdc_console_tty_driver, &pdc_console_tty_ops);
+       tty_port_link_device(&tty_port, pdc_console_tty_driver, 0);
 
        err = tty_register_driver(pdc_console_tty_driver);
        if (err) {
index f9726f6afdf1f00432ca627820f61ab56f6c109c..2cd3d3a3400b483290075843d8e538da17c51986 100644 (file)
@@ -223,6 +223,7 @@ int __init rs_init(void)
        serial_driver->flags = TTY_DRIVER_REAL_RAW;
 
        tty_set_operations(serial_driver, &serial_ops);
+       tty_port_link_device(&serial_port, serial_driver, 0);
 
        if (tty_register_driver(serial_driver))
                panic("Couldn't register serial driver\n");
index 9e6272f0b98c0052361658cb6764b635cf72800a..561f8aa7cd87ae48b8ab0dc6fbe36319ebcb99c9 100644 (file)
@@ -198,6 +198,7 @@ static int __init ttyprintk_init(void)
        ttyprintk_driver->init_termios = tty_std_termios;
        ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET;
        tty_set_operations(ttyprintk_driver, &ttyprintk_ops);
+       tty_port_link_device(&tpk_port.port, ttyprintk_driver, 0);
 
        ret = tty_register_driver(ttyprintk_driver);
        if (ret < 0) {
index 0792c85baafebdefcad5888423ff5b0bc19bee35..30ec09e3d037c7c25cfb382fd89d7c1c742f038a 100644 (file)
@@ -567,6 +567,7 @@ sclp_tty_init(void)
        driver->init_termios.c_lflag = ISIG | ECHO;
        driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(driver, &sclp_ops);
+       tty_port_link_device(&sclp_port, driver, 0);
        rc = tty_register_driver(driver);
        if (rc) {
                put_tty_driver(driver);
index edfc0fd73dc682753ab3b1ac09c43fc8b0509de8..7e60f3d2f3f9cf27de4e5c4c4ae9d743503a68ce 100644 (file)
@@ -691,6 +691,7 @@ static int __init sclp_vt220_tty_init(void)
        driver->init_termios = tty_std_termios;
        driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(driver, &sclp_vt220_ops);
+       tty_port_link_device(&sclp_vt220_port, driver, 0);
 
        rc = tty_register_driver(driver);
        if (rc)
index 998731f01d62a6ac3773c0239a4a95f8c2a6d4f2..2b7535d42e05fc808d9f3eda9f176b365050c0e9 100644 (file)
@@ -1710,10 +1710,6 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
        serial_driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(serial_driver, &serial_ops);
 
-       error = tty_register_driver(serial_driver);
-       if (error)
-               goto fail_put_tty_driver;
-
        state = rs_table;
        state->port = (int)&custom.serdatr; /* Just to give it a value */
        state->custom_divisor = 0;
@@ -1724,6 +1720,11 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
        state->icount.overrun = state->icount.brk = 0;
        tty_port_init(&state->tport);
        state->tport.ops = &amiga_port_ops;
+       tty_port_link_device(&state->tport, serial_driver, 0);
+
+       error = tty_register_driver(serial_driver);
+       if (error)
+               goto fail_put_tty_driver;
 
        printk(KERN_INFO "ttyS0 is the amiga builtin serial port\n");
 
index 61fc74fe17473d56e2f2fe18bca2dee83dd27bac..02b7d3a09696cc6683c51fb9d02866d1ce75999b 100644 (file)
@@ -263,6 +263,7 @@ static int __init bfin_jc_init(void)
        bfin_jc_driver->subtype      = SERIAL_TYPE_NORMAL;
        bfin_jc_driver->init_termios = tty_std_termios;
        tty_set_operations(bfin_jc_driver, &bfin_jc_ops);
+       tty_port_link_device(&port, bfin_jc_driver, 0);
 
        ret = tty_register_driver(bfin_jc_driver);
        if (ret)
index 6f5bc49c441fa5c806d316c851f376c20914ad4f..0083bc1f63f43a37c8cc5f531da88f6a24729952 100644 (file)
@@ -1080,6 +1080,8 @@ static int __init hvsi_init(void)
                struct hvsi_struct *hp = &hvsi_ports[i];
                int ret = 1;
 
+               tty_port_link_device(&hp->port, hvsi_driver, i);
+
                ret = request_irq(hp->virq, hvsi_interrupt, 0, "hvsi", hp);
                if (ret)
                        printk(KERN_ERR "HVSI: couldn't reserve irq 0x%x (error %i)\n",
index cc4c092fef067cdca5c2e0fb1c8fd182daad691c..66c38a3f74cebdbaaefc192e2a923827c050d63e 100644 (file)
@@ -1189,12 +1189,6 @@ rs68328_init(void)
        serial_driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(serial_driver, &rs_ops);
 
-       if (tty_register_driver(serial_driver)) {
-               put_tty_driver(serial_driver);
-               printk(KERN_ERR "Couldn't register serial driver\n");
-               return -ENOMEM;
-       }
-
        local_irq_save(flags);
 
        for(i=0;i<NR_PORTS;i++) {
@@ -1224,8 +1218,17 @@ rs68328_init(void)
                            0,
                            "M68328_UART", info))
                 panic("Unable to attach 68328 serial interrupt\n");
+
+           tty_port_link_device(&info->tport, serial_driver, i);
        }
        local_irq_restore(flags);
+
+       if (tty_register_driver(serial_driver)) {
+               put_tty_driver(serial_driver);
+               printk(KERN_ERR "Couldn't register serial driver\n");
+               return -ENOMEM;
+       }
+
        return 0;
 }
 
index 5ecec3b120e78020e05777d08be3712dd74be68b..35ee6a2c6877ef45a599351ff5fd74c8c142fe99 100644 (file)
@@ -4447,10 +4447,8 @@ static int __init rs_init(void)
 
        tty_set_operations(driver, &rs_ops);
         serial_driver = driver;
-       if (tty_register_driver(driver))
-               panic("Couldn't register serial driver\n");
-       /* do some initializing for the separate ports */
 
+       /* do some initializing for the separate ports */
        for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
                if (info->enabled) {
                        if (cris_request_io_interface(info->io_if,
@@ -4502,7 +4500,12 @@ static int __init rs_init(void)
                        printk(KERN_INFO "%s%d at %p is a builtin UART with DMA\n",
                               serial_driver->name, info->line, info->ioport);
                }
+               tty_port_link_device(&info->port, driver, i);
        }
+
+       if (tty_register_driver(driver))
+               panic("Couldn't register serial driver\n");
+
 #ifdef CONFIG_ETRAX_FAST_TIMER
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
        memset(fast_timers, 0, sizeof(fast_timers));