Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcfad1bb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: Do not traverse list using list_for_each_safe"

parents 71e3c4be 25ebbe64
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -1361,13 +1361,9 @@ static void gsi_set_clear_dbell(struct usb_ep *ep,
*
* @usb_ep - pointer to usb_ep instance to access DWC3 regs
*/
static bool gsi_check_ready_to_suspend(struct usb_ep *ep, bool f_suspend)
static bool gsi_check_ready_to_suspend(struct dwc3_msm *mdwc)
{
	u32	timeout = 500;
	u32	reg = 0;
	struct dwc3_ep *dep = to_dwc3_ep(ep);
	struct dwc3 *dwc = dep->dwc;
	struct dwc3_msm *mdwc = dev_get_drvdata(dwc->dev->parent);

	while (dwc3_msm_read_reg_field(mdwc->base,
		GSI_IF_STS, GSI_WR_CTRL_STATE_MASK)) {
@@ -1378,14 +1374,6 @@ static bool gsi_check_ready_to_suspend(struct usb_ep *ep, bool f_suspend)
		}
		usleep_range(20, 22);
	}
	/* Check for U3 only if we are not handling Function Suspend */
	if (!f_suspend) {
		reg = dwc3_readl(dwc->regs, DWC3_DSTS);
		if (DWC3_DSTS_USBLNKST(reg) != DWC3_LINK_STATE_U3) {
			dev_err(mdwc->dev, "Unable to suspend GSI ch\n");
			return false;
		}
	}

	return true;
}
@@ -1417,7 +1405,7 @@ static int dwc3_msm_gsi_ep_op(struct usb_ep *ep,
	struct dwc3_msm *mdwc = dev_get_drvdata(dwc->dev->parent);
	struct usb_gsi_request *request;
	struct gsi_channel_info *ch_info;
	bool block_db, f_suspend;
	bool block_db;
	unsigned long flags;

	dbg_log_string("%s(%d):%s", ep->name, ep->ep_num, gsi_op_to_string(op));
@@ -1477,8 +1465,7 @@ static int dwc3_msm_gsi_ep_op(struct usb_ep *ep,
		gsi_set_clear_dbell(ep, block_db);
		break;
	case GSI_EP_OP_CHECK_FOR_SUSPEND:
		f_suspend = *((bool *)op_data);
		ret = gsi_check_ready_to_suspend(ep, f_suspend);
		ret = gsi_check_ready_to_suspend(mdwc);
		break;
	case GSI_EP_OP_DISABLE:
		ret = ep->ops->disable(ep);
+4 −3
Original line number Diff line number Diff line
@@ -1534,7 +1534,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
			 * pointers.
			 */
			if (!r->trb)
				goto out1;
				goto out0;

			if (r->num_pending_sgs) {
				struct dwc3_trb *trb;
@@ -2690,16 +2690,17 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
		const struct dwc3_event_depevt *event, int status)
{
	struct dwc3_request	*req, *n;
	struct dwc3_request	*req;
	struct dwc3_trb		*trb;
	bool			ioc = false;
	int			ret;

	list_for_each_entry_safe(req, n, &dep->started_list, list) {
	while (!list_empty(&dep->started_list)) {
		unsigned length;
		unsigned actual;
		int chain;

		req = next_request(&dep->started_list);
		if (req->trb->ctrl & DWC3_TRB_CTRL_HWO)
			return 0;

+6 −1
Original line number Diff line number Diff line
@@ -1800,11 +1800,16 @@ static int gsi_ctrl_send_notification(struct f_gsi *gsi)
	__le32 *data;
	struct usb_cdc_notification *event;
	struct usb_request *req = gsi->c_port.notify_req;
	struct usb_composite_dev *cdev = gsi->function.config->cdev;
	struct usb_composite_dev *cdev;
	struct gsi_ctrl_pkt *cpkt;
	unsigned long flags;
	bool del_free_cpkt = false;

	if (!gsi->function.config)
		return -ENODEV;

	cdev = gsi->function.config->cdev;

	if (!atomic_read(&gsi->connected)) {
		log_event_dbg("%s: cable disconnect", __func__);
		return -ENODEV;