]> git.hungrycats.org Git - linux/commitdiff
[PATCH] m68knommu: fixes to the 68328 DragonBall serial driver
authorAndrew Morton <akpm@osdl.org>
Tue, 13 Apr 2004 02:24:22 +0000 (19:24 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 13 Apr 2004 02:24:22 +0000 (19:24 -0700)
From: <gerg@snapgear.com>

A few fixes for the 68328 "DragonBall" serial driver:

. use irqreturn_t for interrupt handlers
. correct a few variable types (stop compiler warnings)
. correctly use return values from put_user(), get_user() and copy_to_user()

Many of these originaly from kernel janitors.

drivers/serial/68328serial.c

index f212ae0992d1d3d45f96d1ba319ebfe192eeb8ef..5c499be241358bbb8d6e7b1451c87cb917eb4bae 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 1998       Kenneth Albanowski <kjahds@kjahds.com>
  * Copyright (C) 1998, 1999 D. Jeff Dionne     <jeff@uclinux.org>
  * Copyright (C) 1999       Vladimir Gurevich  <vgurevic@cisco.com>
- * Copyright (C) 2002       David McCullough   <davidm@snapgear.com>
+ * Copyright (C) 2002-2003  David McCullough   <davidm@snapgear.com>
  * Copyright (C) 2002       Greg Ungerer       <gerg@snapgear.com>
  *
  * VZ Support/Fixes             Evan Stawnyczy <e@lineo.ca>
 #endif
 
 static struct m68k_serial m68k_soft[NR_PORTS];
-struct m86k_serial *IRQ_ports[NR_IRQS];
+struct m68k_serial *IRQ_ports[NR_IRQS];
 
 static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS;
 
 /* multiple ports are contiguous in memory */
-m68328_uart *uart_addr = USTCNT_ADDR;
+m68328_uart *uart_addr = (m68328_uart *)USTCNT_ADDR;
 
 struct tty_struct m68k_ttys;
 struct m68k_serial *m68k_consinfo = 0;
@@ -400,7 +400,7 @@ clear_and_return:
 /*
  * This is the serial driver's generic interrupt routine
  */
-void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+irqreturn_t rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
        struct m68k_serial * info;
        m68328_uart *uart;
@@ -409,7 +409,7 @@ void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 
        info = IRQ_ports[irq];
        if(!info)
-           return;
+           return IRQ_NONE;
 
        uart = &uart_addr[info->line];
        rx = uart->urx.w;
@@ -422,7 +422,7 @@ void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 #else
        receive_chars(info, regs, rx);          
 #endif
-       return;
+       return IRQ_HANDLED;
 }
 
 static void do_softint(void *private)
@@ -777,7 +777,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
        save_flags(flags);
        while (1) {
                cli();          
-               c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
+               c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
                                   SERIAL_XMIT_SIZE - info->xmit_head));
                if (c <= 0)
                        break;
@@ -785,7 +785,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
                if (from_user) {
                        down(&tmp_buf_sem);
                        copy_from_user(tmp_buf, buf, c);
-                       c = min(c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
+                       c = min_t(int, c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
                                       SERIAL_XMIT_SIZE - info->xmit_head));
                        memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
                        up(&tmp_buf_sem);
@@ -1056,11 +1056,10 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        send_break(info, arg ? arg*(HZ/10) : HZ/4);
                        return 0;
                case TIOCGSOFTCAR:
-                       error = verify_area(VERIFY_WRITE, (void *) arg,sizeof(long));
+                       error = put_user(C_CLOCAL(tty) ? 1 : 0,
+                                   (unsigned long *) arg);
                        if (error)
                                return error;
-                       put_user(C_CLOCAL(tty) ? 1 : 0,
-                                   (unsigned long *) arg);
                        return 0;
                case TIOCSSOFTCAR:
                        get_user(arg, (unsigned long *) arg);