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

Commit 758ed196 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Felipe Balbi
Browse files

usb: dwc2: remove no longer needed init_mutex



init_mutex is a leftover from the time, when s3c-hsotg driver did not
implement proper pull up/down control and emulated it by enabling
enabling/disabling usb phy. Proper pull up/down control has been added
by commit 5b9451f8 ("usb: dwc2: gadget:
use soft-disconnect udc feature in pullup() method"), so init_muxtex can
be removed now to avoid potential deadlocks with other locks.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Acked-by: default avatarJohn Youn <johnyoun@synopsys.com>
Tested-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 145f48c5
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -712,7 +712,6 @@ struct dwc2_hsotg {
	struct regulator_bulk_data supplies[ARRAY_SIZE(dwc2_hsotg_supply_names)];
	struct regulator_bulk_data supplies[ARRAY_SIZE(dwc2_hsotg_supply_names)];


	spinlock_t lock;
	spinlock_t lock;
	struct mutex init_mutex;
	void *priv;
	void *priv;
	int     irq;
	int     irq;
	struct clk *clk;
	struct clk *clk;
+0 −17
Original line number Original line Diff line number Diff line
@@ -3193,7 +3193,6 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget,
		return -EINVAL;
		return -EINVAL;
	}
	}


	mutex_lock(&hsotg->init_mutex);
	WARN_ON(hsotg->driver);
	WARN_ON(hsotg->driver);


	driver->driver.bus = NULL;
	driver->driver.bus = NULL;
@@ -3220,12 +3219,9 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget,


	dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
	dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);


	mutex_unlock(&hsotg->init_mutex);

	return 0;
	return 0;


err:
err:
	mutex_unlock(&hsotg->init_mutex);
	hsotg->driver = NULL;
	hsotg->driver = NULL;
	return ret;
	return ret;
}
}
@@ -3246,8 +3242,6 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget)
	if (!hsotg)
	if (!hsotg)
		return -ENODEV;
		return -ENODEV;


	mutex_lock(&hsotg->init_mutex);

	/* all endpoints should be shutdown */
	/* all endpoints should be shutdown */
	for (ep = 1; ep < hsotg->num_of_eps; ep++) {
	for (ep = 1; ep < hsotg->num_of_eps; ep++) {
		if (hsotg->eps_in[ep])
		if (hsotg->eps_in[ep])
@@ -3270,8 +3264,6 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget)


	regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
	regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);


	mutex_unlock(&hsotg->init_mutex);

	return 0;
	return 0;
}
}


@@ -3307,7 +3299,6 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on)
		return 0;
		return 0;
	}
	}


	mutex_lock(&hsotg->init_mutex);
	spin_lock_irqsave(&hsotg->lock, flags);
	spin_lock_irqsave(&hsotg->lock, flags);
	if (is_on) {
	if (is_on) {
		hsotg->enabled = 1;
		hsotg->enabled = 1;
@@ -3321,7 +3312,6 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on)


	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
	spin_unlock_irqrestore(&hsotg->lock, flags);
	spin_unlock_irqrestore(&hsotg->lock, flags);
	mutex_unlock(&hsotg->init_mutex);


	return 0;
	return 0;
}
}
@@ -3832,8 +3822,6 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
	if (hsotg->lx_state != DWC2_L0)
	if (hsotg->lx_state != DWC2_L0)
		return ret;
		return ret;


	mutex_lock(&hsotg->init_mutex);

	if (hsotg->driver) {
	if (hsotg->driver) {
		int ep;
		int ep;


@@ -3861,8 +3849,6 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
		clk_disable(hsotg->clk);
		clk_disable(hsotg->clk);
	}
	}


	mutex_unlock(&hsotg->init_mutex);

	return ret;
	return ret;
}
}


@@ -3874,8 +3860,6 @@ int dwc2_hsotg_resume(struct dwc2_hsotg *hsotg)
	if (hsotg->lx_state == DWC2_L2)
	if (hsotg->lx_state == DWC2_L2)
		return ret;
		return ret;


	mutex_lock(&hsotg->init_mutex);

	if (hsotg->driver) {
	if (hsotg->driver) {
		dev_info(hsotg->dev, "resuming usb gadget %s\n",
		dev_info(hsotg->dev, "resuming usb gadget %s\n",
			 hsotg->driver->driver.name);
			 hsotg->driver->driver.name);
@@ -3892,7 +3876,6 @@ int dwc2_hsotg_resume(struct dwc2_hsotg *hsotg)
			dwc2_hsotg_core_connect(hsotg);
			dwc2_hsotg_core_connect(hsotg);
		spin_unlock_irqrestore(&hsotg->lock, flags);
		spin_unlock_irqrestore(&hsotg->lock, flags);
	}
	}
	mutex_unlock(&hsotg->init_mutex);


	return ret;
	return ret;
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -252,7 +252,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
	}
	}


	spin_lock_init(&hsotg->lock);
	spin_lock_init(&hsotg->lock);
	mutex_init(&hsotg->init_mutex);


	/* Detect config values from hardware */
	/* Detect config values from hardware */
	retval = dwc2_get_hwparams(hsotg);
	retval = dwc2_get_hwparams(hsotg);