linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] musb fixes and cleanups
@ 2011-12-19 20:17 Felipe Contreras
  2011-12-19 20:17 ` [PATCH v2 1/4] usb: musb: fix pm_runtime mismatches Felipe Contreras
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Felipe Contreras @ 2011-12-19 20:17 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-omap, Alan Stern, Felipe Balbi, Greg Kroah-Hartman,
	Jiri Kosina, Felipe Contreras

Hi,

Here's a few cleanups and possible fixes. Nothing major.

In v2 I added comments from Alan Stern, and another possible fix by removing
some pm_runtime_disable() calls.

Felipe Contreras (4):
  usb: musb: fix pm_runtime mismatches
  usb: musb: trivial cleanup
  usb: musb: remove a bit of indentation
  musb: omap2430: avoid pm_runtime_disable()

 drivers/usb/musb/musb_gadget.c |    1 +
 drivers/usb/musb/omap2430.c    |   38 +++++++++++++++-----------------------
 2 files changed, 16 insertions(+), 23 deletions(-)

-- 
1.7.8


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/4] usb: musb: fix pm_runtime mismatches
  2011-12-19 20:17 [PATCH v2 0/4] musb fixes and cleanups Felipe Contreras
@ 2011-12-19 20:17 ` Felipe Contreras
       [not found] ` <1324325871-15137-1-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2011-12-19 20:17 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-omap, Alan Stern, Felipe Balbi, Greg Kroah-Hartman,
	Jiri Kosina, Felipe Contreras

From: Felipe Contreras <felipe.contreras@gmail.com>

Properly call pm_runtime_put() afer pm_runttime_get() on errors.
Comments from Alan Stern.

Untested.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/usb/musb/musb_gadget.c |    1 +
 drivers/usb/musb/omap2430.c    |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 922148f..4d6a37a 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1960,6 +1960,7 @@ static int musb_gadget_start(struct usb_gadget *g,
 err2:
 	if (!is_otg_enabled(musb))
 		musb_stop(musb);
+	pm_runtime_put_sync(musb->controller);
 err0:
 	return retval;
 }
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ba85f27..1a5d45e 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -389,6 +389,7 @@ static int omap2430_musb_exit(struct musb *musb)
 
 	omap2430_low_level_exit(musb);
 	otg_put_transceiver(musb->xceiv);
+	pm_runtime_put_sync(musb->controller);
 
 	return 0;
 }
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/4] usb: musb: trivial cleanup
       [not found] ` <1324325871-15137-1-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2011-12-19 20:17   ` Felipe Contreras
       [not found]     ` <1324325871-15137-3-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2011-12-19 20:17 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap, Alan Stern, Felipe Balbi, Greg Kroah-Hartman,
	Jiri Kosina, Felipe Contreras

From: Felipe Contreras <felipe.contreras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

enabled && driver || !enabled can be simplified to !enabled || driver.

Signed-off-by: Felipe Contreras <felipe.contreras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/musb/omap2430.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 1a5d45e..6f574ec 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -236,13 +236,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
 	case USB_EVENT_ID:
 		dev_dbg(musb->controller, "ID GND\n");
 
