lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  3 Apr 2013 10:45:13 +0200
From:	Fabio Baltieri <fabio.baltieri@...aro.org>
To:	Felipe Balbi <balbi@...com>
Cc:	Linus Walleij <linus.walleij@...aro.org>,
	Praveena Nadahally <praveen.nadahally@...ricsson.com>,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
	Sakethram Bommisetti <sakethram.bommisetti@...ricsson.com>,
	Fabio Baltieri <fabio.baltieri@...aro.org>
Subject: [PATCH 12/12] usb: phy: ab8500-usb: call phy_dis_work only when necessary

From: Sakethram Bommisetti <sakethram.bommisetti@...ricsson.com>

Modify ab8500_usb_set_peripheral() and ab8500_usb_set_host() code to
schedule phy_dis_work only when necessary in order to prevent regulator
count mismatch during reboot/shutdown.

Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@...ricsson.com>
Acked-by: Linus Walleij <linus.walleij@...aro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@...aro.org>
---
 drivers/usb/phy/phy-ab8500-usb.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 30adfee..81d1a5a 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -613,17 +613,16 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg,
 
 	ab = phy_to_ab(otg->phy);
 
+	ab->phy.otg->gadget = gadget;
+
 	/* Some drivers call this function in atomic context.
 	 * Do not update ab8500 registers directly till this
 	 * is fixed.
 	 */
 
-	if (!gadget) {
-		otg->gadget = NULL;
+	if ((ab->mode != USB_IDLE) && (!gadget)) {
+		ab->mode = USB_IDLE;
 		schedule_work(&ab->phy_dis_work);
-	} else {
-		otg->gadget = gadget;
-		otg->phy->state = OTG_STATE_B_IDLE;
 	}
 
 	return 0;
@@ -638,16 +637,16 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
 
 	ab = phy_to_ab(otg->phy);
 
+	ab->phy.otg->host = host;
+
 	/* Some drivers call this function in atomic context.
 	 * Do not update ab8500 registers directly till this
 	 * is fixed.
 	 */
 
-	if (!host) {
-		otg->host = NULL;
+	if ((ab->mode != USB_IDLE) && (!host)) {
+		ab->mode = USB_IDLE;
 		schedule_work(&ab->phy_dis_work);
-	} else {
-		otg->host = host;
 	}
 
 	return 0;
-- 
1.8.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