diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-04-18 23:52:50 +0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-04-18 23:52:50 +0400 |
commit | 681e4a5e13c1c8315694eb4f44e0cdd84c9082d2 (patch) | |
tree | 699f14527c118859026e8ce0214e689d0b9c88cb /drivers/usb/otg/nop-usb-xceiv.c | |
parent | b960d6c43a63ebd2d8518b328da3816b833ee8cc (diff) | |
parent | c104f1fa1ecf4ee0fc06e31b1f77630b2551be81 (diff) | |
download | linux-681e4a5e13c1c8315694eb4f44e0cdd84c9082d2.tar.xz |
Merge commit 'c104f1fa1ecf4ee0fc06e31b1f77630b2551be81' into stable/for-linus-3.4
* commit 'c104f1fa1ecf4ee0fc06e31b1f77630b2551be81': (14566 commits)
cpufreq: OMAP: fix build errors: depends on ARCH_OMAP2PLUS
sparc64: Eliminate obsolete __handle_softirq() function
sparc64: Fix bootup crash on sun4v.
kconfig: delete last traces of __enabled_ from autoconf.h
Revert "kconfig: fix __enabled_ macros definition for invisible and un-selected symbols"
kconfig: fix IS_ENABLED to not require all options to be defined
irq_domain: fix type mismatch in debugfs output format
staging: android: fix mem leaks in __persistent_ram_init()
staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl()
staging: iio: hmc5843: Fix crash in probe function.
panic: fix stack dump print on direct call to panic()
drivers/rtc/rtc-pl031.c: enable clock on all ST variants
Revert "mm: vmscan: fix misused nr_reclaimed in shrink_mem_cgroup_zone()"
hugetlb: fix race condition in hugetlb_fault()
drivers/rtc/rtc-twl.c: use static register while reading time
drivers/rtc/rtc-s3c.c: add placeholder for driver private data
drivers/rtc/rtc-s3c.c: fix compilation error
MAINTAINERS: add PCDP console maintainer
memcg: do not open code accesses to res_counter members
drivers/rtc/rtc-efi.c: fix section mismatch warning
...
Diffstat (limited to 'drivers/usb/otg/nop-usb-xceiv.c')
-rw-r--r-- | drivers/usb/otg/nop-usb-xceiv.c | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index c1e360046435..58b26df6afd1 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c @@ -33,7 +33,7 @@ #include <linux/slab.h> struct nop_usb_xceiv { - struct otg_transceiver otg; + struct usb_phy phy; struct device *dev; }; @@ -58,51 +58,37 @@ void usb_nop_xceiv_unregister(void) } EXPORT_SYMBOL(usb_nop_xceiv_unregister); -static inline struct nop_usb_xceiv *xceiv_to_nop(struct otg_transceiver *x) -{ - return container_of(x, struct nop_usb_xceiv, otg); -} - -static int nop_set_suspend(struct otg_transceiver *x, int suspend) +static int nop_set_suspend(struct usb_phy *x, int suspend) { return 0; } -static int nop_set_peripheral(struct otg_transceiver *x, - struct usb_gadget *gadget) +static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) { - struct nop_usb_xceiv *nop; - - if (!x) + if (!otg) return -ENODEV; - nop = xceiv_to_nop(x); - if (!gadget) { - nop->otg.gadget = NULL; + otg->gadget = NULL; return -ENODEV; } - nop->otg.gadget = gadget; - nop->otg.state = OTG_STATE_B_IDLE; + otg->gadget = gadget; + otg->phy->state = OTG_STATE_B_IDLE; return 0; } -static int nop_set_host(struct otg_transceiver *x, struct usb_bus *host) +static int nop_set_host(struct usb_otg *otg, struct usb_bus *host) { - struct nop_usb_xceiv *nop; - - if (!x) + if (!otg) return -ENODEV; - nop = xceiv_to_nop(x); - if (!host) { - nop->otg.host = NULL; + otg->host = NULL; return -ENODEV; } - nop->otg.host = host; + otg->host = host; return 0; } @@ -115,15 +101,23 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) if (!nop) return -ENOMEM; + nop->phy.otg = kzalloc(sizeof *nop->phy.otg, GFP_KERNEL); + if (!nop->phy.otg) { + kfree(nop); + return -ENOMEM; + } + nop->dev = &pdev->dev; - nop->otg.dev = nop->dev; - nop->otg.label = "nop-xceiv"; - nop->otg.state = OTG_STATE_UNDEFINED; - nop->otg.set_host = nop_set_host; - nop->otg.set_peripheral = nop_set_peripheral; - nop->otg.set_suspend = nop_set_suspend; - - err = otg_set_transceiver(&nop->otg); + nop->phy.dev = nop->dev; + nop->phy.label = "nop-xceiv"; + nop->phy.set_suspend = nop_set_suspend; + nop->phy.state = OTG_STATE_UNDEFINED; + + nop->phy.otg->phy = &nop->phy; + nop->phy.otg->set_host = nop_set_host; + nop->phy.otg->set_peripheral = nop_set_peripheral; + + err = usb_set_transceiver(&nop->phy); if (err) { dev_err(&pdev->dev, "can't register transceiver, err: %d\n", err); @@ -132,10 +126,11 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, nop); - ATOMIC_INIT_NOTIFIER_HEAD(&nop->otg.notifier); + ATOMIC_INIT_NOTIFIER_HEAD(&nop->phy.notifier); return 0; exit: + kfree(nop->phy.otg); kfree(nop); return err; } @@ -144,9 +139,10 @@ static int __devexit nop_usb_xceiv_remove(struct platform_device *pdev) { struct nop_usb_xceiv *nop = platform_get_drvdata(pdev); - otg_set_transceiver(NULL); + usb_set_transceiver(NULL); platform_set_drvdata(pdev, NULL); + kfree(nop->phy.otg); kfree(nop); return 0; |