Commit c63063e2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: removed port_paranoia_check() call for usb serial drivers.

Pretty useless stuff.  If this was hiding anything real, we need to find out.
parent fd7f6a57
......@@ -246,9 +246,6 @@ static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
{
struct usb_serial *serial;
if (port_paranoia_check (port, __FUNCTION__))
return;
serial = get_usb_serial (port, __FUNCTION__);
if (!serial)
return;
......@@ -288,9 +285,6 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
goto exit;
}
if (port_paranoia_check (port, __FUNCTION__))
return;
serial = port->serial;
if (serial_paranoia_check (serial, __FUNCTION__))
......
......@@ -155,9 +155,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
unsigned long flags;
int result = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
dbg("%s - usb_clear_halt", __FUNCTION__ );
......@@ -325,9 +322,6 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs )
unsigned char *data = urb->transfer_buffer;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
/* the urb might have been killed. */
......
......@@ -1397,8 +1397,7 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
}
/* further sanity checks */
if( port_paranoia_check( port, __FUNCTION__ )
|| serial_paranoia_check( serial, __FUNCTION__ ) )
if (serial_paranoia_check(serial, __FUNCTION__))
return;
/* try to send any buffered data on this port, if it is open */
......@@ -1851,11 +1850,6 @@ static int digi_read_inb_callback( struct urb *urb )
unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3;
int flag,throttled;
/* sanity check */
if( port_paranoia_check( port, __FUNCTION__ ) )
return( -1 );
/* do not process callbacks on closed ports */
/* but do continue the read chain */
if( port->open_count == 0 )
......@@ -1980,9 +1974,8 @@ opcode, line, status, val );
port = serial->port[line];
if( port_paranoia_check( port, __FUNCTION__ )
|| (priv=usb_get_serial_port_data(port)) == NULL )
return( -1 );
if ((priv=usb_get_serial_port_data(port)) == NULL )
return -1;
if( opcode == DIGI_CMD_READ_INPUT_SIGNALS ) {
......
......@@ -157,9 +157,6 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
struct usb_serial *serial = port->serial;
int result = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
/* Force default termio settings */
......@@ -192,9 +189,6 @@ static void empeg_close (struct usb_serial_port *port, struct file * filp)
{
struct usb_serial *serial;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......@@ -353,9 +347,6 @@ static void empeg_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
......@@ -376,9 +367,6 @@ static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
int i;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (!serial) {
......
......@@ -1513,9 +1513,6 @@ static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
/* free up the transfer buffer, as usb_free_urb() does not do this */
kfree (urb->transfer_buffer);
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
......@@ -1577,9 +1574,6 @@ static void ftdi_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
dbg("%s", __FUNCTION__);
if (port_paranoia_check (port, __FUNCTION__)) {
return;
}
if (port->open_count <= 0)
return;
......
......@@ -83,9 +83,6 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp)
struct usb_serial *serial = port->serial;
int result = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
/* force low_latency on so that our tty_push actually forces the data through,
......
......@@ -825,19 +825,17 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
txCredits = data[position] | (data[position+1] << 8);
if (txCredits) {
port = edge_serial->serial->port[portNumber];
if (port_paranoia_check (port, __FUNCTION__) == 0) {
edge_port = usb_get_serial_port_data(port);
if (edge_port->open) {
edge_port->txCredits += txCredits;
dbg("%s - txcredits for port%d = %d", __FUNCTION__, portNumber, edge_port->txCredits);
edge_port = usb_get_serial_port_data(port);
if (edge_port->open) {
edge_port->txCredits += txCredits;
dbg("%s - txcredits for port%d = %d", __FUNCTION__, portNumber, edge_port->txCredits);
/* tell the tty driver that something has changed */
if (edge_port->port->tty)
wake_up_interruptible(&edge_port->port->tty->write_wait);
/* tell the tty driver that something has changed */
if (edge_port->port->tty)
wake_up_interruptible(&edge_port->port->tty->write_wait);
// Since we have more credit, check if more data can be sent
send_more_port_data(edge_serial, edge_port);
}
// Since we have more credit, check if more data can be sent
send_more_port_data(edge_serial, edge_port);
}
}
position += 2;
......@@ -916,10 +914,6 @@ static void edge_bulk_out_data_callback (struct urb *urb, struct pt_regs *regs)
dbg("%s", __FUNCTION__);
if (port_paranoia_check (edge_port->port, __FUNCTION__)) {
return;
}
if (urb->status) {
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
}
......@@ -969,10 +963,6 @@ static void edge_bulk_out_cmd_callback (struct urb *urb, struct pt_regs *regs)
/* Free the command urb */
usb_free_urb (urb);
if (port_paranoia_check (edge_port->port, __FUNCTION__)) {
return;
}
if (status) {
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, status);
return;
......@@ -1009,9 +999,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
int response;
int timeout;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
if (edge_port == NULL)
......@@ -1245,9 +1232,6 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
struct edgeport_port *edge_port;
int status;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......@@ -2071,24 +2055,22 @@ static int process_rcvd_data (struct edgeport_serial *edge_serial, unsigned char
/* spit this data back into the tty driver if this port is open */
if (rxLen) {
port = edge_serial->serial->port[edge_serial->rxPort];
if (port_paranoia_check (port, __FUNCTION__) == 0) {
edge_port = usb_get_serial_port_data(port);
if (edge_port->open) {
tty = edge_port->port->tty;
if (tty) {
dbg("%s - Sending %d bytes to TTY for port %d", __FUNCTION__, rxLen, edge_serial->rxPort);
for (i = 0; i < rxLen ; ++i) {
/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
tty_flip_buffer_push(tty);
}
/* this doesn't actually push the data through unless tty->low_latency is set */
tty_insert_flip_char(tty, buffer[i], 0);
edge_port = usb_get_serial_port_data(port);
if (edge_port->open) {
tty = edge_port->port->tty;
if (tty) {
dbg("%s - Sending %d bytes to TTY for port %d", __FUNCTION__, rxLen, edge_serial->rxPort);
for (i = 0; i < rxLen ; ++i) {
/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
tty_flip_buffer_push(tty);
}
tty_flip_buffer_push(tty);
/* this doesn't actually push the data through unless tty->low_latency is set */
tty_insert_flip_char(tty, buffer[i], 0);
}
edge_port->icount.rx += rxLen;
tty_flip_buffer_push(tty);
}
edge_port->icount.rx += rxLen;
}
buffer += rxLen;
}
......@@ -2124,9 +2106,6 @@ static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2
/* switch the port pointer to the one being currently talked about */
port = edge_serial->serial->port[edge_serial->rxPort];
if (port_paranoia_check (port, __FUNCTION__)) {
return;
}
edge_port = usb_get_serial_port_data(port);
if (edge_port == NULL) {
dev_err(&edge_serial->serial->dev->dev, "%s - edge_port == NULL for port %d\n", __FUNCTION__, edge_serial->rxPort);
......
......@@ -1685,11 +1685,6 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
dbg ("%s - port_number %d, function %d, info 0x%x",
__FUNCTION__, port_number, function, data[1]);
port = edge_serial->serial->port[port_number];
if (port_paranoia_check (port, __FUNCTION__)) {
dbg ("%s - change found for port that is not present",
__FUNCTION__);
return;
}
edge_port = usb_get_serial_port_data(port);
if (!edge_port) {
dbg ("%s - edge_port not found", __FUNCTION__);
......@@ -1744,9 +1739,6 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs)
dbg("%s", __FUNCTION__);
if (port_paranoia_check (edge_port->port, __FUNCTION__))
return;
if (urb->status) {
dbg ("%s - nonzero read bulk status received: %d",
__FUNCTION__, urb->status);
......@@ -1848,9 +1840,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
u16 open_settings;
u8 transaction_timeout;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
if (edge_port == NULL)
......@@ -1999,9 +1988,6 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
int port_number;
int status;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......
......@@ -181,10 +181,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
int i, result = 0;
int retries = KP_RETRIES;
if (port_paranoia_check(port, __FUNCTION__)) {
return -ENODEV;
}
dbg("%s - port %d", __FUNCTION__, port->number);
bytes_in = 0;
......@@ -291,10 +287,6 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp)
struct usb_serial *serial;
struct ipaq_private *priv = usb_get_serial_port_data(port);
if (port_paranoia_check(port, __FUNCTION__)) {
return;
}
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial(port, __FUNCTION__);
......@@ -323,9 +315,6 @@ static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs)
unsigned char *data = urb->transfer_buffer;
int i, result;
if (port_paranoia_check(port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (!serial) {
......@@ -488,10 +477,6 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
unsigned long flags;
int result;
if (port_paranoia_check (port, __FUNCTION__)) {
return;
}
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
......
......@@ -283,9 +283,6 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
char *buffer;
int result = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
if (buffer_size) {
......@@ -330,9 +327,6 @@ static void ir_close (struct usb_serial_port *port, struct file * filp)
{
struct usb_serial *serial;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......@@ -411,9 +405,6 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
......@@ -438,9 +429,6 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
unsigned char *data = urb->transfer_buffer;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (!serial) {
......
......@@ -249,11 +249,6 @@ static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs)
goto exit;
}
if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) {
return;
}
serial = port->serial;
if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
return;
......@@ -638,10 +633,6 @@ static void keyspan_pda_write_bulk_callback (struct urb *urb, struct pt_regs *re
priv = usb_get_serial_port_data(port);
if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) {
return;
}
serial = port->serial;
if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
return;
......
......@@ -230,9 +230,6 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
priv = usb_get_serial_port_data(port);
priv->line_state = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
// someone sets the dev to 0 if the close method has been called
port->interrupt_in_urb->dev = port->serial->dev;
......
......@@ -156,9 +156,6 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
struct omninet_data *od;
int result = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......@@ -193,9 +190,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
struct usb_serial_port *wport;
struct omninet_data *od;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......@@ -348,11 +342,6 @@ static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
// dbg("omninet_write_bulk_callback, port %0x\n", port);
if (port_paranoia_check (port, __FUNCTION__)) {
return;
}
serial = port->serial;
if (serial_paranoia_check (serial, __FUNCTION__)) {
return;
......
......@@ -411,9 +411,6 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
unsigned char *buf;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
usb_clear_halt(serial->dev, port->write_urb->pipe);
......@@ -480,8 +477,6 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
unsigned int c_cflag;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
serial = get_usb_serial (port, __FUNCTION__);
if (!serial)
return;
......@@ -723,9 +718,6 @@ static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
u8 status;
char tty_flag;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (!serial) {
......@@ -807,9 +799,6 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
......
/*
* USB Serial Converter driver
*
* Copyright (C) 1999 - 2003
* Copyright (C) 1999 - 2004
* Greg Kroah-Hartman (greg@kroah.com)
*
* This program is free software; you can redistribute it and/or modify
......@@ -309,27 +309,10 @@ static inline int serial_paranoia_check (struct usb_serial *serial, const char *
return 0;
}
static inline int port_paranoia_check (struct usb_serial_port *port, const char *function)
{
if (!port) {
dbg("%s - port == NULL", function);
return -1;
}
if (!port->serial) {
dbg("%s - port->serial == NULL", function);
return -1;
}
return 0;
}
static inline struct usb_serial* get_usb_serial (struct usb_serial_port *port, const char *function)
{
/* if no port was specified, or it fails a paranoia check */
if (!port ||
port_paranoia_check (port, function) ||
serial_paranoia_check (port->serial, function)) {
/* then say that we don't have a valid usb_serial thing, which will
* end up genrating -ENODEV return values */
......
......@@ -396,9 +396,6 @@ static int visor_open (struct usb_serial_port *port, struct file *filp)
struct usb_serial *serial = port->serial;
int result = 0;
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
dbg("%s - port %d", __FUNCTION__, port->number);
if (!port->read_urb) {
......@@ -449,9 +446,6 @@ static void visor_close (struct usb_serial_port *port, struct file * filp)
struct usb_serial *serial;
unsigned char *transfer_buffer;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
serial = get_usb_serial (port, __FUNCTION__);
......@@ -571,9 +565,6 @@ static void visor_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
/* free up the transfer buffer, as usb_free_urb() does not do this */
kfree (urb->transfer_buffer);
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status)
......@@ -593,9 +584,6 @@ static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
int i;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (!serial) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment