fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / serial / ioc4_serial.c
index c620209..c862f67 100644 (file)
@@ -921,7 +921,7 @@ static void handle_dma_error_intr(void *arg, uint32_t other_ir)
 {
        struct ioc4_port *port = (struct ioc4_port *)arg;
        struct hooks *hooks = port->ip_hooks;
-       unsigned int flags;
+       unsigned long flags;
 
        spin_lock_irqsave(&port->ip_lock, flags);
 
@@ -987,10 +987,9 @@ intr_connect(struct ioc4_soft *soft, int type,
  * ioc4_intr - Top level IOC4 interrupt handler.
  * @irq: irq value
  * @arg: handler arg
- * @regs: registers
  */
 
-static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
+static irqreturn_t ioc4_intr(int irq, void *arg)
 {
        struct ioc4_soft *soft;
        uint32_t this_ir, this_mir;
@@ -1682,7 +1681,7 @@ static void transmit_chars(struct uart_port *the_port)
  */
 static void
 ioc4_change_speed(struct uart_port *the_port,
-                 struct termios *new_termios, struct termios *old_termios)
+                 struct ktermios *new_termios, struct ktermios *old_termios)
 {
        struct ioc4_port *port = get_ioc4_port(the_port, 0);
        int baud, bits;
@@ -1803,7 +1802,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
        ioc4_set_proto(port, the_port->mapbase);
 
        /* set the speed of the serial port */
-       ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0);
+       ioc4_change_speed(the_port, info->tty->termios, (struct ktermios *)0);
 
        return 0;
 }
@@ -1835,7 +1834,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
        struct ioc4_port *port = (struct ioc4_port *)arg;
        struct hooks *hooks = port->ip_hooks;
        unsigned int rx_high_rd_aborted = 0;
-       unsigned int flags;
+       unsigned long flags;
        struct uart_port *the_port;
        int loop_counter;
 
@@ -2571,7 +2570,7 @@ static int ic4_startup(struct uart_port *the_port)
  */
 static void
 ic4_set_termios(struct uart_port *the_port,
-               struct termios *termios, struct termios *old_termios)
+               struct ktermios *termios, struct ktermios *old_termios)
 {
        unsigned long port_flags;
 
@@ -2646,7 +2645,10 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
        struct ioc4_port *port;
        struct ioc4_soft *soft;
 
+       /* If serial driver did not attach, don't try to detach */
        control = idd->idd_serial_data;
+       if (!control)
+               return 0;
 
        for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) {
                for (port_type = UART_PORT_MIN;
@@ -2682,6 +2684,7 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
        if (soft) {
                free_irq(control->ic_irq, soft);
                if (soft->is_ioc4_serial_addr) {
+                       iounmap(soft->is_ioc4_serial_addr);
                        release_region((unsigned long)
                             soft->is_ioc4_serial_addr,
                                sizeof(struct ioc4_serial));
@@ -2778,6 +2781,12 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
        DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev,
                                                        idd->idd_pci_id));
 
+       /* PCI-RT does not bring out serial connections.
+        * Do not attach to this particular IOC4.
+        */
+       if (idd->idd_variant == IOC4_VARIANT_PCI_RT)
+               return 0;
+
        /* request serial registers */
        tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET;
 
@@ -2846,7 +2855,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
        control->ic_soft = soft;
 
        /* Hook up interrupt handler */
-       if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ,
+       if (!request_irq(idd->idd_pdev->irq, ioc4_intr, IRQF_SHARED,
                                "sgi-ioc4serial", soft)) {
                control->ic_irq = idd->idd_pdev->irq;
        } else {
@@ -2878,6 +2887,8 @@ out4:
 out3:
        kfree(control);
 out2:
+       if (serial)
+               iounmap(serial);
        release_region(tmp_addr1, sizeof(struct ioc4_serial));
 out1:
 
@@ -2924,7 +2935,7 @@ static void __devexit ioc4_serial_exit(void)
        uart_unregister_driver(&ioc4_uart_rs422);
 }
 
-module_init(ioc4_serial_init);
+late_initcall(ioc4_serial_init); /* Call only after tty init is done */
 module_exit(ioc4_serial_exit);
 
 MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>");