提交 4439661d 编写于 作者: F Felipe Balbi

usb: dwc3: gadget: assign resource_index inside get_transfer_index()

Instead of returning resource index number just to assign it to a
field inside 'dep' which was passed as argument, we can assing
dep->resource_index from inside dwc3_gadget_ep_get_transfer_index()
itself.
Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
上级 f62afb49
...@@ -79,7 +79,7 @@ static int dwc3_ep0_start_trans(struct dwc3_ep *dep) ...@@ -79,7 +79,7 @@ static int dwc3_ep0_start_trans(struct dwc3_ep *dep)
if (ret < 0) if (ret < 0)
return ret; return ret;
dep->resource_index = dwc3_gadget_ep_get_transfer_index(dep); dwc3_gadget_ep_get_transfer_index(dep);
dwc->ep0_next_event = DWC3_EP0_COMPLETE; dwc->ep0_next_event = DWC3_EP0_COMPLETE;
return 0; return 0;
......
...@@ -683,8 +683,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action) ...@@ -683,8 +683,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
if (ret < 0) if (ret < 0)
return ret; return ret;
dep->resource_index = dwc3_gadget_ep_get_transfer_index(dep); dwc3_gadget_ep_get_transfer_index(dep);
WARN_ON_ONCE(!dep->resource_index);
} }
out: out:
...@@ -1245,10 +1244,8 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) ...@@ -1245,10 +1244,8 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
return ret; return ret;
} }
if (starting) { if (starting)
dep->resource_index = dwc3_gadget_ep_get_transfer_index(dep); dwc3_gadget_ep_get_transfer_index(dep);
WARN_ON_ONCE(!dep->resource_index);
}
return 0; return 0;
} }
......
...@@ -98,13 +98,12 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol); ...@@ -98,13 +98,12 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol);
* Caller should take care of locking. Returns the transfer resource * Caller should take care of locking. Returns the transfer resource
* index for a given endpoint. * index for a given endpoint.
*/ */
static inline u32 dwc3_gadget_ep_get_transfer_index(struct dwc3_ep *dep) static inline void dwc3_gadget_ep_get_transfer_index(struct dwc3_ep *dep)
{ {
u32 res_id; u32 res_id;
res_id = dwc3_readl(dep->regs, DWC3_DEPCMD); res_id = dwc3_readl(dep->regs, DWC3_DEPCMD);
dep->resource_index = DWC3_DEPCMD_GET_RSC_IDX(res_id);
return DWC3_DEPCMD_GET_RSC_IDX(res_id);
} }
#endif /* __DRIVERS_USB_DWC3_GADGET_H */ #endif /* __DRIVERS_USB_DWC3_GADGET_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册