const: constify remaining file_operations
[safe/jmp/linux-2.6] / drivers / char / vme_scc.c
index 0cdbaa7..994e1a5 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/kdev_t.h>
 #include <asm/io.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
@@ -70,7 +69,7 @@ static void scc_disable_tx_interrupts(void * ptr);
 static void scc_enable_tx_interrupts(void * ptr);
 static void scc_disable_rx_interrupts(void * ptr);
 static void scc_enable_rx_interrupts(void * ptr);
-static int  scc_get_CD(void * ptr);
+static int  scc_carrier_raised(struct tty_port *port);
 static void scc_shutdown_port(void * ptr);
 static int scc_set_real_termios(void  *ptr);
 static void scc_hungup(void  *ptr);
@@ -86,13 +85,11 @@ static irqreturn_t scc_rx_int(int irq, void *data);
 static irqreturn_t scc_stat_int(int irq, void *data);
 static irqreturn_t scc_spcond_int(int irq, void *data);
 static void scc_setsignals(struct scc_port *port, int dtr, int rts);
-static void scc_break_ctl(struct tty_struct *tty, int break_state);
+static int scc_break_ctl(struct tty_struct *tty, int break_state);
 
 static struct tty_driver *scc_driver;
 
-struct scc_port scc_ports[2];
-
-int scc_initialized = 0;
+static struct scc_port scc_ports[2];
 
 /*---------------------------------------------------------------------------
  * Interface from generic_serial.c back here
@@ -103,7 +100,6 @@ static struct real_driver scc_real_driver = {
         scc_enable_tx_interrupts,
         scc_disable_rx_interrupts,
         scc_enable_rx_interrupts,
-        scc_get_CD,
         scc_shutdown_port,
         scc_set_real_termios,
         scc_chars_in_buffer,
@@ -132,6 +128,10 @@ static const struct tty_operations scc_ops = {
        .break_ctl = scc_break_ctl,
 };
 
+static const struct tty_port_operations scc_port_ops = {
+       .carrier_raised = scc_carrier_raised,
+};
+
 /*----------------------------------------------------------------------------
  * vme_scc_init() and support functions
  *---------------------------------------------------------------------------*/
@@ -153,6 +153,8 @@ static int scc_init_drivers(void)
        scc_driver->init_termios = tty_std_termios;
        scc_driver->init_termios.c_cflag =
          B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+       scc_driver->init_termios.c_ispeed = 9600;
+       scc_driver->init_termios.c_ospeed = 9600;
        scc_driver->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(scc_driver, &scc_ops);
 
@@ -177,6 +179,8 @@ static void scc_init_portstructs(void)
 
        for (i = 0; i < 2; i++) {
                port = scc_ports + i;
+               tty_port_init(&port->gs.port);
+               port->gs.port.ops = &scc_port_ops;
                port->gs.magic = SCC_MAGIC;
                port->gs.close_delay = HZ/2;
                port->gs.closing_wait = 30 * HZ;
@@ -184,8 +188,8 @@ static void scc_init_portstructs(void)
 #ifdef NEW_WRITE_LOCKING
                port->gs.port_write_mutex = MUTEX;
 #endif
-               init_waitqueue_head(&port->gs.open_wait);
-               init_waitqueue_head(&port->gs.close_wait);
+               init_waitqueue_head(&port->gs.port.open_wait);
+               init_waitqueue_head(&port->gs.port.close_wait);
        }
 }
 
@@ -194,6 +198,7 @@ static void scc_init_portstructs(void)
 static int mvme147_scc_init(void)
 {
        struct scc_port *port;
+       int error;
 
        printk(KERN_INFO "SCC: MVME147 Serial Driver\n");
        /* Init channel A */
@@ -203,14 +208,23 @@ static int mvme147_scc_init(void)
        port->datap = port->ctrlp + 1;
        port->port_a = &scc_ports[0];
        port->port_b = &scc_ports[1];
-       request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
+       error = request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
                            "SCC-A TX", port);
-       request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
+       if (error)
+               goto fail;
+       error = request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
                            "SCC-A status", port);
-       request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_a_tx;
+       error = request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
                            "SCC-A RX", port);
