aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2008-11-24 15:01:17 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-07 13:00:02 -0500
commit68144e0cc92125f41157ede7b060f83367bc4fe7 (patch)
tree9f1f5f68fa2d23fb549f2419b8ffb5c5263b15c6
parent6084f1bf0c51a99cbba612ee90a4607cffb8b042 (diff)
USB: otg: add otg_put_transceiver()
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>
-rw-r--r--arch/arm/plat-omap/usb.c6
-rw-r--r--drivers/usb/gadget/omap_udc.c4
-rw-r--r--include/linux/usb/otg.h1
3 files changed, 9 insertions, 2 deletions
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 67ca1e216df7..2f88ca8b8f38 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -96,6 +96,12 @@ struct otg_transceiver *otg_get_transceiver(void)
96} 96}
97EXPORT_SYMBOL(otg_get_transceiver); 97EXPORT_SYMBOL(otg_get_transceiver);
98 98
99void otg_put_transceiver(struct otg_transceiver *x)
100{
101 put_device(x->dev);
102}
103EXPORT_SYMBOL(otg_put_transceiver);
104
99int otg_set_transceiver(struct otg_transceiver *x) 105int otg_set_transceiver(struct otg_transceiver *x)
100{ 106{
101 if (xceiv && x) 107 if (xceiv && x)
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 34e9e393f929..57d9641c6bf8 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -3006,7 +3006,7 @@ cleanup1:
3006 3006
3007cleanup0: 3007cleanup0:
3008 if (xceiv) 3008 if (xceiv)
3009 put_device(xceiv->dev); 3009 otg_put_transceiver(xceiv);
3010 3010
3011 if (cpu_is_omap16xx() || cpu_is_omap24xx()) { 3011 if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
3012 clk_disable(hhc_clk); 3012 clk_disable(hhc_clk);
@@ -3034,7 +3034,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
3034 3034
3035 pullup_disable(udc); 3035 pullup_disable(udc);
3036 if (udc->transceiver) { 3036 if (udc->transceiver) {
3037 put_device(udc->transceiver->dev); 3037 otg_put_transceiver(udc->transceiver);
3038 udc->transceiver = NULL; 3038 udc->transceiver = NULL;
3039 } 3039 }
3040 omap_writew(0, UDC_SYSCON1); 3040 omap_writew(0, UDC_SYSCON1);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1db25d152ad8..94df4fe6c6c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -84,6 +84,7 @@ extern int otg_set_transceiver(struct otg_transceiver *);
84 84
85/* for usb host and peripheral controller drivers */ 85/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 86extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *);
87 88
88static inline int 89static inline int
89otg_start_hnp(struct otg_transceiver *otg) 90otg_start_hnp(struct otg_transceiver *otg)