Commit b1705344 authored by Greg Ungerer's avatar Greg Ungerer Committed by Linus Torvalds

[PATCH] ColdFire serial driver fixups

A number of small ColdFire serial driver fixups:
 - use correct irq handler return type (irqreturn_t)
 - add support for mark and space parity
 - some casting to keep types clean (and remove compile warnings)
 - fix missing ";" after local tty_driver struct definition
parent f08e5e21
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/tty_flip.h> #include <linux/tty_flip.h>
#include <linux/config.h>
#include <linux/major.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -395,7 +393,7 @@ static _INLINE_ void transmit_chars(struct mcf_serial *info) ...@@ -395,7 +393,7 @@ static _INLINE_ void transmit_chars(struct mcf_serial *info)
/* /*
* This is the serial driver's generic interrupt routine * This is the serial driver's generic interrupt routine
*/ */
void mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct mcf_serial *info; struct mcf_serial *info;
unsigned char isr; unsigned char isr;
...@@ -407,7 +405,7 @@ void mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -407,7 +405,7 @@ void mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
receive_chars(info, regs, isr); receive_chars(info, regs, isr);
if (isr & MCFUART_UIR_TXREADY) if (isr & MCFUART_UIR_TXREADY)
transmit_chars(info); transmit_chars(info);
return; return IRQ_HANDLED;
} }
/* /*
...@@ -643,10 +641,17 @@ static void mcfrs_change_speed(struct mcf_serial *info) ...@@ -643,10 +641,17 @@ static void mcfrs_change_speed(struct mcf_serial *info)
} }
if (cflag & PARENB) { if (cflag & PARENB) {
if (cflag & CMSPAR) {
if (cflag & PARODD)
mr1 |= MCFUART_MR1_PARITYMARK;
else
mr1 |= MCFUART_MR1_PARITYSPACE;
} else {
if (cflag & PARODD) if (cflag & PARODD)
mr1 |= MCFUART_MR1_PARITYODD; mr1 |= MCFUART_MR1_PARITYODD;
else else
mr1 |= MCFUART_MR1_PARITYEVEN; mr1 |= MCFUART_MR1_PARITYEVEN;
}
} else { } else {
mr1 |= MCFUART_MR1_PARITYNONE; mr1 |= MCFUART_MR1_PARITYNONE;
} }
...@@ -735,8 +740,8 @@ static int mcfrs_write(struct tty_struct * tty, int from_user, ...@@ -735,8 +740,8 @@ static int mcfrs_write(struct tty_struct * tty, int from_user,
local_save_flags(flags); local_save_flags(flags);
while (1) { while (1) {
local_irq_disable(); local_irq_disable();
c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, c = min(count, (int) min(((int)SERIAL_XMIT_SIZE) - info->xmit_cnt - 1,
SERIAL_XMIT_SIZE - info->xmit_head)); ((int)SERIAL_XMIT_SIZE) - info->xmit_head));
if (c <= 0) { if (c <= 0) {
local_irq_restore(flags); local_irq_restore(flags);
...@@ -748,8 +753,8 @@ static int mcfrs_write(struct tty_struct * tty, int from_user, ...@@ -748,8 +753,8 @@ static int mcfrs_write(struct tty_struct * tty, int from_user,
copy_from_user(mcfrs_tmp_buf, buf, c); copy_from_user(mcfrs_tmp_buf, buf, c);
local_irq_restore(flags); local_irq_restore(flags);
local_irq_disable(); local_irq_disable();
c = min(c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, c = min(c, (int) min(((int)SERIAL_XMIT_SIZE) - info->xmit_cnt - 1,
SERIAL_XMIT_SIZE - info->xmit_head)); ((int)SERIAL_XMIT_SIZE) - info->xmit_head));
memcpy(info->xmit_buf + info->xmit_head, mcfrs_tmp_buf, c); memcpy(info->xmit_buf + info->xmit_head, mcfrs_tmp_buf, c);
up(&mcfrs_tmp_buf_sem); up(&mcfrs_tmp_buf_sem);
} else } else
...@@ -1558,7 +1563,7 @@ static struct tty_operations mcfrs_ops = { ...@@ -1558,7 +1563,7 @@ static struct tty_operations mcfrs_ops = {
.start = mcfrs_start, .start = mcfrs_start,
.hangup = mcfrs_hangup, .hangup = mcfrs_hangup,
.read_proc = mcfrs_readproc, .read_proc = mcfrs_readproc,
} };
/* mcfrs_init inits the driver */ /* mcfrs_init inits the driver */
static int __init static int __init
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment