/* FIXME make this somehow dynamic and not build time specific */
static int RS485mode = 0;
-static struct usb_serial *ATEN2011_get_usb_serial(struct usb_serial_port *port, const
- char *function);
-static int ATEN2011_serial_paranoia_check(struct usb_serial *serial, const char
- *function);
-static int ATEN2011_port_paranoia_check(struct usb_serial_port *port, const char
- *function);
-
/* setting and get register values */
static int ATEN2011_set_reg_sync(struct usb_serial_port *port, __u16 reg,
__u16 val);
data = urb->transfer_buffer;
//ATEN2011_serial= (struct ATENINTL_serial *)urb->context;
- //serial = ATEN2011_get_usb_serial(port,__FUNCTION__);
serial = ATEN2011_serial->serial;
/* ATENINTL get 5 bytes
}
port = (struct usb_serial_port *)ATEN2011_port->port;
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Port Paranoia failed \n");
- return;
- }
-
- serial = ATEN2011_get_usb_serial(port, __FUNCTION__);
- if (!serial) {
- DPRINTK("%s\n", "Bad serial pointer ");
- return;
- }
+ serial = port->serial;
DPRINTK("%s\n", "Entering... \n");
return;
}
- if (ATEN2011_port_paranoia_check(ATEN2011_port->port, __FUNCTION__)) {
- DPRINTK("%s", "Port Paranoia failed \n");
- return;
- }
-
DPRINTK("%s \n", "Entering .........");
tty = tty_port_tty_get(&ATEN2011_port->port->port);
struct ktermios tmp_termios;
int minor;
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Port Paranoia failed \n");
- return -ENODEV;
- }
//ATEN2011_serial->NoOfOpenPorts++;
serial = port->serial;
- if (ATEN2011_serial_paranoia_check(serial, __FUNCTION__)) {
- DPRINTK("%s", "Serial Paranoia failed \n");
- return -ENODEV;
- }
-
ATEN2011_port = ATEN2011_get_port_private(port);
if (ATEN2011_port == NULL)
//DPRINTK("%s \n"," ATEN2011_chars_in_buffer:entering ...........");
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return -1;
- }
-
ATEN2011_port = ATEN2011_get_port_private(port);
if (ATEN2011_port == NULL) {
DPRINTK("%s \n", "ATEN2011_break:leaving ...........");
//ThreadState = 1;
/* MATRIX */
//printk("Entering... :ATEN2011_close\n");
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Port Paranoia failed \n");
- return;
- }
- serial = ATEN2011_get_usb_serial(port, __FUNCTION__);
- if (!serial) {
- DPRINTK("%s", "Serial Paranoia failed \n");
- return;
- }
+ serial = port->serial;
+
// take the Adpater and port's private data
ATEN2011_serial = ATEN2011_get_serial_private(serial);
ATEN2011_port = ATEN2011_get_port_private(port);
DPRINTK("%s \n", "Entering ...........");
DPRINTK("ATEN2011_break: Start\n");
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Port Paranoia failed \n");
- return;
- }
-
- serial = ATEN2011_get_usb_serial(port, __FUNCTION__);
- if (!serial) {
- DPRINTK("%s", "Serial Paranoia failed \n");
- return;
- }
+ serial = port->serial;
ATEN2011_serial = ATEN2011_get_serial_private(serial);
ATEN2011_port = ATEN2011_get_port_private(port);
// DPRINTK("%s \n"," ATEN2011_write_room:entering ...........");
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- DPRINTK("%s \n", " ATEN2011_write_room:leaving ...........");
- return -1;
- }
-
ATEN2011_port = ATEN2011_get_port_private(port);
if (ATEN2011_port == NULL) {
DPRINTK("%s \n", "ATEN2011_break:leaving ...........");
unsigned char *data1;
DPRINTK("%s \n", "entering ...........");
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Port Paranoia failed \n");
- return -1;
- }
-
serial = port->serial;
- if (ATEN2011_serial_paranoia_check(serial, __FUNCTION__)) {
- DPRINTK("%s", "Serial Paranoia failed \n");
- return -1;
- }
ATEN2011_port = ATEN2011_get_port_private(port);
if (ATEN2011_port == NULL) {
struct ATENINTL_port *ATEN2011_port;
int status;
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return;
- }
-
DPRINTK("- port %d\n", port->number);
ATEN2011_port = ATEN2011_get_port_private(port);
int status;
struct ATENINTL_port *ATEN2011_port = ATEN2011_get_port_private(port);
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return;
- }
-
if (ATEN2011_port == NULL)
return;
struct ATENINTL_port *ATEN2011_port;
DPRINTK("ATEN2011_set_termios: START\n");
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return;
- }
serial = port->serial;
- if (ATEN2011_serial_paranoia_check(serial, __FUNCTION__)) {
- DPRINTK("%s", "Invalid Serial \n");
- return;
- }
-
ATEN2011_port = ATEN2011_get_port_private(port);
if (ATEN2011_port == NULL)
return -1;
port = (struct usb_serial_port *)ATEN2011_port->port;
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return -1;
- }
mcr = ATEN2011_port->shadowMCR;
unsigned int __user *user_arg = (unsigned int __user *)arg;
//printk("%s - port %d, cmd = 0x%x\n", __FUNCTION__, port->number, cmd);
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return -1;
- }
ATEN2011_port = ATEN2011_get_port_private(port);
return -1;
port = (struct usb_serial_port *)ATEN2011_port->port;
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return -1;
- }
-
- if (ATEN2011_serial_paranoia_check(port->serial, __FUNCTION__)) {
- DPRINTK("%s", "Invalid Serial \n");
- return -1;
- }
DPRINTK("%s", "Entering .......... \n");
port = (struct usb_serial_port *)ATEN2011_port->port;
- if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
- DPRINTK("%s", "Invalid port \n");
- return;
- }
-
- if (ATEN2011_serial_paranoia_check(port->serial, __FUNCTION__)) {
- DPRINTK("%s", "Invalid Serial \n");
- return;
- }
-
serial = port->serial;
dbg("%s - port %d", __FUNCTION__, ATEN2011_port->port->number);
}
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static int ATEN2011_serial_paranoia_check(struct usb_serial *serial,
- const char *function)
-{
- if (!serial) {
- dbg("%s - serial == NULL", function);
- return -1;
- }
- if (!serial->type) {
- dbg("%s - serial->type == NULL!", function);
- return -1;
- }
-
- return 0;
-}
-static int ATEN2011_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 struct usb_serial *ATEN2011_get_usb_serial(struct usb_serial_port *port,
- const char *function)
-{
- /* if no port was specified, or it fails a paranoia check */
- if (!port ||
- ATEN2011_port_paranoia_check(port, function) ||
- ATEN2011_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 */
- return NULL;
- }
-
- return port->serial;
-}
-
static struct usb_serial_driver aten_serial_driver = {
.driver = {
.owner = THIS_MODULE,