]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: phy: msm: Ensure that workers are initialized before use
authorIvan T. Ivanov <ivan.ivanov@linaro.org>
Wed, 13 May 2015 12:20:12 +0000 (15:20 +0300)
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Thu, 14 Jan 2016 10:51:08 +0000 (10:51 +0000)
Charger detect and USB state detect workers could be triggered from
USB-HOST and USB cable detect notifiers. Ensure that workers are
initialized before driver register its interest for cable events.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
drivers/usb/phy/phy-msm-usb.c

index 5ed83ec8f7673ca7e898e95253228ebc62360842..370648b18417ca53b4fb190df74f2a7ef57a2029 100644 (file)
@@ -1672,6 +1672,8 @@ static int msm_otg_probe(struct platform_device *pdev)
 
        phy = &motg->phy;
        phy->dev = &pdev->dev;
+       INIT_WORK(&motg->sm_work, msm_otg_sm_work);
+       INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work);
 
        motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk");
        if (IS_ERR(motg->clk)) {
@@ -1783,8 +1785,6 @@ static int msm_otg_probe(struct platform_device *pdev)
        writel(0, USB_USBINTR);
        writel(0, USB_OTGSC);
 
-       INIT_WORK(&motg->sm_work, msm_otg_sm_work);
-       INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work);
        ret = devm_request_irq(&pdev->dev, motg->irq, msm_otg_irq, IRQF_SHARED,
                                        "msm_otg", motg);
        if (ret) {