Skip to content

Commit

Permalink
usb: gadget: fix unused-but-set-variale warnings
Browse files Browse the repository at this point in the history
Those are enabled with W=1 make option.

The patch leaves of some type-limits warnings which are caused by
generic macros used in a way where they produce always-false
conditions.

Signed-off-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
mina86 authored and Felipe Balbi committed Jun 21, 2016
1 parent 9522def commit 872ce51
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 60 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/gadget/function/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2227,8 +2227,8 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
{
u32 str_count, needed_count, lang_count;
struct usb_gadget_strings **stringtabs, *t;
struct usb_string *strings, *s;
const char *data = _data;
struct usb_string *s;

ENTER();

Expand Down Expand Up @@ -2286,7 +2286,6 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
stringtabs = vla_ptr(vlabuf, d, stringtabs);
t = vla_ptr(vlabuf, d, stringtab);
s = vla_ptr(vlabuf, d, strings);
strings = s;
}

/* For each language */
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/gadget/function/u_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,6 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
struct gs_port *port = tty->driver_data;
unsigned long flags;
int status;

pr_vdebug("gs_write: ttyGS%d (%p) writing %d bytes\n",
port->port_num, tty, count);
Expand All @@ -917,7 +916,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
count = gs_buf_put(&port->port_write_buf, buf, count);
/* treat count == 0 as flush_chars() */
if (port->port_usb)
status = gs_start_tx(port);
gs_start_tx(port);
spin_unlock_irqrestore(&port->port_lock, flags);

return count;
Expand Down
15 changes: 6 additions & 9 deletions drivers/usb/gadget/legacy/g_ffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void *functionfs_acquire_dev(struct ffs_dev *dev)
{
if (!try_module_get(THIS_MODULE))
return ERR_PTR(-ENOENT);

return NULL;
}

Expand All @@ -275,7 +275,7 @@ static void functionfs_release_dev(struct ffs_dev *dev)
}

/*
* The caller of this function takes ffs_lock
* The caller of this function takes ffs_lock
*/
static int functionfs_ready_callback(struct ffs_data *ffs)
{
Expand All @@ -294,12 +294,12 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
++missing_funcs;
gfs_registered = false;
}

return ret;
}

