static int serial_chars_in_buffer (struct tty_struct *tty) { struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); int retval = -EINVAL; if (!serial) return -ENODEV; down (&port->sem); dbg("%s = port %d", __FUNCTION__, port->number); if (!port->open_count) { dbg("%s - port not open", __FUNCTION__); goto exit; } /* pass on to the driver specific version of this function if it is available */ if (serial->type->chars_in_buffer) retval = serial->type->chars_in_buffer(port); else retval = generic_chars_in_buffer(port); exit: up (&port->sem); return retval; }
static int serial_chars_in_buffer (struct tty_struct *tty) { struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); if (!serial) { return -ENODEV; } if (!port->active) { dbg (__FUNCTION__ " - port not open"); return -EINVAL; } /* pass on to the driver specific version of this function if it is available */ if (serial->type->chars_in_buffer) { return (serial->type->chars_in_buffer(port)); } else { return (generic_chars_in_buffer(port)); } }