USB: otg: add otg_put_transceiver()
authorPhilipp Zabel <philipp.zabel@gmail.com>
Mon, 24 Nov 2008 20:01:17 +0000 (12:01 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Jan 2009 18:00:02 +0000 (10:00 -0800)
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
drivers/usb/gadget/omap_udc.c
include/linux/usb/otg.h

index 67ca1e216df7a1e4cfdc5ef29bf520bc16ec760c..2f88ca8b8f38a2f8ed186bacf64dbf9ed8e561f4 100644 (file)
@@ -96,6 +96,12 @@ struct otg_transceiver *otg_get_transceiver(void)
 }
 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)
index 34e9e393f929b5b35b7710d5065ab30fbe25595e..57d9641c6bf8c7bf4ed968a714ed8bd168e3289e 100644 (file)
@@ -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 platform_device *pdev)
 
        pullup_disable(udc);
        if (udc->transceiver) {
-               put_device(udc->transceiver->dev);
+               otg_put_transceiver(udc->transceiver);
                udc->transceiver = NULL;
        }
        omap_writew(0, UDC_SYSCON1);
index 1db25d152ad86a351483f680251af8081de6fc0d..94df4fe6c6c0feb1b6a559a8719a8b7195a5d551 100644 (file)
@@ -84,6 +84,7 @@ extern int otg_set_transceiver(struct otg_transceiver *);
 
 /* 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)