-       request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED,
-                           "SCC-A special cond", port);
+       if (error)
+               goto fail_free_a_stat;
+       error = request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int,
+                           IRQF_DISABLED, "SCC-A special cond", port);
+       if (error)
+               goto fail_free_a_rx;
+
        {
                SCC_ACCESS_INIT(port);
 
@@ -230,14 +244,23 @@ static int mvme147_scc_init(void)
        port->datap = port->ctrlp + 1;
        port->port_a = &scc_ports[0];
        port->port_b = &scc_ports[1];
-       request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
+       error = request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
                            "SCC-B TX", port);
-       request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_a_spcond;
+       error = request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
                            "SCC-B status", port);
-       request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_b_tx;
+       error = request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
                            "SCC-B RX", port);
-       request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED,
-                           "SCC-B special cond", port);
+       if (error)
+               goto fail_free_b_stat;
+       error = request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int,
+                           IRQF_DISABLED, "SCC-B special cond", port);
+       if (error)
+               goto fail_free_b_rx;
+
        {
                SCC_ACCESS_INIT(port);
 
@@ -253,6 +276,23 @@ static int mvme147_scc_init(void)
        scc_init_drivers();
 
        return 0;
+
+fail_free_b_rx:
+       free_irq(MVME147_IRQ_SCCB_RX, port);
+fail_free_b_stat:
+       free_irq(MVME147_IRQ_SCCB_STAT, port);
+fail_free_b_tx:
+       free_irq(MVME147_IRQ_SCCB_TX, port);
+fail_free_a_spcond:
+       free_irq(MVME147_IRQ_SCCA_SPCOND, port);
+fail_free_a_rx:
+       free_irq(MVME147_IRQ_SCCA_RX, port);
+fail_free_a_stat:
+       free_irq(MVME147_IRQ_SCCA_STAT, port);
+fail_free_a_tx:
+       free_irq(MVME147_IRQ_SCCA_TX, port);
+fail:
+       return error;
 }
 #endif
 
@@ -261,6 +301,7 @@ static int mvme147_scc_init(void)
 static int mvme162_scc_init(void)
 {
        struct scc_port *port;
+       int error;
 
        if (!(mvme16x_config & MVME16x_CONFIG_GOT_SCCA))
                return (-ENODEV);
@@ -273,14 +314,23 @@ static int mvme162_scc_init(void)
        port->datap = port->ctrlp + 2;
        port->port_a = &scc_ports[0];
        port->port_b = &scc_ports[1];
-       request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
+       error = request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
                            "SCC-A TX", port);
-       request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
+       if (error)
+               goto fail;
+       error = request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
                            "SCC-A status", port);
-       request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_a_tx;
+       error = request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
                            "SCC-A RX", port);
-       request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED,
-                           "SCC-A special cond", port);
+       if (error)
+               goto fail_free_a_stat;
+       error = request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int,
+                           IRQF_DISABLED, "SCC-A special cond", port);
+       if (error)
+               goto fail_free_a_rx;
+
        {
                SCC_ACCESS_INIT(port);
 
@@ -300,14 +350,22 @@ static int mvme162_scc_init(void)
        port->datap = port->ctrlp + 2;
        port->port_a = &scc_ports[0];
        port->port_b = &scc_ports[1];
-       request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
+       error = request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
                            "SCC-B TX", port);
-       request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_a_spcond;
+       error = request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
                            "SCC-B status", port);
-       request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_b_tx;
+       error = request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
                            "SCC-B RX", port);
-       request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED,
-                           "SCC-B special cond", port);
+       if (error)
+               goto fail_free_b_stat;
+       error = request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int,
+                           IRQF_DISABLED, "SCC-B special cond", port);
+       if (error)
+               goto fail_free_b_rx;
 
        {
                SCC_ACCESS_INIT(port);  /* Either channel will do */
@@ -324,6 +382,23 @@ static int mvme162_scc_init(void)
        scc_init_drivers();
 
        return 0;
+
+fail_free_b_rx:
+       free_irq(MVME162_IRQ_SCCB_RX, port);
+fail_free_b_stat:
+       free_irq(MVME162_IRQ_SCCB_STAT, port);
+fail_free_b_tx:
+       free_irq(MVME162_IRQ_SCCB_TX, port);
+fail_free_a_spcond:
+       free_irq(MVME162_IRQ_SCCA_SPCOND, port);
+fail_free_a_rx:
+       free_irq(MVME162_IRQ_SCCA_RX, port);
+fail_free_a_stat:
+       free_irq(MVME162_IRQ_SCCA_STAT, port);
+fail_free_a_tx:
+       free_irq(MVME162_IRQ_SCCA_TX, port);
+fail:
+       return error;
 }
 #endif
 