/*
* The caller of this function takes ffs_lock
* The caller of this function takes ffs_lock
*/
static void functionfs_closed_callback(struct ffs_data *ffs)
{
Expand Down Expand Up @@ -347,17 +347,14 @@ static int gfs_bind(struct usb_composite_dev *cdev)

#ifdef CONFIG_USB_FUNCTIONFS_RNDIS
{
struct f_rndis_opts *rndis_opts;

fi_rndis = usb_get_function_instance("rndis");
if (IS_ERR(fi_rndis)) {
ret = PTR_ERR(fi_rndis);
goto error;
}
rndis_opts = container_of(fi_rndis, struct f_rndis_opts,
func_inst);
#ifndef CONFIG_USB_FUNCTIONFS_ETH
net = rndis_opts->net;
net = container_of(fi_rndis, struct f_rndis_opts,
func_inst)->net;
#endif
}
#endif
Expand Down
9 changes: 1 addition & 8 deletions drivers/usb/gadget/udc/amd5536udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,6 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
struct udc_ep *ep;
struct udc_request *req;
struct udc_data_dma *td;
unsigned dma_done;
unsigned len;

ep = &dev->ep[ep_ix];
Expand Down Expand Up @@ -2385,13 +2384,8 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
*/
if (use_dma_ppb_du) {
td = udc_get_last_dma_desc(req);
if (td) {
dma_done =
AMD_GETBITS(td->status,
UDC_DMA_IN_STS_BS);
/* don't care DMA done */
if (td)
req->req.actual = req->req.length;
}
} else {
/* assume all bytes transferred */
req->req.actual = req->req.length;
Expand Down Expand Up @@ -3417,4 +3411,3 @@ module_pci_driver(udc_pci_driver);
MODULE_DESCRIPTION(UDC_MOD_DESCRIPTION);
MODULE_AUTHOR("Thomas Dahlmann");
MODULE_LICENSE("GPL");

3 changes: 0 additions & 3 deletions drivers/usb/gadget/udc/bdc/bdc_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static int bdc_submit_cmd(struct bdc *bdc, u32 cmd_sc,
u32 param0, u32 param1, u32 param2)
{
u32 temp, cmd_status;
int reset_bdc = 0;
int ret;

temp = bdc_readl(bdc->regs, BDC_CMDSC);
Expand Down Expand Up @@ -94,15 +93,13 @@ static int bdc_submit_cmd(struct bdc *bdc, u32 cmd_sc,

case BDC_CMDS_INTL:
dev_err(bdc->dev, "BDC Internal error\n");
reset_bdc = 1;
ret = -ECONNRESET;
break;

case BDC_CMDS_BUSY:
dev_err(bdc->dev,
"command timedout waited for %dusec\n",
BDC_CMD_TIMEOUT);
reset_bdc = 1;
ret = -ECONNRESET;
break;
default:
Expand Down
4 changes: 0 additions & 4 deletions drivers/usb/gadget/udc/bdc/bdc_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,9 @@ static int ep0_queue(struct bdc_ep *ep, struct bdc_req *req)
/* Queue data stage */
static int ep0_queue_data_stage(struct bdc *bdc)
{
struct usb_request *ep0_usb_req;
struct bdc_ep *ep;

dev_dbg(bdc->dev, "%s\n", __func__);
ep0_usb_req = &bdc->ep0_req.usb_req;
ep = bdc->bdc_ep_array[1];
bdc->ep0_req.ep = ep;
bdc->ep0_req.usb_req.complete = NULL;
Expand Down Expand Up @@ -1393,10 +1391,8 @@ static int ep0_set_sel(struct bdc *bdc,
{
struct bdc_ep *ep;
u16 wLength;
u16 wValue;

dev_dbg(bdc->dev, "%s\n", __func__);
wValue = le16_to_cpu(setup_pkt->wValue);
wLength = le16_to_cpu(setup_pkt->wLength);
if (unlikely(wLength != 6)) {
dev_err(bdc->dev, "%s Wrong wLength:%d\n", __func__, wLength);
Expand Down
5 changes: 0 additions & 5 deletions drivers/usb/gadget/udc/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,10 @@ static int dummy_disable(struct usb_ep *_ep)
static struct usb_request *dummy_alloc_request(struct usb_ep *_ep,
gfp_t mem_flags)
{
struct dummy_ep *ep;
struct dummy_request *req;

if (!_ep)
return NULL;
ep = usb_ep_to_dummy_ep(_ep);

req = kzalloc(sizeof(*req), mem_flags);
if (!req)
Expand Down Expand Up @@ -2444,9 +2442,6 @@ static int dummy_start(struct usb_hcd *hcd)

static void dummy_stop(struct usb_hcd *hcd)
{
struct dummy *dum;

dum = hcd_to_dummy_hcd(hcd)->dum;
device_remove_file(dummy_dev(hcd_to_dummy_hcd(hcd)), &dev_attr_urbs);
dev_info(dummy_dev(hcd_to_dummy_hcd(hcd)), "stopped\n");
}
Expand Down
9 changes: 2 additions & 7 deletions drivers/usb/gadget/udc/mv_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int process_ep_req(struct mv_udc *udc, int index,
{
struct mv_dtd *curr_dtd;
struct mv_dqh *curr_dqh;
int td_complete, actual, remaining_length;
int actual, remaining_length;
int i, direction;
int retval = 0;
u32 errors;
Expand All @@ -139,7 +139,6 @@ static int process_ep_req(struct mv_udc *udc, int index,
direction = index % 2;

curr_dtd = curr_req->head;
td_complete = 0;
actual = curr_req->req.length;

for (i = 0; i < curr_req->dtd_count; i++) {
Expand Down Expand Up @@ -412,11 +411,8 @@ static int req_to_dtd(struct mv_req *req)
unsigned count;
int is_last, is_first = 1;
struct mv_dtd *dtd, *last_dtd = NULL;
struct mv_udc *udc;
dma_addr_t dma;

udc = req->ep->udc;

do {
dtd = build_dtd(req, &count, &dma, &is_last);
if (dtd == NULL)
Expand Down Expand Up @@ -567,7 +563,7 @@ static int mv_ep_disable(struct usb_ep *_ep)
struct mv_udc *udc;
struct mv_ep *ep;
struct mv_dqh *dqh;
u32 bit_pos, epctrlx, direction;
u32 epctrlx, direction;
unsigned long flags;

ep = container_of(_ep, struct mv_ep, ep);
Expand All @@ -582,7 +578,6 @@ static int mv_ep_disable(struct usb_ep *_ep)
spin_lock_irqsave(&udc->lock, flags);

direction = ep_dir(ep);
bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num);

/* Reset the max packet length and the interrupt on Setup */
dqh->max_packet_length = 0;
Expand Down
4 changes: 0 additions & 4 deletions drivers/usb/gadget/udc/net2272.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,10 @@ static int net2272_disable(struct usb_ep *_ep)
static struct usb_request *
net2272_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{
struct net2272_ep *ep;
struct net2272_request *req;

if (!_ep)
return NULL;
ep = container_of(_ep, struct net2272_ep, ep);

req = kzalloc(sizeof(*req), gfp_flags);
if (!req)
Expand All @@ -348,10 +346,8 @@ net2272_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
static void
net2272_free_request(struct usb_ep *_ep, struct usb_request *_req)
{
struct net2272_ep *ep;
struct net2272_request *req;

ep = container_of(_ep, struct net2272_ep, ep);
if (!_ep || !_req)
return;

Expand Down
20 changes: 7 additions & 13 deletions drivers/usb/gadget/udc/pch_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,9 +1984,8 @@ static int pch_udc_pcd_set_halt(struct usb_ep *usbep, int halt)
if (ep->num == PCH_UDC_EP0)
ep->dev->stall = 1;
pch_udc_ep_set_stall(ep);
pch_udc_enable_ep_interrupts(ep->dev,
PCH_UDC_EPINT(ep->in,
ep->num));
pch_udc_enable_ep_interrupts(
ep->dev, PCH_UDC_EPINT(ep->in, ep->num));
} else {
pch_udc_ep_clear_stall(ep);
}
Expand Down Expand Up @@ -2451,16 +2450,11 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev)
*/
static void pch_udc_postsvc_epinters(struct pch_udc_dev *dev, int ep_num)
{
struct pch_udc_ep *ep;
struct pch_udc_request *req;

ep = &dev->ep[UDC_EPIN_IDX(ep_num)];
if (!list_empty(&ep->queue)) {
req = list_entry(ep->queue.next, struct pch_udc_request, queue);
pch_udc_enable_ep_interrupts(ep->dev,
PCH_UDC_EPINT(ep->in, ep->num));
pch_udc_ep_clear_nak(ep);
}
struct pch_udc_ep *ep = &dev->ep[UDC_EPIN_IDX(ep_num)];
if (list_empty(&ep->queue))
return;
pch_udc_enable_ep_interrupts(ep->dev, PCH_UDC_EPINT(ep->in, ep->num));
pch_udc_ep_clear_nak(ep);
}

/**
Expand Down
3 changes: 0 additions & 3 deletions drivers/usb/gadget/udc/udc-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,6 @@ static int xudc_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct resource *res;
struct xusb_udc *udc;
struct xusb_ep *ep0;
int irq;
int ret;
u32 ier;
Expand Down Expand Up @@ -2119,8 +2118,6 @@ static int xudc_probe(struct platform_device *pdev)

xudc_eps_init(udc);

ep0 = &udc->ep[0];

/* Set device address to 0.*/
udc->write_fn(udc->addr, XUSB_ADDRESS_OFFSET, 0);

Expand Down

0 comments on commit 872ce51

Please sign in to comment.