[PATCH] usb: dwc3: ep0: Clean up unused variables
Many variables in ep0 are set but never used, so should be removed. Signed-off-by: Christos Gkekas--- drivers/usb/dwc3/ep0.c | 20 1 file changed, 20 deletions(-) diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 75e6cb0..a4dceae 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -487,14 +487,10 @@ static int dwc3_ep0_handle_device(struct dwc3 *dwc, static int dwc3_ep0_handle_intf(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl, int set) { - enum usb_device_state state; u32 wValue; - u32 wIndex; int ret = 0; wValue = le16_to_cpu(ctrl->wValue); - wIndex = le16_to_cpu(ctrl->wIndex); - state = dwc->gadget.state; switch (wValue) { case USB_INTRF_FUNC_SUSPEND: @@ -517,14 +513,10 @@ static int dwc3_ep0_handle_endpoint(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl, int set) { struct dwc3_ep *dep; - enum usb_device_state state; u32 wValue; - u32 wIndex; int ret; wValue = le16_to_cpu(ctrl->wValue); - wIndex = le16_to_cpu(ctrl->wIndex); - state = dwc->gadget.state; switch (wValue) { case USB_ENDPOINT_HALT: @@ -551,10 +543,8 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, { u32 recip; int ret; - enum usb_device_state state; recip = ctrl->bRequestType & USB_RECIP_MASK; - state = dwc->gadget.state; switch (recip) { case USB_RECIP_DEVICE: @@ -712,12 +702,10 @@ static int dwc3_ep0_set_sel(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) struct dwc3_ep *dep; enum usb_device_state state = dwc->gadget.state; u16 wLength; - u16 wValue; if (state == USB_STATE_DEFAULT) return -EINVAL; - wValue = le16_to_cpu(ctrl->wValue); wLength = le16_to_cpu(ctrl->wLength); if (wLength != 6) { @@ -842,9 +830,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, struct usb_request *ur; struct dwc3_trb *trb; struct dwc3_ep *ep0; - unsignedmaxp; - unsignedremaining_ur_length; - void*buf; u32 transferred = 0; u32 status; u32 length; @@ -871,11 +856,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, } ur = >request; - buf = ur->buf; - remaining_ur_length = ur->length; length = trb->size & DWC3_TRB_SIZE_MASK; - maxp = ep0->endpoint.maxpacket; transferred = ur->length - length; ur->actual += transferred; @@ -1001,7 +983,6 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, } else if (IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) && req->request.length && req->request.zero) { u32 maxpacket; - u32 rem; ret = usb_gadget_map_request_by_dev(dwc->sysdev, >request, dep->number); @@ -1009,7 +990,6 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, return; maxpacket = dep->endpoint.maxpacket; - rem = req->request.length % maxpacket; /* prepare normal TRB */ dwc3_ep0_prepare_one_trb(dep, req->request.dma, -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[no subject]
unsubscripted -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: configfs: make config_item_type const
Hi Bhumika, [auto build test WARNING on balbi-usb/next] [also build test WARNING on v4.14-rc4 next-20171013] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Bhumika-Goyal/usb-gadget-configfs-make-config_item_type-const/20171014-133441 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: i386-randconfig-x014-201741 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/usb/gadget/configfs.c: In function 'config_desc_make': >> drivers/usb/gadget/configfs.c:668:5: warning: passing argument 3 of >> 'config_group_init_type_name' discards 'const' qualifier from pointer target >> type [-Wdiscarded-qualifiers] _config_type); ^ In file included from drivers/usb/gadget/configfs.c:1:0: include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' extern void config_group_init_type_name(struct config_group *group, ^~~ drivers/usb/gadget/configfs.c: In function 'gadgets_make': drivers/usb/gadget/configfs.c:1421:48: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] config_group_init_type_name(>group, name, _root_type); ^ In file included from drivers/usb/gadget/configfs.c:1:0: include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' extern void config_group_init_type_name(struct config_group *group, ^~~ drivers/usb/gadget/configfs.c:1424:4: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] _type); ^ In file included from drivers/usb/gadget/configfs.c:1:0: include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' extern void config_group_init_type_name(struct config_group *group, ^~~ drivers/usb/gadget/configfs.c:1428:4: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] _desc_type); ^ In file included from drivers/usb/gadget/configfs.c:1:0: include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' extern void config_group_init_type_name(struct config_group *group, ^~~ drivers/usb/gadget/configfs.c: At top level: >> drivers/usb/gadget/configfs.c:1487:15: warning: initialization discards >> 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] .ci_type = _type, ^ vim +668 drivers/usb/gadget/configfs.c 88af8bbe Sebastian Andrzej Siewior 2012-12-23 620 88af8bbe Sebastian Andrzej Siewior 2012-12-23 621 static struct config_group *config_desc_make( 88af8bbe Sebastian Andrzej Siewior 2012-12-23 622 struct config_group *group, 88af8bbe Sebastian Andrzej Siewior 2012-12-23 623 const char *name) 88af8bbe Sebastian Andrzej Siewior 2012-12-23 624 { 88af8bbe Sebastian Andrzej Siewior 2012-12-23 625 struct gadget_info *gi; 88af8bbe Sebastian Andrzej Siewior 2012-12-23 626 struct config_usb_cfg *cfg; 88af8bbe Sebastian Andrzej Siewior 2012-12-23 627 char buf[MAX_NAME_LEN]; 88af8bbe Sebastian Andrzej Siewior 2012-12-23 628 char *num_str; 88af8bbe Sebastian Andrzej Siewior 2012-12-23 629 u8 num; 88af8bbe Sebastian Andrzej Siewior 2012-12-23 630 int ret; 88af8bbe Sebastian Andrzej Siewior 2012-12-23 631 88af8bbe Sebastian Andrzej Siewior 2012-12-23 632 gi = container_of(group, struct gadget_info, configs_group); 88af8bbe Sebastian Andrzej Siewior 2012-12-23 633 ret = snprintf(buf, MAX_NAME_LEN, "%s", name); 88af8bbe Sebastian Andrzej Siewior 2012-12-23 634 if (ret >= MAX_NAME_LEN) 88af8bbe Sebastian Andrzej Siewior 2012-12-23 635 return ERR_PTR(-ENAMETOOLONG); 88af8bbe Sebastian Andrzej Siewior 2012-12-23 636 88af8bbe Sebastian Andrzej Siewior 2012-12-23 637 num_str = strchr(buf, '.'); 88af8bbe Sebastian Andrzej Siewior 2012-12-23 638 if (!num_str) { 88af8bbe Sebastian Andrzej Siewior 2012-12-23 639 pr_err("Unable to locate . in name.bConfigurationValue\n"); 88af8bbe Sebastian Andrzej Siewior 2012-12-23 640 return E