@@ -332,6 +407,7 @@ static int mvme162_scc_init(void)
 static int bvme6000_scc_init(void)
 {
        struct scc_port *port;
+       int error;
 
        printk(KERN_INFO "SCC: BVME6000 Serial Driver\n");
        /* Init channel A */
@@ -341,14 +417,23 @@ static int bvme6000_scc_init(void)
        port->datap = port->ctrlp + 4;
        port->port_a = &scc_ports[0];
        port->port_b = &scc_ports[1];
-       request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
+       error = request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
                            "SCC-A TX", port);
-       request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
+       if (error)
+               goto fail;
+       error = request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
                            "SCC-A status", port);
-       request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_a_tx;
+       error = request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
                            "SCC-A RX", port);
-       request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED,
-                           "SCC-A special cond", port);
+       if (error)
+               goto fail_free_a_stat;
+       error = request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int,
+                           IRQF_DISABLED, "SCC-A special cond", port);
+       if (error)
+               goto fail_free_a_rx;
+
        {
                SCC_ACCESS_INIT(port);
 
@@ -368,14 +453,22 @@ static int bvme6000_scc_init(void)
        port->datap = port->ctrlp + 4;
        port->port_a = &scc_ports[0];
        port->port_b = &scc_ports[1];
-       request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
+       error = request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
                            "SCC-B TX", port);
-       request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_a_spcond;
+       error = request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
                            "SCC-B status", port);
-       request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
+       if (error)
+               goto fail_free_b_tx;
+       error = request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
                            "SCC-B RX", port);
-       request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED,
-                           "SCC-B special cond", port);
+       if (error)
+               goto fail_free_b_stat;
+       error = request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int,
+                           IRQF_DISABLED, "SCC-B special cond", port);
+       if (error)
+               goto fail_free_b_rx;
 
        {
                SCC_ACCESS_INIT(port);  /* Either channel will do */
@@ -389,6 +482,23 @@ static int bvme6000_scc_init(void)
        scc_init_drivers();
 
        return 0;
+
+fail:
+       free_irq(BVME_IRQ_SCCA_STAT, port);
+fail_free_a_tx:
+       free_irq(BVME_IRQ_SCCA_RX, port);
+fail_free_a_stat:
+       free_irq(BVME_IRQ_SCCA_SPCOND, port);
+fail_free_a_rx:
+       free_irq(BVME_IRQ_SCCB_TX, port);
+fail_free_a_spcond:
+       free_irq(BVME_IRQ_SCCB_STAT, port);
+fail_free_b_tx:
+       free_irq(BVME_IRQ_SCCB_RX, port);
+fail_free_b_stat:
+       free_irq(BVME_IRQ_SCCB_SPCOND, port);
+fail_free_b_rx:
+       return error;
 }
 #endif
 
@@ -423,7 +533,7 @@ static irqreturn_t scc_rx_int(int irq, void *data)
 {
        unsigned char   ch;
        struct scc_port *port = data;
-       struct tty_struct *tty = port->gs.tty;
+       struct tty_struct *tty = port->gs.port.tty;
        SCC_ACCESS_INIT(port);
 
        ch = SCCread_NB(RX_DATA_REG);
@@ -454,7 +564,7 @@ static irqreturn_t scc_rx_int(int irq, void *data)
 static irqreturn_t scc_spcond_int(int irq, void *data)
 {
        struct scc_port *port = data;
-       struct tty_struct *tty = port->gs.tty;
+       struct tty_struct *tty = port->gs.port.tty;
        unsigned char   stat, ch, err;
        int             int_pending_mask = port->channel == CHANNEL_A ?
                                           IPR_A_RX : IPR_B_RX;
@@ -501,7 +611,7 @@ static irqreturn_t scc_tx_int(int irq, void *data)
        struct scc_port *port = data;
        SCC_ACCESS_INIT(port);
 
-       if (!port->gs.tty) {
+       if (!port->gs.port.tty) {
                printk(KERN_WARNING "scc_tx_int with NULL tty!\n");
                SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
                SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET);
@@ -513,8 +623,9 @@ static irqreturn_t scc_tx_int(int irq, void *data)
                        SCCwrite(TX_DATA_REG, port->x_char);
                        port->x_char = 0;
                }
-               else if ((port->gs.xmit_cnt <= 0) || port->gs.tty->stopped ||
-                               port->gs.tty->hw_stopped)
+               else if ((port->gs.xmit_cnt <= 0) ||
+                        port->gs.port.tty->stopped ||
+                        port->gs.port.tty->hw_stopped)
                        break;
                else {
                        SCCwrite(TX_DATA_REG, port->gs.xmit_buf[port->gs.xmit_tail++]);
@@ -523,15 +634,15 @@ static irqreturn_t scc_tx_int(int irq, void *data)
                                break;
                }
        }
-       if ((port->gs.xmit_cnt <= 0) || port->gs.tty->stopped ||
-                       port->gs.tty->hw_stopped) {
+       if ((port->gs.xmit_cnt <= 0) || port->gs.port.tty->stopped ||
+           port->gs.port.tty->hw_stopped) {
                /* disable tx interrupts */
                SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
                SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET);   /* disable tx_int on next tx underrun? */
-               port->gs.flags &= ~GS_TX_INTEN;
+               port->gs.port.flags &= ~GS_TX_INTEN;
        }
-       if (port->gs.tty && port->gs.xmit_cnt <= port->gs.wakeup_chars)
-               tty_wakeup(port->gs.tty);
+       if (port->gs.port.tty && port->gs.xmit_cnt <= port->gs.wakeup_chars)
+               tty_wakeup(port->gs.port.tty);
 
        SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET);
        return IRQ_HANDLED;
