Skip to content

Commit

Permalink
mos7840: remove old dead modem logic
Browse files Browse the repository at this point in the history
The modem ioctls are not routed via the ioctl method so kill the old dead
code. The correct code is also already present and hooked in.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent 6146b9a commit 1e066d8
Showing 1 changed file with 0 additions and 115 deletions.
115 changes: 0 additions & 115 deletions drivers/usb/serial/mos7840.c
Original file line number Diff line number Diff line change
Expand Up @@ -2133,106 +2133,6 @@ static int mos7840_get_lsr_info(struct tty_struct *tty,
return 0;
}

/*****************************************************************************
* mos7840_set_modem_info
* function to set modem info
*****************************************************************************/

/* FIXME: Should be using the model control hooks */

static int mos7840_set_modem_info(struct moschip_port *mos7840_port,
unsigned int cmd, unsigned int __user *value)
{
unsigned int mcr;
unsigned int arg;
__u16 Data;
int status;
struct usb_serial_port *port;

if (mos7840_port == NULL)
return -1;

port = (struct usb_serial_port *)mos7840_port->port;
if (mos7840_port_paranoia_check(port, __func__)) {
dbg("%s", "Invalid port");
return -1;
}

mcr = mos7840_port->shadowMCR;

if (copy_from_user(&arg, value, sizeof(int)))
return -EFAULT;

switch (cmd) {
case TIOCMBIS:
if (arg & TIOCM_RTS)
mcr |= MCR_RTS;
if (arg & TIOCM_DTR)
mcr |= MCR_RTS;
if (arg & TIOCM_LOOP)
mcr |= MCR_LOOPBACK;
break;

case TIOCMBIC:
if (arg & TIOCM_RTS)
mcr &= ~MCR_RTS;
if (arg & TIOCM_DTR)
mcr &= ~MCR_RTS;
if (arg & TIOCM_LOOP)
mcr &= ~MCR_LOOPBACK;
break;

case TIOCMSET:
/* turn off the RTS and DTR and LOOPBACK
* and then only turn on what was asked to */
mcr &= ~(MCR_RTS | MCR_DTR | MCR_LOOPBACK);
mcr |= ((arg & TIOCM_RTS) ? MCR_RTS : 0);
mcr |= ((arg & TIOCM_DTR) ? MCR_DTR : 0);
mcr |= ((arg & TIOCM_LOOP) ? MCR_LOOPBACK : 0);
break;
}

lock_kernel();
mos7840_port->shadowMCR = mcr;

Data = mos7840_port->shadowMCR;
status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data);
unlock_kernel();
if (status < 0) {
dbg("setting MODEM_CONTROL_REGISTER Failed");
return -1;
}

return 0;
}

/*****************************************************************************
* mos7840_get_modem_info
* function to get modem info
*****************************************************************************/

static int mos7840_get_modem_info(struct moschip_port *mos7840_port,
unsigned int __user *value)
{
unsigned int result = 0;
__u16 msr;
unsigned int mcr = mos7840_port->shadowMCR;
mos7840_get_uart_reg(mos7840_port->port,
MODEM_STATUS_REGISTER, &msr);
result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) /* 0x002 */
|((mcr & MCR_RTS) ? TIOCM_RTS : 0) /* 0x004 */
|((msr & MOS7840_MSR_CTS) ? TIOCM_CTS : 0) /* 0x020 */
|((msr & MOS7840_MSR_CD) ? TIOCM_CAR : 0) /* 0x040 */
|((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
|((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */

dbg("%s -- %x", __func__, result);

if (copy_to_user(value, &result, sizeof(int)))
return -EFAULT;
return 0;
}

/*****************************************************************************
* mos7840_get_serial_info
* function to get information about serial port
Expand Down Expand Up @@ -2281,7 +2181,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
struct async_icount cnow;
struct async_icount cprev;
struct serial_icounter_struct icount;
int mosret = 0;

if (mos7840_port_paranoia_check(port, __func__)) {
dbg("%s", "Invalid port");
Expand All @@ -2303,20 +2202,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
return mos7840_get_lsr_info(tty, argp);
return 0;

/* FIXME: use the modem hooks and remove this */
case TIOCMBIS:
case TIOCMBIC:
case TIOCMSET:
dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __func__,
port->number);
mosret =
mos7840_set_modem_info(mos7840_port, cmd, argp);
return mosret;

case TIOCMGET:
dbg("%s (%d) TIOCMGET", __func__, port->number);
return mos7840_get_modem_info(mos7840_port, argp);

case TIOCGSERIAL:
dbg("%s (%d) TIOCGSERIAL", __func__, port->number);
return mos7840_get_serial_info(mos7840_port, argp);
Expand Down

0 comments on commit 1e066d8

Please sign in to comment.