aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/moxa.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-10 04:45:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:30 -0500
commit181d6f4fac7f01ede95284954ea1231939dca0d9 (patch)
tree07e85222bfb240addd06a793358d311167c2adbc /drivers/char/moxa.c
parent8f8ecbad09b48e5fe44a8d7f5344e802e9c231c8 (diff)
[PATCH] Char: moxa, remove useless variables
Remove temporary or once used variables, that can be defined locally to save some bytes. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/moxa.c')
-rw-r--r--drivers/char/moxa.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 0c34bc5b04e1..8849d662295e 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -146,8 +146,6 @@ struct moxa_port {
146 wait_queue_head_t close_wait; 146 wait_queue_head_t close_wait;
147 147
148 struct timer_list emptyTimer; 148 struct timer_list emptyTimer;
149 struct mxser_mstatus GMStatus;
150 struct moxaq_str temp_queue;
151 149
152 char chkPort; 150 char chkPort;
153 char lineCtrl; 151 char lineCtrl;
@@ -1487,17 +1485,15 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
1487 return (0); 1485 return (0);
1488 case MOXA_GET_IOQUEUE: { 1486 case MOXA_GET_IOQUEUE: {
1489 struct moxaq_str __user *argm = argp; 1487 struct moxaq_str __user *argm = argp;
1490 struct moxa_port *p; 1488 struct moxaq_str tmp;
1491 1489
1492 for (i = 0; i < MAX_PORTS; i++, argm++) { 1490 for (i = 0; i < MAX_PORTS; i++, argm++) {
1493 p = &moxa_ports[i]; 1491 memset(&tmp, 0, sizeof(tmp));
1494 memset(&p->temp_queue, 0, sizeof(p->temp_queue)); 1492 if (moxa_ports[i].chkPort) {
1495 if (p->chkPort) { 1493 tmp.inq = MoxaPortRxQueue(i);
1496 p->temp_queue.inq = MoxaPortRxQueue(i); 1494 tmp.outq = MoxaPortTxQueue(i);
1497 p->temp_queue.outq = MoxaPortTxQueue(i);
1498 } 1495 }
1499 if (copy_to_user(argm, &p->temp_queue, 1496 if (copy_to_user(argm, &tmp, sizeof(tmp)))
1500 sizeof(p->temp_queue)))
1501 return -EFAULT; 1497 return -EFAULT;
1502 } 1498 }
1503 return (0); 1499 return (0);
@@ -1518,33 +1514,30 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
1518 return 0; 1514 return 0;
1519 case MOXA_GETMSTATUS: { 1515 case MOXA_GETMSTATUS: {
1520 struct mxser_mstatus __user *argm = argp; 1516 struct mxser_mstatus __user *argm = argp;
1517 struct mxser_mstatus tmp;
1521 struct moxa_port *p; 1518 struct moxa_port *p;
1522 1519
1523 for (i = 0; i < MAX_PORTS; i++, argm++) { 1520 for (i = 0; i < MAX_PORTS; i++, argm++) {
1524 p = &moxa_ports[i]; 1521 p = &moxa_ports[i];
1525 p->GMStatus.ri = 0; 1522 memset(&tmp, 0, sizeof(tmp));
1526 p->GMStatus.dcd = 0;
1527 p->GMStatus.dsr = 0;
1528 p->GMStatus.cts = 0;
1529 if (!p->chkPort) { 1523 if (!p->chkPort) {
1530 goto copy; 1524 goto copy;
1531 } else { 1525 } else {
1532 status = MoxaPortLineStatus(p->port); 1526 status = MoxaPortLineStatus(p->port);
1533 if (status & 1) 1527 if (status & 1)
1534 p->GMStatus.cts = 1; 1528 tmp.cts = 1;
1535 if (status & 2) 1529 if (status & 2)
1536 p->GMStatus.dsr = 1; 1530 tmp.dsr = 1;
1537 if (status & 4) 1531 if (status & 4)
1538 p->GMStatus.dcd = 1; 1532 tmp.dcd = 1;
1539 } 1533 }
1540 1534
1541 if (!p->tty || !p->tty->termios) 1535 if (!p->tty || !p->tty->termios)
1542 p->GMStatus.cflag = p->cflag; 1536 tmp.cflag = p->cflag;
1543 else 1537 else
1544 p->GMStatus.cflag = p->tty->termios->c_cflag; 1538 tmp.cflag = p->tty->termios->c_cflag;
1545copy: 1539copy:
1546 if (copy_to_user(argm, &p->GMStatus, 1540 if (copy_to_user(argm, &tmp, sizeof(tmp)))
1547 sizeof(p->GMStatus)))
1548 return -EFAULT; 1541 return -EFAULT;
1549 } 1542 }
1550 return 0; 1543 return 0;