]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/68328serial.c
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / serial / 68328serial.c
index cad426c9711e970d0b7d62718bf894b7ca54536c..bbf5bc5892c7be21451fa55c6863af71519ffaff 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/keyboard.h>
 #include <linux/init.h>
 #include <linux/pm.h>
-#include <linux/pm_legacy.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
 
@@ -85,9 +84,6 @@ extern wait_queue_head_t keypress_wait;
 
 struct tty_driver *serial_driver;
 
-/* serial subtype definitions */
-#define SERIAL_TYPE_NORMAL     1
 /* number of characters left in xmit buffer before we ask for more */
 #define WAKEUP_CHARS 256
 
@@ -204,7 +200,7 @@ static void rs_stop(struct tty_struct *tty)
        local_irq_restore(flags);
 }
 
-static void rs_put_char(char ch)
+static int rs_put_char(char ch)
 {
         int flags, loops = 0;
 
@@ -218,6 +214,7 @@ static void rs_put_char(char ch)
        UTX_TXDATA = ch;
         udelay(5);
         local_irq_restore(flags);
+        return 1;
 }
 
 static void rs_start(struct tty_struct *tty)
@@ -401,9 +398,9 @@ irqreturn_t rs_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static void do_softint(void *private)
+static void do_softint(struct work_struct *work)
 {
-       struct m68k_serial      *info = (struct m68k_serial *) private;
+       struct m68k_serial      *info = container_of(work, struct m68k_serial, tqueue);
        struct tty_struct       *tty;
        
        tty = info->tty;
@@ -425,9 +422,9 @@ static void do_softint(void *private)
  *     do_serial_hangup() -> tty->hangup() -> rs_hangup()
  * 
  */
-static void do_serial_hangup(void *private)
+static void do_serial_hangup(struct work_struct *work)
 {
-       struct m68k_serial      *info = (struct m68k_serial *) private;
+       struct m68k_serial      *info = container_of(work, struct m68k_serial, tqueue_hangup);
        struct tty_struct       *tty;
        
        tty = info->tty;
@@ -1021,18 +1018,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        tty_wait_until_sent(tty, 0);
                        send_break(info, arg ? arg*(100) : 250);
                        return 0;
-               case TIOCGSOFTCAR:
-                       error = put_user(C_CLOCAL(tty) ? 1 : 0,
-                                   (unsigned long *) arg);
-                       if (error)
-                               return error;
-                       return 0;
-               case TIOCSSOFTCAR:
-                       get_user(arg, (unsigned long *) arg);
-                       tty->termios->c_cflag =
-                               ((tty->termios->c_cflag & ~CLOCAL) |
-                                (arg ? CLOCAL : 0));
-                       return 0;
                case TIOCGSERIAL:
                        if (access_ok(VERIFY_WRITE, (void *) arg,
                                                sizeof(struct serial_struct)))
@@ -1065,9 +1050,6 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
 {
        struct m68k_serial *info = (struct m68k_serial *)tty->driver_data;
 
-       if (tty->termios->c_cflag == old_termios->c_cflag)
-               return;
-
        change_speed(info);
 
        if ((old_termios->c_cflag & CRTSCTS) &&
@@ -1144,8 +1126,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
        uart->ustcnt &= ~(USTCNT_RXEN | USTCNT_RX_INTR_MASK);
 
        shutdown(info);
-       if (tty->driver->flush_buffer)
-               tty->driver->flush_buffer(tty);
+       rs_flush_buffer(tty);
                
        tty_ldisc_flush(tty);
        tty->closing = 0;
@@ -1324,59 +1305,6 @@ static void show_serial_version(void)
        printk("MC68328 serial driver version 1.00\n");
 }
 
-#ifdef CONFIG_PM_LEGACY
-/* Serial Power management
- *  The console (currently fixed at line 0) is a special case for power
- *  management because the kernel is so chatty. The console will be 
- *  explicitly disabled my our power manager as the last minute, so we won't
- *  mess with it here.
- */
-static struct pm_dev *serial_pm[NR_PORTS];
-
-static int serial_pm_callback(struct pm_dev *dev, pm_request_t request, void *data)
-{
-       struct m68k_serial *info = (struct m68k_serial *)dev->data;
-
-       if(info == NULL)
-               return -1;
-
-       /* special case for line 0 - pm restores it */
-       if(info->line == 0)
-               return 0; 
-
-       switch (request) {
-       case PM_SUSPEND:
-               shutdown(info);
-               break;
-
-       case PM_RESUME:
-               startup(info);
-               break;
-       }
-       return 0;
-}
-
-void shutdown_console(void)
-{
-       struct m68k_serial *info = &m68k_soft[0];
-
-       /* HACK: wait a bit for any pending printk's to be dumped */
-       {
-               int i = 10000;
-               while(i--);
-       }
-
-       shutdown(info);
-}
-
-void startup_console(void)
-{
-       struct m68k_serial *info = &m68k_soft[0];
-       startup(info);
-}
-#endif /* CONFIG_PM_LEGACY */
-
-
 static const struct tty_operations rs_ops = {
        .open = rs_open,
        .close = rs_close,
@@ -1444,8 +1372,8 @@ rs68328_init(void)
            info->event = 0;
            info->count = 0;
            info->blocked_open = 0;
-           INIT_WORK(&info->tqueue, do_softint, info);
-           INIT_WORK(&info->tqueue_hangup, do_serial_hangup, info);
+           INIT_WORK(&info->tqueue, do_softint);
+           INIT_WORK(&info->tqueue_hangup, do_serial_hangup);
            init_waitqueue_head(&info->open_wait);
            init_waitqueue_head(&info->close_wait);
            info->line = i;
@@ -1464,14 +1392,9 @@ rs68328_init(void)
 
            if (request_irq(uart_irqs[i],
                            rs_interrupt,
-                           IRQ_FLG_STD,
+                           IRQF_DISABLED,
                            "M68328_UART", NULL))
                 panic("Unable to attach 68328 serial interrupt\n");
-#ifdef CONFIG_PM_LEGACY
-           serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback);
-           if (serial_pm[i])
-                   serial_pm[i]->data = info;
-#endif
        }
        local_irq_restore(flags);
        return 0;