diff options
author | Felipe Balbi <balbi@ti.com> | 2014-10-07 11:19:23 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-11-03 11:00:58 -0500 |
commit | 0b0231aa246cbfdcf0a07f5e8914c0f1b80002f6 (patch) | |
tree | 3ee19d2b8df96e589d092c98ec3e8cf4d1c73251 /drivers/usb/dwc3/core.c | |
parent | 7ee2566ff53e0620a80548689c74505fe8f10ec8 (diff) |
usb: dwc3: get rid of ->prepare()/->complete()
Using ->prepare()/->complete() to mask/unmask
IRQs is wrong at least for dwc3. We need to
make sure that by the end of ->resume(), IRQs
are working and ready to fire because a child
device may need working IRQs for its own ->resume()
method.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r-- | drivers/usb/dwc3/core.c | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 4d4e854f99aa..fa396fc57a85 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -825,50 +825,6 @@ static int dwc3_remove(struct platform_device *pdev) | |||
825 | } | 825 | } |
826 | 826 | ||
827 | #ifdef CONFIG_PM_SLEEP | 827 | #ifdef CONFIG_PM_SLEEP |
828 | static int dwc3_prepare(struct device *dev) | ||
829 | { | ||
830 | struct dwc3 *dwc = dev_get_drvdata(dev); | ||
831 | unsigned long flags; | ||
832 | |||
833 | spin_lock_irqsave(&dwc->lock, flags); | ||
834 | |||
835 | switch (dwc->dr_mode) { | ||
836 | case USB_DR_MODE_PERIPHERAL: | ||
837 | case USB_DR_MODE_OTG: | ||
838 | dwc3_gadget_prepare(dwc); | ||
839 | /* FALLTHROUGH */ | ||
840 | case USB_DR_MODE_HOST: | ||
841 | default: | ||
842 | dwc3_event_buffers_cleanup(dwc); | ||
843 | break; | ||
844 | } | ||
845 | |||
846 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
847 | |||
848 | return 0; | ||
849 | } | ||
850 | |||
851 | static void dwc3_complete(struct device *dev) | ||
852 | { | ||
853 | struct dwc3 *dwc = dev_get_drvdata(dev); | ||
854 | unsigned long flags; | ||
855 | |||
856 | spin_lock_irqsave(&dwc->lock, flags); | ||
857 | |||
858 | dwc3_event_buffers_setup(dwc); | ||
859 | switch (dwc->dr_mode) { | ||
860 | case USB_DR_MODE_PERIPHERAL: | ||
861 | case USB_DR_MODE_OTG: | ||
862 | dwc3_gadget_complete(dwc); | ||
863 | /* FALLTHROUGH */ | ||
864 | case USB_DR_MODE_HOST: | ||
865 | default: | ||
866 | break; | ||
867 | } | ||
868 | |||
869 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
870 | } | ||
871 | |||
872 | static int dwc3_suspend(struct device *dev) | 828 | static int dwc3_suspend(struct device *dev) |
873 | { | 829 | { |
874 | struct dwc3 *dwc = dev_get_drvdata(dev); | 830 | struct dwc3 *dwc = dev_get_drvdata(dev); |
@@ -883,7 +839,7 @@ static int dwc3_suspend(struct device *dev) | |||
883 | /* FALLTHROUGH */ | 839 | /* FALLTHROUGH */ |
884 | case USB_DR_MODE_HOST: | 840 | case USB_DR_MODE_HOST: |
885 | default: | 841 | default: |
886 | /* do nothing */ | 842 | dwc3_event_buffers_cleanup(dwc); |
887 | break; | 843 | break; |
888 | } | 844 | } |
889 | 845 | ||
@@ -916,6 +872,7 @@ static int dwc3_resume(struct device *dev) | |||
916 | 872 | ||
917 | spin_lock_irqsave(&dwc->lock, flags); | 873 | spin_lock_irqsave(&dwc->lock, flags); |
918 | 874 | ||
875 | dwc3_event_buffers_setup(dwc); | ||
919 | dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl); | 876 | dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl); |
920 | 877 | ||
921 | switch (dwc->dr_mode) { | 878 | switch (dwc->dr_mode) { |
@@ -944,9 +901,6 @@ err_usb2phy_init: | |||
944 | } | 901 | } |
945 | 902 | ||
946 | static const struct dev_pm_ops dwc3_dev_pm_ops = { | 903 | static const struct dev_pm_ops dwc3_dev_pm_ops = { |
947 | .prepare = dwc3_prepare, | ||
948 | .complete = dwc3_complete, | ||
949 | |||
950 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) | 904 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) |
951 | }; | 905 | }; |
952 | 906 | ||