From 3eab96eff74e35f831768403315a25373a7f8e5c Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Mon, 1 Feb 2016 23:40:27 -0800 Subject: [PATCH] usb: dwc3-msm: Compilation fixups for 4.4 This patch includes a couple of fixups to compile against recent kernels: - replace CONFIG_PM_RUNTIME with CONFIG_PM - replace of_usb_get_dr_mode() with usb_get_dr_mode(). As a result it needs to be called after of_find_device_by_node() Signed-off-by: Jack Pham --- drivers/usb/dwc3/dwc3-msm.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 425745d9e764..9a2b32820e48 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -2585,7 +2585,6 @@ static int dwc3_msm_probe(struct platform_device *pdev) struct dwc3 *dwc; struct resource *res; void __iomem *tcsr; - unsigned long flags; bool host_mode; int ret = 0; int ext_hub_reset_gpio; @@ -2831,7 +2830,7 @@ static int dwc3_msm_probe(struct platform_device *pdev) dwc3_set_notifier(&dwc3_msm_notify_event); - /* Assumes dwc3 is the only DT child of dwc3-msm */ + /* Assumes dwc3 is the first DT child of dwc3-msm */ dwc3_node = of_get_next_available_child(node, NULL); if (!dwc3_node) { dev_err(&pdev->dev, "failed to find dwc3 child\n"); @@ -2839,7 +2838,22 @@ static int dwc3_msm_probe(struct platform_device *pdev) goto err; } - host_mode = of_usb_get_dr_mode(dwc3_node) == USB_DR_MODE_HOST; + ret = of_platform_populate(node, NULL, NULL, &pdev->dev); + if (ret) { + dev_err(&pdev->dev, + "failed to add create dwc3 core\n"); + of_node_put(dwc3_node); + goto err; + } + + mdwc->dwc3 = of_find_device_by_node(dwc3_node); + of_node_put(dwc3_node); + if (!mdwc->dwc3) { + dev_err(&pdev->dev, "failed to get dwc3 platform device\n"); + goto put_dwc3; + } + + host_mode = usb_get_dr_mode(&mdwc->dwc3->dev) == USB_DR_MODE_HOST; /* usb_psy required only for vbus_notifications */ if (!host_mode) { mdwc->usb_psy.name = "usb"; @@ -2864,21 +2878,6 @@ static int dwc3_msm_probe(struct platform_device *pdev) } } - ret = of_platform_populate(node, NULL, NULL, &pdev->dev); - if (ret) { - dev_err(&pdev->dev, - "failed to add create dwc3 core\n"); - of_node_put(dwc3_node); - goto put_psupply; - } - - mdwc->dwc3 = of_find_device_by_node(dwc3_node); - of_node_put(dwc3_node); - if (!mdwc->dwc3) { - dev_err(&pdev->dev, "failed to get dwc3 platform device\n"); - goto put_dwc3; - } - mdwc->hs_phy = devm_usb_get_phy_by_phandle(&mdwc->dwc3->dev, "usb-phy", 0); if (IS_ERR(mdwc->hs_phy)) { @@ -3658,7 +3657,7 @@ static int dwc3_msm_pm_resume(struct device *dev) } #endif -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM static int dwc3_msm_runtime_idle(struct device *dev) { dev_dbg(dev, "DWC3-msm runtime idle\n");