[LIBERTAS]: fix oops on the blackfin architecture
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / serial / 68328serial.c
index 993a702..aad4012 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>
 
@@ -275,8 +274,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status)
        return;
 }
 
-static void receive_chars(struct m68k_serial *info, struct pt_regs *regs,
-                         unsigned short rx)
+static void receive_chars(struct m68k_serial *info, unsigned short rx)
 {
        struct tty_struct *tty = info->tty;
        m68328_uart *uart = &uart_addr[info->line];
@@ -377,7 +375,7 @@ clear_and_return:
 /*
  * This is the serial driver's generic interrupt routine
  */
-irqreturn_t rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+irqreturn_t rs_interrupt(int irq, void *dev_id)
 {
        struct m68k_serial * info;
        m68328_uart *uart;
@@ -394,17 +392,17 @@ irqreturn_t rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 #ifdef USE_INTS
        tx = uart->utx.w;
 
-       if (rx & URX_DATA_READY) receive_chars(info, regs, rx);
+       if (rx & URX_DATA_READY) receive_chars(info, rx);
        if (tx & UTX_TX_AVAIL)   transmit_chars(info);
 #else
-       receive_chars(info, regs, rx);          
+       receive_chars(info, rx);                
 #endif
        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;
@@ -426,9 +424,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;
@@ -1062,7 +1060,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 m68k_serial *info = (struct m68k_serial *)tty->driver_data;
 
@@ -1325,60 +1323,7 @@ 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 struct tty_operations rs_ops = {
+static const struct tty_operations rs_ops = {
        .open = rs_open,
        .close = rs_close,
        .write = rs_write,
@@ -1445,8 +1390,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;
@@ -1468,11 +1413,6 @@ rs68328_init(void)
                            IRQ_FLG_STD,
                            "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;