aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/moxa.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 42de5bf5be58..da2a1d1690bf 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -46,23 +46,20 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/uaccess.h> 47#include <asm/uaccess.h>
48 48
49#define MOXA_VERSION "5.1k" 49#define MOXA_VERSION "5.1k"
50 50
51#define MOXAMAJOR 172 51#define MOXAMAJOR 172
52#define MOXACUMAJOR 173 52#define MOXACUMAJOR 173
53 53
54#define put_to_user(arg1, arg2) put_user(arg1, (unsigned long *)arg2) 54#define MAX_BOARDS 4 /* Don't change this value */
55#define get_from_user(arg1, arg2) get_user(arg1, (unsigned int *)arg2)
56
57#define MAX_BOARDS 4 /* Don't change this value */
58#define MAX_PORTS_PER_BOARD 32 /* Don't change this value */ 55#define MAX_PORTS_PER_BOARD 32 /* Don't change this value */
59#define MAX_PORTS 128 /* Don't change this value */ 56#define MAX_PORTS (MAX_BOARDS * MAX_PORTS_PER_BOARD)
60 57
61/* 58/*
62 * Define the Moxa PCI vendor and device IDs. 59 * Define the Moxa PCI vendor and device IDs.
63 */ 60 */
64#define MOXA_BUS_TYPE_ISA 0 61#define MOXA_BUS_TYPE_ISA 0
65#define MOXA_BUS_TYPE_PCI 1 62#define MOXA_BUS_TYPE_PCI 1
66 63
67enum { 64enum {
68 MOXA_BOARD_C218_PCI = 1, 65 MOXA_BOARD_C218_PCI = 1,
@@ -157,13 +154,8 @@ static struct mxser_mstatus GMStatus[MAX_PORTS];
157 154
158#define SERIAL_DO_RESTART 155#define SERIAL_DO_RESTART
159 156
160
161#define SERIAL_TYPE_NORMAL 1
162
163#define WAKEUP_CHARS 256 157#define WAKEUP_CHARS 256
164 158
165#define PORTNO(x) ((x)->index)
166
167static int verbose = 0; 159static int verbose = 0;
168static int ttymajor = MOXAMAJOR; 160static int ttymajor = MOXAMAJOR;
169/* Variables for insmod */ 161/* Variables for insmod */
@@ -461,7 +453,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
461 int port; 453 int port;
462 int retval; 454 int retval;
463 455
464 port = PORTNO(tty); 456 port = tty->index;
465 if (port == MAX_PORTS) { 457 if (port == MAX_PORTS) {
466 return (0); 458 return (0);
467 } 459 }
@@ -499,7 +491,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
499 struct moxa_str *ch; 491 struct moxa_str *ch;
500 int port; 492 int port;
501 493
502 port = PORTNO(tty); 494 port = tty->index;
503 if (port == MAX_PORTS) { 495 if (port == MAX_PORTS) {
504 return; 496 return;
505 } 497 }
@@ -663,7 +655,7 @@ static int moxa_tiocmget(struct tty_struct *tty, struct file *file)
663 int port; 655 int port;
664 int flag = 0, dtr, rts; 656 int flag = 0, dtr, rts;
665 657
666 port = PORTNO(tty); 658 port = tty->index;
667 if ((port != MAX_PORTS) && (!ch)) 659 if ((port != MAX_PORTS) && (!ch))
668 return (-EINVAL); 660 return (-EINVAL);
669 661
@@ -689,7 +681,7 @@ static int moxa_tiocmset(struct tty_struct *tty, struct file *file,
689 int port; 681 int port;
690 int dtr, rts; 682 int dtr, rts;
691 683
692 port = PORTNO(tty); 684 port = tty->index;
693 if ((port != MAX_PORTS) && (!ch)) 685 if ((port != MAX_PORTS) && (!ch))
694 return (-EINVAL); 686 return (-EINVAL);
695 687
@@ -714,7 +706,7 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file,
714 void __user *argp = (void __user *)arg; 706 void __user *argp = (void __user *)arg;
715 int retval; 707 int retval;
716 708
717 port = PORTNO(tty); 709 port = tty->index;
718 if ((port != MAX_PORTS) && (!ch)) 710 if ((port != MAX_PORTS) && (!ch))
719 return (-EINVAL); 711 return (-EINVAL);
720 712
@@ -1361,9 +1353,6 @@ static void receive_data(struct moxa_str *ch)
1361/* 1353/*
1362 * Query 1354 * Query
1363 */ 1355 */
1364#define QueryPort MAX_PORTS
1365
1366
1367 1356
1368struct mon_str { 1357struct mon_str {
1369 int tick; 1358 int tick;
@@ -1475,7 +1464,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
1475 int MoxaPortTxQueue(int), MoxaPortRxQueue(int); 1464 int MoxaPortTxQueue(int), MoxaPortRxQueue(int);
1476 void __user *argp = (void __user *)arg; 1465 void __user *argp = (void __user *)arg;
1477 1466
1478 if (port == QueryPort) { 1467 if (port == MAX_PORTS) {
1479 if ((cmd != MOXA_GET_CONF) && (cmd != MOXA_INIT_DRIVER) && 1468 if ((cmd != MOXA_GET_CONF) && (cmd != MOXA_INIT_DRIVER) &&
1480 (cmd != MOXA_LOAD_BIOS) && (cmd != MOXA_FIND_BOARD) && (cmd != MOXA_LOAD_C320B) && 1469 (cmd != MOXA_LOAD_BIOS) && (cmd != MOXA_FIND_BOARD) && (cmd != MOXA_LOAD_C320B) &&
1481 (cmd != MOXA_LOAD_CODE) && (cmd != MOXA_GETDATACOUNT) && 1470 (cmd != MOXA_LOAD_CODE) && (cmd != MOXA_GETDATACOUNT) &&