#include <linux/pci.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
-#include <linux/bitops.h>
+#include <asm/bitops.h>
#include <linux/spinlock.h>
#include <asm/semaphore.h>
#include <linux/init.h>
static unsigned long board3;
static unsigned long board4;
static unsigned long controller;
-static int support_low_speed;
+static unsigned long support_low_speed;
static unsigned long modem1;
static unsigned long modem2;
static unsigned long modem3;
#ifdef MODULE
MODULE_AUTHOR("Theodore Ts'o");
MODULE_DESCRIPTION("Comtrol RocketPort driver");
-module_param(board1, ulong, 0);
+MODULE_PARM(board1, "i");
MODULE_PARM_DESC(board1, "I/O port for (ISA) board #1");
-module_param(board2, ulong, 0);
+MODULE_PARM(board2, "i");
MODULE_PARM_DESC(board2, "I/O port for (ISA) board #2");
-module_param(board3, ulong, 0);
+MODULE_PARM(board3, "i");
MODULE_PARM_DESC(board3, "I/O port for (ISA) board #3");
-module_param(board4, ulong, 0);
+MODULE_PARM(board4, "i");
MODULE_PARM_DESC(board4, "I/O port for (ISA) board #4");
-module_param(controller, ulong, 0);
+MODULE_PARM(controller, "i");
MODULE_PARM_DESC(controller, "I/O port for (ISA) rocketport controller");
-module_param(support_low_speed, bool, 0);
+MODULE_PARM(support_low_speed, "i");
MODULE_PARM_DESC(support_low_speed, "1 means support 50 baud, 0 means support 460400 baud");
-module_param(modem1, ulong, 0);
+MODULE_PARM(modem1, "i");
MODULE_PARM_DESC(modem1, "1 means (ISA) board #1 is a RocketModem");
-module_param(modem2, ulong, 0);
+MODULE_PARM(modem2, "i");
MODULE_PARM_DESC(modem2, "1 means (ISA) board #2 is a RocketModem");
-module_param(modem3, ulong, 0);
+MODULE_PARM(modem3, "i");
MODULE_PARM_DESC(modem3, "1 means (ISA) board #3 is a RocketModem");
-module_param(modem4, ulong, 0);
+MODULE_PARM(modem4, "i");
MODULE_PARM_DESC(modem4, "1 means (ISA) board #4 is a RocketModem");
-module_param_array(pc104_1, ulong, NULL, 0);
+MODULE_PARM(pc104_1, "1-8i");
MODULE_PARM_DESC(pc104_1, "set interface types for ISA(PC104) board #1 (e.g. pc104_1=232,232,485,485,...");
-module_param_array(pc104_2, ulong, NULL, 0);
+MODULE_PARM(pc104_2, "1-8i");
MODULE_PARM_DESC(pc104_2, "set interface types for ISA(PC104) board #2 (e.g. pc104_2=232,232,485,485,...");
-module_param_array(pc104_3, ulong, NULL, 0);
+MODULE_PARM(pc104_3, "1-8i");
MODULE_PARM_DESC(pc104_3, "set interface types for ISA(PC104) board #3 (e.g. pc104_3=232,232,485,485,...");
-module_param_array(pc104_4, ulong, NULL, 0);
+MODULE_PARM(pc104_4, "1-8i");
MODULE_PARM_DESC(pc104_4, "set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,...");
int rp_init(void);
if (info->blocked_open) {
if (info->close_delay) {
- msleep_interruptible(jiffies_to_msecs(info->close_delay));
+ current->state = TASK_INTERRUPTIBLE;
+ schedule_timeout(info->close_delay);
}
wake_up_interruptible(&info->open_wait);
} else {
#ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
printk(KERN_INFO "txcnt = %d (jiff=%lu,check=%d)...", txcnt, jiffies, check_time);
#endif
- msleep_interruptible(jiffies_to_msecs(check_time));
+ current->state = TASK_INTERRUPTIBLE;
+ schedule_timeout(check_time);
if (signal_pending(current))
break;
}
* or get control of the CPU if the copy_from_user() blocks due to a page fault (swapped out).
* Spinlocks protect the info xmit members.
*/
-static int rp_write(struct tty_struct *tty,
+static int rp_write(struct tty_struct *tty, int from_user,
const unsigned char *buf, int count)
{
struct r_port *info = (struct r_port *) tty->driver_data;
if (!tty->stopped && !tty->hw_stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
c = min(count, info->xmit_fifo_room);
b = buf;
+ if (from_user) {
+ if (copy_from_user(info->xmit_buf, buf, c)) {
+ retval = -EFAULT;
+ goto end;
+ }
+ if (info->tty == 0)
+ goto end;
+ b = info->xmit_buf;
+ c = min(c, info->xmit_fifo_room);
+ }
/* Push data into FIFO, 2 bytes at a time */
sOutStrW(sGetTxRxDataIO(cp), (unsigned short *) b, c / 2);
break;
b = buf;
- memcpy(info->xmit_buf + info->xmit_head, b, c);
+ if (from_user) {
+ if (copy_from_user(info->xmit_buf + info->xmit_head, b, c)) {
+ retval = -EFAULT;
+ goto end_intr;
+ } else {
+ memcpy(info->xmit_buf + info->xmit_head, b, c);
+ }
+ }
spin_lock_irqsave(&info->slock, flags);
info->xmit_head =
retval += c;
}
+end_intr:
if ((retval > 0) && !tty->stopped && !tty->hw_stopped)
set_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
}
#endif
+/***********************************************************************
+ Copyright 1994 Comtrol Corporation.
+ All Rights Reserved.
+
+The following source code is subject to Comtrol Corporation's
+Developer's License Agreement.
+
+This source code is protected by United States copyright law and
+international copyright treaties.
+
+This source code may only be used to develop software products that
+will operate with Comtrol brand hardware.
+
+You may not reproduce nor distribute this source code in its original
+form but must produce a derivative work which includes portions of
+this source code only.
+
+The portions of this source code which you use in your derivative
+work must bear Comtrol's copyright notice:
+
+ Copyright 1994 Comtrol Corporation.
+
+***********************************************************************/
+
#ifndef TRUE
#define TRUE 1
#endif