aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/otg
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-03-31 15:28:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:40 -0400
commitcc835e321a9f3fa5e083436872e198095f4805b9 (patch)
tree84f317bf30099d3376e171a024bc89eb5bf7a589 /drivers/usb/otg
parentdef6f8b978618d50daaddb92331d398da9e141f1 (diff)
USB: nop-usb-xceiv: behave when linked as a module
The NOP OTG transceiver driver needs to be usable from modules. Make sure its symbols are always accessible at both compile and link time, and make sure the device instance is allocated from the heap so that device lifetime rules are obeyed. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/otg')
-rw-r--r--drivers/usb/otg/nop-usb-xceiv.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index c567168f89a..9ed5ea56867 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -22,8 +22,8 @@
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * 23 *
24 * Current status: 24 * Current status:
25 * this is to add "nop" transceiver for all those phy which is 25 * This provides a "nop" transceiver for PHYs which are
26 * autonomous such as isp1504 etc. 26 * autonomous such as isp1504, isp1707, etc.
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
@@ -36,30 +36,25 @@ struct nop_usb_xceiv {
36 struct device *dev; 36 struct device *dev;
37}; 37};
38 38
39static u64 nop_xceiv_dmamask = DMA_BIT_MASK(32); 39static struct platform_device *pd;
40
41static struct platform_device nop_xceiv_device = {
42 .name = "nop_usb_xceiv",
43 .id = -1,
44 .dev = {
45 .dma_mask = &nop_xceiv_dmamask,
46 .coherent_dma_mask = DMA_BIT_MASK(32),
47 .platform_data = NULL,
48 },
49};
50 40
51void usb_nop_xceiv_register(void) 41void usb_nop_xceiv_register(void)
52{ 42{
53 if (platform_device_register(&nop_xceiv_device) < 0) { 43 if (pd)
44 return;
45 pd = platform_device_register_simple("nop_usb_xceiv", -1, NULL, 0);
46 if (!pd) {
54 printk(KERN_ERR "Unable to register usb nop transceiver\n"); 47 printk(KERN_ERR "Unable to register usb nop transceiver\n");
55 return; 48 return;
56 } 49 }
57} 50}
51EXPORT_SYMBOL(usb_nop_xceiv_register);
58 52
59void usb_nop_xceiv_unregister(void) 53void usb_nop_xceiv_unregister(void)
60{ 54{
61 platform_device_unregister(&nop_xceiv_device); 55 platform_device_unregister(pd);
62} 56}
57EXPORT_SYMBOL(usb_nop_xceiv_unregister);
63 58
64static inline struct nop_usb_xceiv *xceiv_to_nop(struct otg_transceiver *x) 59static inline struct nop_usb_xceiv *xceiv_to_nop(struct otg_transceiver *x)
65{ 60{