@@ -551,14 +662,14 @@ static irqreturn_t scc_stat_int(int irq, void *data)
 
        if (changed & SR_DCD) {
                port->c_dcd = !!(sr & SR_DCD);
-               if (!(port->gs.flags & ASYNC_CHECK_CD))
+               if (!(port->gs.port.flags & ASYNC_CHECK_CD))
                        ;       /* Don't report DCD changes */
                else if (port->c_dcd) {
-                       wake_up_interruptible(&port->gs.open_wait);
+                       wake_up_interruptible(&port->gs.port.open_wait);
                }
                else {
-                       if (port->gs.tty)
-                               tty_hangup (port->gs.tty);
+                       if (port->gs.port.tty)
+                               tty_hangup (port->gs.port.tty);
                }
        }
        SCCwrite(COMMAND_REG, CR_EXTSTAT_RESET);
@@ -579,7 +690,7 @@ static void scc_disable_tx_interrupts(void *ptr)
 
        local_irq_save(flags);
        SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
-       port->gs.flags &= ~GS_TX_INTEN;
+       port->gs.port.flags &= ~GS_TX_INTEN;
        local_irq_restore(flags);
 }
 
@@ -593,7 +704,7 @@ static void scc_enable_tx_interrupts(void *ptr)
        local_irq_save(flags);
        SCCmod(INT_AND_DMA_REG, 0xff, IDR_TX_INT_ENAB);
        /* restart the transmitter */
-       scc_tx_int (0, port, 0);
+       scc_tx_int (0, port);
        local_irq_restore(flags);
 }
 
@@ -624,10 +735,10 @@ static void scc_enable_rx_interrupts(void *ptr)
 }
 
 
-static int scc_get_CD(void *ptr)
+static int scc_carrier_raised(struct tty_port *port)
 {
-       struct scc_port *port = ptr;
-       unsigned channel = port->channel;
+       struct scc_port *sc = container_of(port, struct scc_port, gs.port);
+       unsigned channel = sc->channel;
 
        return !!(scc_last_status_reg[channel] & SR_DCD);
 }
@@ -637,8 +748,8 @@ static void scc_shutdown_port(void *ptr)
 {
        struct scc_port *port = ptr;
 
-       port->gs.flags &= ~ GS_ACTIVE;
-       if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL) {
+       port->gs.port.flags &= ~ GS_ACTIVE;
+       if (port->gs.port.tty && (port->gs.port.tty->termios->c_cflag & HUPCL)) {
                scc_setsignals (port, 0, 0);
        }
 }
@@ -653,14 +764,14 @@ static int scc_set_real_termios (void *ptr)
        struct scc_port *port = ptr;
        SCC_ACCESS_INIT(port);
 
-       if (!port->gs.tty || !port->gs.tty->termios) return 0;
+       if (!port->gs.port.tty || !port->gs.port.tty->termios) return 0;
 
        channel = port->channel;
 
        if (channel == CHANNEL_A)
                return 0;               /* Settings controlled by boot PROM */
 
-       cflag  = port->gs.tty->termios->c_cflag;
+       cflag  = port->gs.port.tty->termios->c_cflag;
        baud = port->gs.baud;
        chsize = (cflag & CSIZE) >> 4;
 
@@ -679,9 +790,9 @@ static int scc_set_real_termios (void *ptr)
        }
 
        if (cflag & CLOCAL)
-               port->gs.flags &= ~ASYNC_CHECK_CD;
+               port->gs.port.flags &= ~ASYNC_CHECK_CD;
        else
-               port->gs.flags |= ASYNC_CHECK_CD;
+               port->gs.port.flags |= ASYNC_CHECK_CD;
 
 #ifdef CONFIG_MVME147_SCC
        if (MACH_IS_MVME147)
@@ -779,7 +890,7 @@ static void scc_setsignals(struct scc_port *port, int dtr, int rts)
 
 static void scc_send_xchar(struct tty_struct *tty, char ch)
 {
-       struct scc_port *port = (struct scc_port *)tty->driver_data;
+       struct scc_port *port = tty->driver_data;
 
        port->x_char = ch;
        if (ch)
@@ -857,7 +968,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
                { COMMAND_REG, CR_EXTSTAT_RESET },
        };
 #endif
-       if (!(port->gs.flags & ASYNC_INITIALIZED)) {
+       if (!(port->gs.port.flags & ASYNC_INITIALIZED)) {
                local_irq_save(flags);
 #if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC)
                if (MACH_IS_MVME147 || MACH_IS_MVME16x) {
@@ -881,22 +992,22 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
        }
 
        tty->driver_data = port;
-       port->gs.tty = tty;
-       port->gs.count++;
+       port->gs.port.tty = tty;
+       port->gs.port.count++;
        retval = gs_init_port(&port->gs);
        if (retval) {
-               port->gs.count--;
+               port->gs.port.count--;
                return retval;
        }
-       port->gs.flags |= GS_ACTIVE;
+       port->gs.port.flags |= GS_ACTIVE;
        retval = gs_block_til_ready(port, filp);
 
        if (retval) {
-               port->gs.count--;
+               port->gs.port.count--;
                return retval;
        }
 
-       port->c_dcd = scc_get_CD (port);
+       port->c_dcd = tty_port_carrier_raised(&port->gs.port);
 
        scc_enable_rx_interrupts(port);
 
@@ -906,7 +1017,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
 
 static void scc_throttle (struct tty_struct * tty)
 {
-       struct scc_port *port = (struct scc_port *)tty->driver_data;
+       struct scc_port *port = tty->driver_data;
        unsigned long   flags;
        SCC_ACCESS_INIT(port);
 
@@ -922,7 +1033,7 @@ static void scc_throttle (struct tty_struct * tty)
 
 static void scc_unthrottle (struct tty_struct * tty)
 {
-       struct scc_port *port = (struct scc_port *)tty->driver_data;
+       struct scc_port *port = tty->driver_data;
        unsigned long   flags;
        SCC_ACCESS_INIT(port);
 
@@ -943,9 +1054,9 @@ static int scc_ioctl(struct tty_struct *tty, struct file *file,
 }
 
 
-static void scc_break_ctl(struct tty_struct *tty, int break_state)
+static int scc_break_ctl(struct tty_struct *tty, int break_state)
 {
-       struct scc_port *port = (struct scc_port *)tty->driver_data;
+       struct scc_port *port = tty->driver_data;
        unsigned long   flags;
        SCC_ACCESS_INIT(port);
 
@@ -953,6 +1064,7 @@ static void scc_break_ctl(struct tty_struct *tty, int break_state)
        SCCmod(TX_CTRL_REG, ~TCR_SEND_BREAK, 
                        break_state ? TCR_SEND_BREAK : 0);
        local_irq_restore(flags);
+       return 0;
 }
 
 
@@ -1012,18 +1124,10 @@ static struct tty_driver *scc_console_device(struct console *c, int *index)
        return scc_driver;
 }
 
-
-static int __init scc_console_setup(struct console *co, char *options)
-{
-       return 0;
-}
-
-
 static struct console sercons = {
        .name           = "ttyS",
        .write          = scc_console_write,
        .device         = scc_console_device,
-       .setup          = scc_console_setup,
        .flags          = CON_PRINTBUFFER,
        .index          = -1,
 };