dect
/
linux-2.6
Archived
13
0
Fork 0

[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>
This commit is contained in:
Jiri Slaby 2007-02-10 01:45:34 -08:00 committed by Linus Torvalds
parent 8f8ecbad09
commit 181d6f4fac
1 changed files with 14 additions and 21 deletions

View File

@ -146,8 +146,6 @@ struct moxa_port {
wait_queue_head_t close_wait; wait_queue_head_t close_wait;
struct timer_list emptyTimer; struct timer_list emptyTimer;
struct mxser_mstatus GMStatus;
struct moxaq_str temp_queue;
char chkPort; char chkPort;
char lineCtrl; char lineCtrl;
@ -1487,17 +1485,15 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
return (0); return (0);
case MOXA_GET_IOQUEUE: { case MOXA_GET_IOQUEUE: {
struct moxaq_str __user *argm = argp; struct moxaq_str __user *argm = argp;
struct moxa_port *p; struct moxaq_str tmp;
for (i = 0; i < MAX_PORTS; i++, argm++) { for (i = 0; i < MAX_PORTS; i++, argm++) {
p = &moxa_ports[i]; memset(&tmp, 0, sizeof(tmp));
memset(&p->temp_queue, 0, sizeof(p->temp_queue)); if (moxa_ports[i].chkPort) {
if (p->chkPort) { tmp.inq = MoxaPortRxQueue(i);
p->temp_queue.inq = MoxaPortRxQueue(i); tmp.outq = MoxaPortTxQueue(i);
p->temp_queue.outq = MoxaPortTxQueue(i);
} }
if (copy_to_user(argm, &p->temp_queue, if (copy_to_user(argm, &tmp, sizeof(tmp)))
sizeof(p->temp_queue)))
return -EFAULT; return -EFAULT;
} }
return (0); return (0);
@ -1518,33 +1514,30 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
return 0; return 0;
case MOXA_GETMSTATUS: { case MOXA_GETMSTATUS: {
struct mxser_mstatus __user *argm = argp; struct mxser_mstatus __user *argm = argp;
struct mxser_mstatus tmp;
struct moxa_port *p; struct moxa_port *p;
for (i = 0; i < MAX_PORTS; i++, argm++) { for (i = 0; i < MAX_PORTS; i++, argm++) {
p = &moxa_ports[i]; p = &moxa_ports[i];
p->GMStatus.ri = 0; memset(&tmp, 0, sizeof(tmp));
p->GMStatus.dcd = 0;
p->GMStatus.dsr = 0;
p->GMStatus.cts = 0;
if (!p->chkPort) { if (!p->chkPort) {
goto copy; goto copy;
} else { } else {
status = MoxaPortLineStatus(p->port); status = MoxaPortLineStatus(p->port);
if (status & 1) if (status & 1)
p->GMStatus.cts = 1; tmp.cts = 1;
if (status & 2) if (status & 2)
p->GMStatus.dsr = 1; tmp.dsr = 1;
if (status & 4) if (status & 4)
p->GMStatus.dcd = 1; tmp.dcd = 1;
} }
if (!p->tty || !p->tty->termios) if (!p->tty || !p->tty->termios)
p->GMStatus.cflag = p->cflag; tmp.cflag = p->cflag;
else else
p->GMStatus.cflag = p->tty->termios->c_cflag; tmp.cflag = p->tty->termios->c_cflag;
copy: copy:
if (copy_to_user(argm, &p->GMStatus, if (copy_to_user(argm, &tmp, sizeof(tmp)))
sizeof(p->GMStatus)))
return -EFAULT; return -EFAULT;
} }
return 0; return 0;