jiffies + msecs_to_jiffies(LED_ON_MS));
}
-static int mos7840_port_paranoia_check(struct usb_serial_port *port,
- const char *function)
-{
- if (!port) {
- pr_debug("%s - port == NULL\n", function);
- return -1;
- }
- if (!port->serial) {
- pr_debug("%s - port->serial == NULL\n", function);
- return -1;
- }
-
- return 0;
-}
-
/* Inline functions to check the sanity of a pointer that is passed to us */
static int mos7840_serial_paranoia_check(struct usb_serial *serial,
const char *function)
{
/* if no port was specified, or it fails a paranoia check */
if (!port ||
- mos7840_port_paranoia_check(port, function) ||
mos7840_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 */
static void mos7840_bulk_in_callback(struct urb *urb)
{
struct moschip_port *mos7840_port = urb->context;
+ struct usb_serial_port *port = mos7840_port->port;
int retval;
unsigned char *data;
struct usb_serial *serial;
- struct usb_serial_port *port;
int status = urb->status;
if (status) {
return;
}
- port = mos7840_port->port;
- if (mos7840_port_paranoia_check(port, __func__)) {
- mos7840_port->read_urb_busy = false;
- return;
- }
-
serial = mos7840_get_usb_serial(port, __func__);
if (!serial) {
mos7840_port->read_urb_busy = false;
static void mos7840_bulk_out_data_callback(struct urb *urb)
{
- struct moschip_port *mos7840_port;
- struct usb_serial_port *port;
+ struct moschip_port *mos7840_port = urb->context;
+ struct usb_serial_port *port = mos7840_port->port;
int status = urb->status;
unsigned long flags;
int i;
- mos7840_port = urb->context;
- port = mos7840_port->port;
spin_lock_irqsave(&mos7840_port->pool_lock, flags);
for (i = 0; i < NUM_URBS; i++) {
if (urb == mos7840_port->write_urb_pool[i]) {
return;
}
- if (mos7840_port_paranoia_check(port, __func__))
- return;
-
if (mos7840_port->open)
tty_port_tty_wakeup(&port->port);
static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
{
+ struct usb_serial *serial = port->serial;
int response;
int j;
- struct usb_serial *serial;
struct urb *urb;
__u16 Data;
int status;
struct moschip_port *mos7840_port;
- if (mos7840_port_paranoia_check(port, __func__))
- return -ENODEV;
-
- serial = port->serial;
-
if (mos7840_serial_paranoia_check(serial, __func__))
return -ENODEV;
unsigned long flags;
struct moschip_port *mos7840_port;
- if (mos7840_port_paranoia_check(port, __func__))
- return 0;
-
mos7840_port = mos7840_get_port_private(port);
if (mos7840_port == NULL)
return 0;
int j;
__u16 Data;
- if (mos7840_port_paranoia_check(port, __func__))
- return;
-
serial = mos7840_get_usb_serial(port, __func__);
if (!serial)
return;
struct usb_serial *serial;
struct moschip_port *mos7840_port;
- if (mos7840_port_paranoia_check(port, __func__))
- return;
-
serial = mos7840_get_usb_serial(port, __func__);
if (!serial)
return;
unsigned long flags;
struct moschip_port *mos7840_port;
- if (mos7840_port_paranoia_check(port, __func__))
- return -1;
-
mos7840_port = mos7840_get_port_private(port);
if (mos7840_port == NULL)
return -1;
static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *data, int count)
{
+ struct usb_serial *serial = port->serial;
int status;
int i;
int bytes_sent = 0;
unsigned long flags;
struct moschip_port *mos7840_port;
- struct usb_serial *serial;
struct urb *urb;
/* __u16 Data; */
const unsigned char *current_position = data;
- if (mos7840_port_paranoia_check(port, __func__))
- return -1;
-
- serial = port->serial;
if (mos7840_serial_paranoia_check(serial, __func__))
return -1;
struct moschip_port *mos7840_port;
int status;
- if (mos7840_port_paranoia_check(port, __func__))
- return;
-
mos7840_port = mos7840_get_port_private(port);
if (mos7840_port == NULL)
int status;
struct moschip_port *mos7840_port = mos7840_get_port_private(port);
- if (mos7840_port_paranoia_check(port, __func__))
- return;
-
if (mos7840_port == NULL)
return;
static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
int baudRate)
{
+ struct usb_serial_port *port = mos7840_port->port;
int divisor = 0;
int status;
__u16 Data;
__u16 clk_sel_val;
- struct usb_serial_port *port;
-
- if (mos7840_port == NULL)
- return -1;
-
- port = mos7840_port->port;
- if (mos7840_port_paranoia_check(port, __func__))
- return -1;
if (mos7840_serial_paranoia_check(port->serial, __func__))
return -1;
static void mos7840_change_port_settings(struct tty_struct *tty,
struct moschip_port *mos7840_port, struct ktermios *old_termios)
{
+ struct usb_serial_port *port = mos7840_port->port;
int baud;
unsigned cflag;
__u8 lData;
__u8 lStop;
int status;
__u16 Data;
- struct usb_serial_port *port;
-
- if (mos7840_port == NULL)
- return;
-
- port = mos7840_port->port;
-
- if (mos7840_port_paranoia_check(port, __func__))
- return;
if (mos7840_serial_paranoia_check(port->serial, __func__))
return;
struct usb_serial_port *port,
struct ktermios *old_termios)
{
+ struct usb_serial *serial = port->serial;
int status;
- struct usb_serial *serial;
struct moschip_port *mos7840_port;
- if (mos7840_port_paranoia_check(port, __func__))
- return;
-
- serial = port->serial;
if (mos7840_serial_paranoia_check(serial, __func__))
return;
void __user *argp = (void __user *)arg;
struct moschip_port *mos7840_port;
- if (mos7840_port_paranoia_check(port, __func__))
- return -1;
-
mos7840_port = mos7840_get_port_private(port);
if (mos7840_port == NULL)