public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.28-rc6-omap-git 3/5] add missing otg_put_transceiver() call
@ 2008-12-01 21:17 David Brownell
  0 siblings, 0 replies; only message in thread
From: David Brownell @ 2008-12-01 21:17 UTC (permalink / raw)
  To: linux-omap

From: Philipp Zabel <philipp.zabel@gmail.com>

As Russell King points out, calling put_device(otg_transceiver->dev)
directly in driver cleanup paths makes assumptions about otg_transceiver
internals.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 arch/arm/plat-omap/usb.c      |    6 ++++++
 drivers/usb/gadget/omap_udc.c |    4 ++--
 include/linux/usb/otg.h       |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -96,6 +96,12 @@ struct otg_transceiver *otg_get_transcei
 }
 EXPORT_SYMBOL(otg_get_transceiver);
 
+void otg_put_transceiver(struct otg_transceiver *x)
+{
+	put_device(x->dev);
+}
+EXPORT_SYMBOL(otg_put_transceiver);
+
 int otg_set_transceiver(struct otg_transceiver *x)
 {
 	if (xceiv && x)
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -3006,7 +3006,7 @@ cleanup1:
 
 cleanup0:
 	if (xceiv)
-		put_device(xceiv->dev);
+		otg_put_transceiver(xceiv);
 
 	if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
 		clk_disable(hhc_clk);
@@ -3034,7 +3034,7 @@ static int __exit omap_udc_remove(struct
 
 	pullup_disable(udc);
 	if (udc->transceiver) {
-		put_device(udc->transceiver->dev);
+		otg_put_transceiver(udc->transceiver);
 		udc->transceiver = NULL;
 	}
 	omap_writew(0, UDC_SYSCON1);
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -84,6 +84,7 @@ extern int otg_set_transceiver(struct ot
 
 /* for usb host and peripheral controller drivers */
 extern struct otg_transceiver *otg_get_transceiver(void);
+extern void otg_put_transceiver(struct otg_transceiver *);
 
 static inline int
 otg_start_hnp(struct otg_transceiver *otg)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-01 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 21:17 [patch 2.6.28-rc6-omap-git 3/5] add missing otg_put_transceiver() call David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox