#define pr_warning(fmt, args...) printf(fmt, ##args)
#endif
+#ifndef __maybe_unused
+#define __maybe_unused __attribute__((unused))
+#endif
+
/*
* This component encapsulates the TTY layer glue needed to provide basic
* "serial port" functionality through the USB gadget stack. Each such
struct list_head *pool = &port->write_pool;
struct usb_ep *in = NULL;
int status = 0;
- bool do_tty_wake = false;
if (!port->port_usb){
return status;
wake_up_interruptible(&port->drain_wait);
break;
}
- do_tty_wake = true;
req->length = len;
list_del(&req->list);
}
}
- //if (do_tty_wake && port->port_tty)
- // tty_wakeup(port->port_tty);
return status;
}
//buf: the buf address where data put
//*count: read length wanted, when return store actually read count
//return: weather read really done
-int gs_read(const unsigned char *buf, int *count)
+int gs_read(unsigned char *buf, int *count)
{
struct gs_port *port = ports[vcom_port].port;
struct list_head *queue = &port->read_queue;
}
port->n_read = 0;
}
-recycle:
+
list_move(&req->list, &port->read_pool);
port->read_started--;
}
{
struct gs_port *port = ports[vcom_port].port;
if (count)
- count = gs_buf_put(&port->port_write_buf, buf, count);
+ count = gs_buf_put(&port->port_write_buf, (const char *)buf, count);
/* treat count == 0 as flush_chars() */
if (port->port_usb)
usb_trans_status = gs_start_tx(port);
static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
struct gs_port *port = tty->driver_data;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
int status;
pr_vdebug("gs_write: ttyGS%d (%p) writing %d bytes\n",
spin_lock_irqsave(&port->port_lock, flags);
if (count)
- count = gs_buf_put(&port->port_write_buf, buf, count);
+ count = gs_buf_put(&port->port_write_buf, (const char *)buf, count);
/* treat count == 0 as flush_chars() */
if (port->port_usb)
status = gs_start_tx(port);
static int gs_put_char(struct tty_struct *tty, unsigned char ch)
{
struct gs_port *port = tty->driver_data;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
int status;
pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %p\n",
static void gs_flush_chars(struct tty_struct *tty)
{
struct gs_port *port = tty->driver_data;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
pr_vdebug("gs_flush_chars: (%d,%p)\n", port->port_num, tty);
static int gs_write_room(struct tty_struct *tty)
{
struct gs_port *port = tty->driver_data;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
int room = 0;
spin_lock_irqsave(&port->port_lock, flags);
static int gs_chars_in_buffer(struct tty_struct *tty)
{
struct gs_port *port = tty->driver_data;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
int chars = 0;
spin_lock_irqsave(&port->port_lock, flags);
static void gs_unthrottle(struct tty_struct *tty)
{
struct gs_port *port = tty->driver_data;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
spin_lock_irqsave(&port->port_lock, flags);
if (port->port_usb) {
return status;
}
+#if 0
static int gs_closed(struct gs_port *port)
{
int cond;
spin_unlock_irq(&port->port_lock);
return cond;
}
+#endif
/**
* gserial_cleanup - remove TTY-over-USB driver and devices
// tasklet_kill(&port->push);
+#if 0
/* wait for old opens to finish */
-// wait_event(port->close_wait, gs_closed(port));
+ wait_event(port->close_wait, gs_closed(port));
+#endif
//WARN_ON(port->port_usb != NULL);
int gserial_connect(struct gserial *gser, u8 port_num)
{
struct gs_port *port;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
int status;
#if 0
if (!gs_tty_driver || port_num >= n_ports)
void gserial_disconnect(struct gserial *gser)
{
struct gs_port *port = gser->ioport;
- unsigned long flags;
+ __maybe_unused unsigned long flags;
if (!port)
return;