From: 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. --- 25-akpm/drivers/serial/68328serial.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff -puN drivers/serial/68328serial.c~fixes-to-the-68328-dragonball-serial-driver drivers/serial/68328serial.c --- 25/drivers/serial/68328serial.c~fixes-to-the-68328-dragonball-serial-driver Mon Apr 12 13:43:01 2004 +++ 25-akpm/drivers/serial/68328serial.c Mon Apr 12 13:43:01 2004 @@ -4,7 +4,7 @@ * Copyright (C) 1998 Kenneth Albanowski * Copyright (C) 1998, 1999 D. Jeff Dionne * Copyright (C) 1999 Vladimir Gurevich - * Copyright (C) 2002 David McCullough + * Copyright (C) 2002-2003 David McCullough * Copyright (C) 2002 Greg Ungerer * * VZ Support/Fixes Evan Stawnyczy @@ -67,12 +67,12 @@ #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, 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, #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 * 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 * 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 *t 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); _