-		if (is_otg_enabled(musb)) {
-			if (musb->gadget_driver) {
-				pm_runtime_get_sync(musb->controller);
-				otg_init(musb->xceiv);
-				omap2430_musb_set_vbus(musb, 1);
-			}
-		} else {
+		if (!is_otg_enabled(musb) || musb->gadget_driver) {
 			pm_runtime_get_sync(musb->controller);
 			otg_init(musb->xceiv);
 			omap2430_musb_set_vbus(musb, 1);
-- 
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/4] usb: musb: remove a bit of indentation
  2011-12-19 20:17 [PATCH v2 0/4] musb fixes and cleanups Felipe Contreras
  2011-12-19 20:17 ` [PATCH v2 1/4] usb: musb: fix pm_runtime mismatches Felipe Contreras
       [not found] ` <1324325871-15137-1-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2011-12-19 20:17 ` Felipe Contreras
       [not found]   ` <1324325871-15137-4-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
  2011-12-19 20:17 ` [PATCH v2 4/4] musb: omap2430: avoid pm_runtime_disable() Felipe Contreras
  3 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2011-12-19 20:17 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-omap, Alan Stern, Felipe Balbi, Greg Kroah-Hartman,
	Jiri Kosina, Felipe Contreras

From: Felipe Contreras <felipe.contreras@gmail.com>

And use dev instead of musb->controller.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/usb/musb/omap2430.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 6f574ec..521d806 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -344,20 +344,19 @@ static void omap2430_musb_enable(struct musb *musb)
 
 	case USB_EVENT_ID:
 		otg_init(musb->xceiv);
-		if (data->interface_type == MUSB_INTERFACE_UTMI) {
-			devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-			/* start the session */
-			devctl |= MUSB_DEVCTL_SESSION;
-			musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
-			while (musb_readb(musb->mregs, MUSB_DEVCTL) &
-						MUSB_DEVCTL_BDEVICE) {
-				cpu_relax();
-
-				if (time_after(jiffies, timeout)) {
-					dev_err(musb->controller,
-					"configured as A device timeout");
-					break;
-				}
+		if (data->interface_type != MUSB_INTERFACE_UTMI)
+			break;
+		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+		/* start the session */
+		devctl |= MUSB_DEVCTL_SESSION;
+		musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+		while (musb_readb(musb->mregs, MUSB_DEVCTL) &
+				MUSB_DEVCTL_BDEVICE) {
+			cpu_relax();
+
+			if (time_after(jiffies, timeout)) {
+				dev_err(dev, "configured as A device timeout");
+				break;
 			}
 		}
 		break;
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/4] musb: omap2430: avoid pm_runtime_disable()
  2011-12-19 20:17 [PATCH v2 0/4] musb fixes and cleanups Felipe Contreras
                   ` (2 preceding siblings ...)
  2011-12-19 20:17 ` [PATCH v2 3/4] usb: musb: remove a bit of indentation Felipe Contreras
@ 2011-12-19 20:17 ` Felipe Contreras
  2011-12-20 11:57   ` Felipe Balbi
  3 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2011-12-19 20:17 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-omap, Alan Stern, Felipe Balbi, Greg Kroah-Hartman,
	Jiri Kosina, Felipe Contreras

From: Felipe Contreras <felipe.contreras@gmail.com>

These are handled by drivers core, and in a way that doesn't wake up the
devices.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/usb/musb/omap2430.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 521d806..66c1b8d 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -328,7 +328,6 @@ static int omap2430_musb_init(struct musb *musb)
 	return 0;
 
 err1:
-	pm_runtime_disable(dev);
 	return status;
 }
 
@@ -472,7 +471,6 @@ static int __exit omap2430_remove(struct platform_device *pdev)
 	platform_device_del(glue->musb);
 	platform_device_put(glue->musb);
 	pm_runtime_put(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
 	kfree(glue);
 
 	return 0;
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/4] usb: musb: trivial cleanup
       [not found]     ` <1324325871-15137-3-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2011-12-20 11:56       ` Felipe Balbi
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-12-20 11:56 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap, Alan Stern,
	Felipe Balbi, Greg Kroah-Hartman, Jiri Kosina, Felipe Contreras

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

On Mon, Dec 19, 2011 at 10:17:49PM +0200, Felipe Contreras wrote:
> From: Felipe Contreras <felipe.contreras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> enabled && driver || !enabled can be simplified to !enabled || driver.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

applied, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/4] usb: musb: remove a bit of indentation
       [not found]   ` <1324325871-15137-4-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2011-12-20 11:56     ` Felipe Balbi
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-12-20 11:56 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap, Alan Stern,
	Felipe Balbi, Greg Kroah-Hartman, Jiri Kosina, Felipe Contreras

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

On Mon, Dec 19, 2011 at 10:17:50PM +0200, Felipe Contreras wrote:
> From: Felipe Contreras <felipe.contreras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> And use dev instead of musb->controller.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

applied, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 4/4] musb: omap2430: avoid pm_runtime_disable()
  2011-12-19 20:17 ` [PATCH v2 4/4] musb: omap2430: avoid pm_runtime_disable() Felipe Contreras
@ 2011-12-20 11:57   ` Felipe Balbi
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2011-12-20 11:57 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: linux-usb, linux-omap, Alan Stern, Felipe Balbi,
	Greg Kroah-Hartman, Jiri Kosina, Felipe Contreras

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Hi,

On Mon, Dec 19, 2011 at 10:17:51PM +0200, Felipe Contreras wrote:
> From: Felipe Contreras <felipe.contreras@gmail.com>
> 
> These are handled by drivers core, and in a way that doesn't wake up the
> devices.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>

applied, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-20 11:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-19 20:17 [PATCH v2 0/4] musb fixes and cleanups Felipe Contreras
2011-12-19 20:17 ` [PATCH v2 1/4] usb: musb: fix pm_runtime mismatches Felipe Contreras
     [not found] ` <1324325871-15137-1-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2011-12-19 20:17   ` [PATCH v2 2/4] usb: musb: trivial cleanup Felipe Contreras
     [not found]     ` <1324325871-15137-3-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2011-12-20 11:56       ` Felipe Balbi
2011-12-19 20:17 ` [PATCH v2 3/4] usb: musb: remove a bit of indentation Felipe Contreras
     [not found]   ` <1324325871-15137-4-git-send-email-felipe.contreras-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2011-12-20 11:56     ` Felipe Balbi
2011-12-19 20:17 ` [PATCH v2 4/4] musb: omap2430: avoid pm_runtime_disable() Felipe Contreras
2011-12-20 11:57   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).