Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163824
b: refs/heads/master
c: 1e066d8
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent 972ee69 commit 3aa0c49
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 116 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6146b9af84cc771198195104b432eb13b96a9799
refs/heads/master: 1e066d803ab7e34e9efb3b0766d618c0cd2598e4
115 changes: 0 additions & 115 deletions trunk/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 3aa0c49

Please sign in to comment.