Commit 324f204c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] s390: CTC network driver.

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

CTC network driver fixes:
 - Fixed some debug messages (did not compile with DEBUG defined).
 - Added sanity checks in ctc_proto_store() & ctc_shutdown_device().
 - Added some bugfixes from 2.4.
 - Tweaked logging.
 - Removed syntax error in pr_debug call.
 - Changed do_IO (not existing any more) to ccw_device in messages.
 - Corrected format failure in pr_debug of channel_get.
 - Add symlinks between net device and ctc device.
 - Add tiocmset/tiocmget API change patch from Russell King
 - Fix locking problem in ctc_tty_cleanup.
parent 82cc45b0
This diff is collapsed.
/* /*
* $Id: ctctty.c,v 1.15 2004/01/26 10:21:01 mschwide Exp $ * $Id: ctctty.c,v 1.16 2004/02/05 12:39:55 felfert Exp $
* *
* CTC / ESCON network driver, tty interface. * CTC / ESCON network driver, tty interface.
* *
...@@ -655,14 +655,19 @@ ctc_tty_get_lsr_info(ctc_tty_info * info, uint * value) ...@@ -655,14 +655,19 @@ ctc_tty_get_lsr_info(ctc_tty_info * info, uint * value)
} }
static int static int ctc_tty_tiocmget(struct tty_struct *tty, struct file *file)
ctc_tty_get_ctc_tty_info(ctc_tty_info * info, uint * value)
{ {
ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
u_char control, u_char control,
status; status;
uint result; uint result;
ulong flags; ulong flags;
if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_ioctl"))
return -ENODEV;
if (tty->flags & (1 << TTY_IO_ERROR))
return -EIO;
control = info->mcr; control = info->mcr;
spin_lock_irqsave(&ctc_tty_lock, flags); spin_lock_irqsave(&ctc_tty_lock, flags);
status = info->msr; status = info->msr;
...@@ -673,51 +678,31 @@ ctc_tty_get_ctc_tty_info(ctc_tty_info * info, uint * value) ...@@ -673,51 +678,31 @@ ctc_tty_get_ctc_tty_info(ctc_tty_info * info, uint * value)
| ((status & UART_MSR_RI) ? TIOCM_RNG : 0) | ((status & UART_MSR_RI) ? TIOCM_RNG : 0)
| ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0)
| ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
put_user(result, (uint *) value); return result;
return 0;
} }
static int static int
ctc_tty_set_ctc_tty_info(ctc_tty_info * info, uint cmd, uint * value) ctc_tty_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
{ {
uint arg; ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
int old_mcr = info->mcr & (UART_MCR_RTS | UART_MCR_DTR);
get_user(arg, (uint *) value); if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_ioctl"))
switch (cmd) { return -ENODEV;
case TIOCMBIS: if (tty->flags & (1 << TTY_IO_ERROR))
#ifdef CTC_DEBUG_MODEM_IOCTL return -EIO;
printk(KERN_DEBUG "%s%d ioctl TIOCMBIS\n", CTC_TTY_NAME,
info->line); if (set & TIOCM_RTS)
#endif info->mcr |= UART_MCR_RTS;
if (arg & TIOCM_RTS) if (set & TIOCM_DTR)
info->mcr |= UART_MCR_RTS; info->mcr |= UART_MCR_DTR;
if (arg & TIOCM_DTR)
info->mcr |= UART_MCR_DTR; if (clear & TIOCM_RTS)
break; info->mcr &= ~UART_MCR_RTS;
case TIOCMBIC: if (clear & TIOCM_DTR)
#ifdef CTC_DEBUG_MODEM_IOCTL info->mcr &= ~UART_MCR_DTR;
printk(KERN_DEBUG "%s%d ioctl TIOCMBIC\n", CTC_TTY_NAME,
info->line); if ((set | clear) & (TIOCM_RTS|TIOCM_DTR))
#endif
if (arg & TIOCM_RTS)
info->mcr &= ~UART_MCR_RTS;
if (arg & TIOCM_DTR)
info->mcr &= ~UART_MCR_DTR;
break;
case TIOCMSET:
#ifdef CTC_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "%s%d ioctl TIOCMSET\n", CTC_TTY_NAME,
info->line);
#endif
info->mcr = ((info->mcr & ~(UART_MCR_RTS | UART_MCR_DTR))
| ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0)
| ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0));
break;
default:
return -EINVAL;
}
if ((info->mcr & (UART_MCR_RTS | UART_MCR_DTR)) != old_mcr)
ctc_tty_transmit_status(info); ctc_tty_transmit_status(info);
return 0; return 0;
} }
...@@ -772,22 +757,6 @@ ctc_tty_ioctl(struct tty_struct *tty, struct file *file, ...@@ -772,22 +757,6 @@ ctc_tty_ioctl(struct tty_struct *tty, struct file *file,
((tty->termios->c_cflag & ~CLOCAL) | ((tty->termios->c_cflag & ~CLOCAL) |
(arg ? CLOCAL : 0)); (arg ? CLOCAL : 0));
return 0; return 0;
case TIOCMGET:
#ifdef CTC_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "%s%d ioctl TIOCMGET\n", CTC_TTY_NAME,
info->line);
#endif
error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint));
if (error)
return error;
return ctc_tty_get_ctc_tty_info(info, (uint *) arg);
case TIOCMBIS:
case TIOCMBIC:
case TIOCMSET:
error = verify_area(VERIFY_READ, (void *) arg, sizeof(uint));
if (error)
return error;
return ctc_tty_set_ctc_tty_info(info, cmd, (uint *) arg);
case TIOCSERGETLSR: /* Get line status register */ case TIOCSERGETLSR: /* Get line status register */
#ifdef CTC_DEBUG_MODEM_IOCTL #ifdef CTC_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "%s%d ioctl TIOCSERGETLSR\n", CTC_TTY_NAME, printk(KERN_DEBUG "%s%d ioctl TIOCSERGETLSR\n", CTC_TTY_NAME,
...@@ -1139,6 +1108,8 @@ static struct tty_operations ctc_ops = { ...@@ -1139,6 +1108,8 @@ static struct tty_operations ctc_ops = {
.unthrottle = ctc_tty_unthrottle, .unthrottle = ctc_tty_unthrottle,
.set_termios = ctc_tty_set_termios, .set_termios = ctc_tty_set_termios,
.hangup = ctc_tty_hangup, .hangup = ctc_tty_hangup,
.tiocmget = ctc_tty_tiocmget,
.tiocmset = ctc_tty_tiocmset,
}; };
int int
...@@ -1259,9 +1230,9 @@ ctc_tty_cleanup(void) { ...@@ -1259,9 +1230,9 @@ ctc_tty_cleanup(void) {
spin_lock_irqsave(&ctc_tty_lock, saveflags); spin_lock_irqsave(&ctc_tty_lock, saveflags);
ctc_tty_shuttingdown = 1; ctc_tty_shuttingdown = 1;
spin_unlock_irqrestore(&ctc_tty_lock, saveflags);
tty_unregister_driver(driver->ctc_tty_device); tty_unregister_driver(driver->ctc_tty_device);
kfree(driver); kfree(driver);
put_tty_driver(driver->ctc_tty_device); put_tty_driver(driver->ctc_tty_device);
driver = NULL; driver = NULL;
spin_unlock_irqrestore(&ctc_tty_lock, saveflags);
} }
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