fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / char / amiserial.c
index 7ac365b..feb4ac8 100644 (file)
@@ -31,7 +31,6 @@
  *             ever possible.
  */
 
-#include <linux/config.h>
 #include <linux/delay.h>
 
 #undef SERIAL_PARANOIA_CHECK
@@ -46,8 +45,6 @@
 
 /* Sanity checks */
 
-#define SERIAL_INLINE
-  
 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
 #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
  tty->name, (info->flags), serial_driver->refcount,info->count,tty->count,s)
@@ -95,10 +92,6 @@ static char *serial_version = "4.30";
 #include <asm/amigahw.h>
 #include <asm/amigaints.h>
 
-#ifdef SERIAL_INLINE
-#define _INLINE_ inline
-#endif
-
 #define custom amiga_custom
 static char *serial_name = "Amiga-builtin serial driver";
 
@@ -111,7 +104,7 @@ static struct async_struct *IRQ_ports;
 
 static unsigned char current_ctl_bits;
 
-static void change_speed(struct async_struct *info, struct termios *old);
+static void change_speed(struct async_struct *info, struct ktermios *old);
 static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
 
 
@@ -119,17 +112,6 @@ static struct serial_state rs_table[1];
 
 #define NR_PORTS ARRAY_SIZE(rs_table)
 
-/*
- * tmp_buf is used as a temporary buffer by serial_write.  We need to
- * lock it in case the copy_from_user blocks while swapping in a page,
- * and some other program tries to do a serial write at the same time.
- * Since the lock will only come under contention when the system is
- * swapping and available memory is low, it makes sense to share one
- * buffer across all the serial ports, since it significantly saves
- * memory if large numbers of serial ports are open.
- */
-static unsigned char *tmp_buf;
-
 #include <asm/uaccess.h>
 
 #define serial_isroot()        (capable(CAP_SYS_ADMIN))
@@ -253,14 +235,14 @@ static void rs_start(struct tty_struct *tty)
  * This routine is used by the interrupt handler to schedule
  * processing in the software interrupt portion of the driver.
  */
-static _INLINE_ void rs_sched_event(struct async_struct *info,
-                                 int event)
+static void rs_sched_event(struct async_struct *info,
+                          int event)
 {
        info->event |= 1 << event;
        tasklet_schedule(&info->tlet);
 }
 
-static _INLINE_ void receive_chars(struct async_struct *info)
+static void receive_chars(struct async_struct *info)
 {
         int status;
        int serdatr;
@@ -349,7 +331,7 @@ out:
        return;
 }
 
-static _INLINE_ void transmit_chars(struct async_struct *info)
+static void transmit_chars(struct async_struct *info)
 {
        custom.intreq = IF_TBE;
        mb();
@@ -389,7 +371,7 @@ static _INLINE_ void transmit_chars(struct async_struct *info)
        }
 }
 
-static _INLINE_ void check_modem_status(struct async_struct *info)
+static void check_modem_status(struct async_struct *info)
 {
        unsigned char status = ciab.pra & (SER_DCD | SER_CTS | SER_DSR);
        unsigned char dstatus;
@@ -465,7 +447,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
        }
 }
 
-static irqreturn_t ser_vbl_int( int irq, void *data, struct pt_regs *regs)
+static irqreturn_t ser_vbl_int( int irq, void *data)
 {
         /* vbl is just a periodic interrupt we tie into to update modem status */
        struct async_struct * info = IRQ_ports;
@@ -478,7 +460,7 @@ static irqreturn_t ser_vbl_int( int irq, void *data, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t ser_rx_int(int irq, void *dev_id, struct pt_regs * regs)
+static irqreturn_t ser_rx_int(int irq, void *dev_id)
 {
        struct async_struct * info;
 
@@ -498,7 +480,7 @@ static irqreturn_t ser_rx_int(int irq, void *dev_id, struct pt_regs * regs)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t ser_tx_int(int irq, void *dev_id, struct pt_regs * regs)
+static irqreturn_t ser_tx_int(int irq, void *dev_id)
 {
        struct async_struct * info;
 
@@ -712,7 +694,7 @@ static void shutdown(struct async_struct * info)
  * the specified baud rate for a serial port.
  */
 static void change_speed(struct async_struct *info,
-                        struct termios *old_termios)
+                        struct ktermios *old_termios)
 {
        int     quot = 0, baud_base, baud;
        unsigned cflag, cval = 0;
@@ -919,7 +901,7 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
        if (serial_paranoia_check(info, tty->name, "rs_write"))
                return 0;
 
-       if (!info->xmit.buf || !tmp_buf)
+       if (!info->xmit.buf)
                return 0;
 
        local_save_flags(flags);
@@ -1383,7 +1365,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
        return 0;
 }
 
-static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
+static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
 {
        struct async_struct *info = (struct async_struct *)tty->driver_data;
        unsigned long flags;
@@ -1785,7 +1767,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
 {
        struct async_struct     *info;
        int                     retval, line;
-       unsigned long           page;
 
        line = tty->index;
        if ((line < 0) || (line >= NR_PORTS)) {
@@ -1805,17 +1786,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
 #endif
        info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
-       if (!tmp_buf) {
-               page = get_zeroed_page(GFP_KERNEL);
-               if (!page) {
-                       return -ENOMEM;
-               }
-               if (tmp_buf)
-                       free_page(page);
-               else
-                       tmp_buf = (unsigned char *) page;
-       }
-
        /*
         * If the port is the middle of closing, bail out now
         */
@@ -1959,13 +1929,13 @@ done:
  * number, and identifies which options were configured into this
  * driver.
  */
-static _INLINE_ void show_serial_version(void)
+static void show_serial_version(void)
 {
        printk(KERN_INFO "%s version %s\n", serial_name, serial_version);
 }
 
 
-static struct tty_operations serial_ops = {
+static const struct tty_operations serial_ops = {
        .open = rs_open,
        .close = rs_close,
        .write = rs_write,
@@ -2058,7 +2028,7 @@ static int __init rs_init(void)
 
        /* set ISRs, and then disable the rx interrupts */
        request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state);
-       request_irq(IRQ_AMIGA_RBF, ser_rx_int, SA_INTERRUPT, "serial RX", state);
+       request_irq(IRQ_AMIGA_RBF, ser_rx_int, IRQF_DISABLED, "serial RX", state);
 
        /* turn off Rx and Tx interrupts */
        custom.intena = IF_RBF | IF_TBE;
@@ -2097,11 +2067,6 @@ static __exit void rs_exit(void)
          kfree(info);
        }
 
-       if (tmp_buf) {
-               free_page((unsigned long) tmp_buf);
-               tmp_buf = NULL;
-       }
-
        release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
 }