lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 19 Jan 2008 16:37:23 +0200 From: Felipe Balbi <me@...ipebalbi.com> To: linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org Cc: david-b@...bell.net, tony@...mide.com, Felipe Balbi <me@...ipebalbi.com> Subject: [PATCH 2/4] USB: OTG: Make otg_get_transceiver() and otg_set_transceiver() generic From: Tony Lidgren <tony@...mide.com> Move otg_get_transceiver() and otg_set_transceiver() from omap specific code to common otg.c so other upcoming drivers can share them. Signed-off-by: Tony Lindgren <tony@...mide.com> Signed-off-by: Felipe Balbi <me@...ipebalbi.com> --- arch/arm/plat-omap/usb.c | 32 -------------------------------- drivers/usb/core/otg.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c index 11967c0..531afa6 100644 --- a/drivers/usb/core/otg.c +++ b/drivers/usb/core/otg.c @@ -14,9 +14,29 @@ #include <linux/byteorder/generic.h> #include <linux/gfp.h> #include <linux/usb.h> +#include <linux/usb/otg.h> #include "otg_whitelist.h" +static struct otg_transceiver *xceiv; + +int otg_set_transceiver(struct otg_transceiver *x) +{ + if (xceiv && x) + return -EBUSY; + xceiv = x; + return 0; +} +EXPORT_SYMBOL(otg_set_transceiver); + +struct otg_transceiver *otg_get_transceiver(void) +{ + if (xceiv) + get_device(xceiv->dev); + return xceiv; +} +EXPORT_SYMBOL(otg_get_transceiver); + #ifdef CONFIG_USB_OTG_WHITELIST /* diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c index a5aedf9..5cd39fa 100644 --- a/arch/arm/plat-omap/usb.c +++ b/arch/arm/plat-omap/usb.c @@ -76,38 +76,6 @@ /*-------------------------------------------------------------------------*/ -#ifdef CONFIG_ARCH_OMAP_OTG - -static struct otg_transceiver *xceiv; - -/** - * otg_get_transceiver - find the (single) OTG transceiver driver - * - * Returns the transceiver driver, after getting a refcount to it; or - * null if there is no such transceiver. The caller is responsible for - * releasing that count. - */ -struct otg_transceiver *otg_get_transceiver(void) -{ - if (xceiv) - get_device(xceiv->dev); - return xceiv; -} -EXPORT_SYMBOL(otg_get_transceiver); - -int otg_set_transceiver(struct otg_transceiver *x) -{ - if (xceiv && x) - return -EBUSY; - xceiv = x; - return 0; -} -EXPORT_SYMBOL(otg_set_transceiver); - -#endif - -/*-------------------------------------------------------------------------*/ - #if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP15XX) static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device) -- 1.5.4.rc3.24.gb53139 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists