From: Seung-Woo Kim Date: Tue, 2 Jan 2018 06:46:56 +0000 (+0900) Subject: usb: gadget: remove build warnings X-Git-Tag: accepted/tizen/5.0/unified/20181106.201708~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b2c912b69f1719e86c53fd9efaf42515666e3d8;p=profile%2Fmobile%2Fplatform%2Fkernel%2Fu-boot-tm1.git usb: gadget: remove build warnings Remove build warnings. Change-Id: I528624a8700aaa9dc37860309e80156c74e81f5a Signed-off-by: Seung-Woo Kim --- diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index 92c5f66..0dc0499 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -267,17 +267,18 @@ static void acm_complete_set_line_coding(struct usb_ep *ep, 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 { @@ -418,9 +419,8 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) 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; @@ -485,12 +485,12 @@ static int acm_cdc_notify(struct f_acm *acm, u8 type, u16 value, 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)); diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c index eed4a0d..e7214be 100644 --- a/drivers/usb/gadget/f_obex.c +++ b/drivers/usb/gadget/f_obex.c @@ -263,9 +263,8 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) 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); } @@ -274,7 +273,6 @@ static void obex_disable(struct usb_function *f) 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) @@ -282,14 +280,14 @@ static void obex_connect(struct gserial *g) 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) @@ -297,7 +295,8 @@ static void obex_disconnect(struct gserial *g) 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); } diff --git a/drivers/usb/gadget/f_serial.c b/drivers/usb/gadget/f_serial.c index e7c6dd6..dafde21 100644 --- a/drivers/usb/gadget/f_serial.c +++ b/drivers/usb/gadget/f_serial.c @@ -196,9 +196,8 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt) static void gser_disable(struct usb_function *f) { struct f_gser *gser = func_to_gser(f); - struct usb_composite_dev *cdev = f->config->cdev; - DBG(cdev, "generic ttyGS%d deactivated\n", gser->port_num); + DBG(f->config->cdev, "generic ttyGS%d deactivated\n", gser->port_num); usb_port_open = false; gserial_disconnect(&gser->port); } diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 82b71db..9e1d73b 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c @@ -35,6 +35,10 @@ #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 @@ -366,7 +370,6 @@ __acquires(&port->port_lock) 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; @@ -386,7 +389,6 @@ __acquires(&port->port_lock) wake_up_interruptible(&port->drain_wait); break; } - do_tty_wake = true; req->length = len; list_del(&req->list); @@ -422,8 +424,6 @@ __acquires(&port->port_lock) } } - //if (do_tty_wake && port->port_tty) - // tty_wakeup(port->port_tty); return status; } @@ -734,7 +734,7 @@ exit: //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; @@ -785,7 +785,7 @@ int gs_read(const unsigned char *buf, int *count) } port->n_read = 0; } -recycle: + list_move(&req->list, &port->read_pool); port->read_started--; } @@ -805,7 +805,7 @@ int gs_write(const unsigned char *buf, int count) { 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); @@ -1188,7 +1188,7 @@ exit: 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", @@ -1196,7 +1196,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count) 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); @@ -1208,7 +1208,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count) 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", @@ -1224,7 +1224,7 @@ static int gs_put_char(struct tty_struct *tty, unsigned char ch) 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); @@ -1237,7 +1237,7 @@ static void gs_flush_chars(struct tty_struct *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); @@ -1254,7 +1254,7 @@ static int gs_write_room(struct tty_struct *tty) 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); @@ -1271,7 +1271,7 @@ static int gs_chars_in_buffer(struct tty_struct *tty) 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) { @@ -1453,6 +1453,7 @@ fail: return status; } +#if 0 static int gs_closed(struct gs_port *port) { int cond; @@ -1462,6 +1463,7 @@ static int gs_closed(struct gs_port *port) spin_unlock_irq(&port->port_lock); return cond; } +#endif /** * gserial_cleanup - remove TTY-over-USB driver and devices @@ -1497,8 +1499,10 @@ void gserial_cleanup(void) // 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); @@ -1537,7 +1541,7 @@ void gserial_cleanup(void) 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) @@ -1611,7 +1615,7 @@ fail_out: void gserial_disconnect(struct gserial *gser) { struct gs_port *port = gser->ioport; - unsigned long flags; + __maybe_unused unsigned long flags; if (!port) return; diff --git a/property/calibration_mode.c b/property/calibration_mode.c index b211856..0f548f0 100644 --- a/property/calibration_mode.c +++ b/property/calibration_mode.c @@ -57,7 +57,7 @@ extern int gpio_get_value(int PinNo); extern int gs_open(void); extern int spi_channel_init(unsigned long phy_id); extern int usb_is_trans_done(int direct); -extern int gs_read(const unsigned char *buf, int *count); +extern int gs_read(unsigned char *buf, int *count); extern int gs_write(const unsigned char *buf, int count); extern void usb_wait_trans_done(int direct); extern void gs_reset_usb_param(void);