From: Philipp Zabel Date: Mon, 24 Nov 2008 20:01:17 +0000 (-0800) Subject: USB: otg: add otg_put_transceiver() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=68144e0cc92125f41157ede7b060f83367bc4fe7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- 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) } 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) 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: 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); 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 *); /* 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)