Skip to content

Commit 1e066d8

Browse files
Alan CoxLive-CD User
authored andcommitted
mos7840: remove old dead modem logic
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]>
1 parent 6146b9a commit 1e066d8

File tree

1 file changed

+0
-115
lines changed

1 file changed

+0
-115
lines changed

drivers/usb/serial/mos7840.c

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,106 +2133,6 @@ static int mos7840_get_lsr_info(struct tty_struct *tty,
21332133
return 0;
21342134
}
21352135

2136-
/*****************************************************************************
2137-
* mos7840_set_modem_info
2138-
* function to set modem info
2139-
*****************************************************************************/
2140-
2141-
/* FIXME: Should be using the model control hooks */
2142-
2143-
static int mos7840_set_modem_info(struct moschip_port *mos7840_port,
2144-
unsigned int cmd, unsigned int __user *value)
2145-
{
2146-
unsigned int mcr;
2147-
unsigned int arg;
2148-
__u16 Data;
2149-
int status;
2150-
struct usb_serial_port *port;
2151-
2152-
if (mos7840_port == NULL)
2153-
return -1;
2154-
2155-
port = (struct usb_serial_port *)mos7840_port->port;
2156-
if (mos7840_port_paranoia_check(port, __func__)) {
2157-
dbg("%s", "Invalid port");
2158-
return -1;
2159-
}
2160-
2161-
mcr = mos7840_port->shadowMCR;
2162-
2163-
if (copy_from_user(&arg, value, sizeof(int)))
2164-
return -EFAULT;
2165-
2166-
switch (cmd) {
2167-
case TIOCMBIS:
2168-
if (arg & TIOCM_RTS)
2169-
mcr |= MCR_RTS;
2170-
if (arg & TIOCM_DTR)
2171-
mcr |= MCR_RTS;
2172-
if (arg & TIOCM_LOOP)
2173-
mcr |= MCR_LOOPBACK;
2174-
break;
2175-
2176-
case TIOCMBIC:
2177-
if (arg & TIOCM_RTS)
2178-
mcr &= ~MCR_RTS;
2179-
if (arg & TIOCM_DTR)
2180-
mcr &= ~MCR_RTS;
2181-
if (arg & TIOCM_LOOP)
2182-
mcr &= ~MCR_LOOPBACK;
2183-
break;
2184-
2185-
case TIOCMSET:
2186-
/* turn off the RTS and DTR and LOOPBACK
2187-
* and then only turn on what was asked to */
2188-
mcr &= ~(MCR_RTS | MCR_DTR | MCR_LOOPBACK);
2189-
mcr |= ((arg & TIOCM_RTS) ? MCR_RTS : 0);
2190-
mcr |= ((arg & TIOCM_DTR) ? MCR_DTR : 0);
2191-
mcr |= ((arg & TIOCM_LOOP) ? MCR_LOOPBACK : 0);
2192-
break;
2193-
}
2194-
2195-
lock_kernel();
2196-
mos7840_port->shadowMCR = mcr;
2197-
2198-
Data = mos7840_port->shadowMCR;
2199-
status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data);
2200-
unlock_kernel();
2201-
if (status < 0) {
2202-
dbg("setting MODEM_CONTROL_REGISTER Failed");
2203-
return -1;
2204-
}
2205-
2206-
return 0;
2207-
}
2208-
2209-
/*****************************************************************************
2210-
* mos7840_get_modem_info
2211-
* function to get modem info
2212-
*****************************************************************************/
2213-
2214-
static int mos7840_get_modem_info(struct moschip_port *mos7840_port,
2215-
unsigned int __user *value)
2216-
{
2217-
unsigned int result = 0;
2218-
__u16 msr;
2219-
unsigned int mcr = mos7840_port->shadowMCR;
2220-
mos7840_get_uart_reg(mos7840_port->port,
2221-
MODEM_STATUS_REGISTER, &msr);
2222-
result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) /* 0x002 */
2223-
|((mcr & MCR_RTS) ? TIOCM_RTS : 0) /* 0x004 */
2224-
|((msr & MOS7840_MSR_CTS) ? TIOCM_CTS : 0) /* 0x020 */
2225-
|((msr & MOS7840_MSR_CD) ? TIOCM_CAR : 0) /* 0x040 */
2226-
|((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
2227-
|((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */
2228-
2229-
dbg("%s -- %x", __func__, result);
2230-
2231-
if (copy_to_user(value, &result, sizeof(int)))
2232-
return -EFAULT;
2233-
return 0;
2234-
}
2235-
22362136
/*****************************************************************************
22372137
* mos7840_get_serial_info
22382138
* function to get information about serial port
@@ -2281,7 +2181,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
22812181
struct async_icount cnow;
22822182
struct async_icount cprev;
22832183
struct serial_icounter_struct icount;
2284-
int mosret = 0;
22852184

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

2306-
/* FIXME: use the modem hooks and remove this */
2307-
case TIOCMBIS:
2308-
case TIOCMBIC:
2309-
case TIOCMSET:
2310-
dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __func__,
2311-
port->number);
2312-
mosret =
2313-
mos7840_set_modem_info(mos7840_port, cmd, argp);
2314-
return mosret;
2315-
2316-
case TIOCMGET:
2317-
dbg("%s (%d) TIOCMGET", __func__, port->number);
2318-
return mos7840_get_modem_info(mos7840_port, argp);
2319-
23202205
case TIOCGSERIAL:
23212206
dbg("%s (%d) TIOCGSERIAL", __func__, port->number);
23222207
return mos7840_get_serial_info(mos7840_port, argp);

0 commit comments

Comments
 (0)