struct usb_request *req)
{
struct f_acm *acm = ep->driver_data;
- struct usb_composite_dev *cdev = acm->port.func.config->cdev;
if (req->status != 0) {
- DBG(cdev, "acm ttyGS%d completion, err %d\n",
+ DBG(acm->port.func.config->cdev,
+ "acm ttyGS%d completion, err %d\n",
acm->port_num, req->status);
return;
}
/* normal completion */
if (req->actual != sizeof(acm->port_line_coding)) {
- DBG(cdev, "acm ttyGS%d short resp, len %d\n",
+ DBG(acm->port.func.config->cdev,
+ "acm ttyGS%d short resp, len %d\n",
acm->port_num, req->actual);
usb_ep_set_halt(ep);
} else {
static void acm_disable(struct usb_function *f)
{
struct f_acm *acm = func_to_acm(f);
- struct usb_composite_dev *cdev = f->config->cdev;
- DBG(cdev, "acm ttyGS%d deactivated\n", acm->port_num);
+ DBG(f->config->cdev, "acm ttyGS%d deactivated\n", acm->port_num);
gserial_disconnect(&acm->port);
usb_ep_disable(acm->notify);
acm->notify->driver_data = NULL;
static int acm_notify_serial_state(struct f_acm *acm)
{
- struct usb_composite_dev *cdev = acm->port.func.config->cdev;
int status;
spin_lock(&acm->lock);
if (acm->notify_req) {
- DBG(cdev, "acm ttyGS%d serial state %04x\n",
+ DBG(acm->port.func.config->cdev,
+ "acm ttyGS%d serial state %04x\n",
acm->port_num, acm->serial_state);
status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
0, &acm->serial_state, sizeof(acm->serial_state));
static void obex_disable(struct usb_function *f)
{
struct f_obex *obex = func_to_obex(f);
- struct usb_composite_dev *cdev = f->config->cdev;
- DBG(cdev, "obex ttyGS%d disable\n", obex->port_num);
+ DBG(f->config->cdev, "obex ttyGS%d disable\n", obex->port_num);
gserial_disconnect(&obex->port);
}
static void obex_connect(struct gserial *g)
{
struct f_obex *obex = port_to_obex(g);
- struct usb_composite_dev *cdev = g->func.config->cdev;
int status;
if (!obex->can_activate)
status = usb_function_activate(&g->func);
if (status)
- DBG(cdev, "obex ttyGS%d function activate --> %d\n",
+ DBG(g->func.config->cdev,
+ "obex ttyGS%d function activate --> %d\n",
obex->port_num, status);
}
static void obex_disconnect(struct gserial *g)
{
struct f_obex *obex = port_to_obex(g);
- struct usb_composite_dev *cdev = g->func.config->cdev;
int status;
if (!obex->can_activate)
status = usb_function_deactivate(&g->func);
if (status)
- DBG(cdev, "obex ttyGS%d function deactivate --> %d\n",
+ DBG(g->func.config->cdev,
+ "obex ttyGS%d function deactivate --> %d\n",
obex->port_num, status);
}
#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;