From patchwork Mon Sep 7 08:07:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T. Ivanov" X-Patchwork-Id: 53214 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 747A522B06 for ; Mon, 7 Sep 2015 08:07:24 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf23206423lbb.2 for ; Mon, 07 Sep 2015 01:07:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=ouVNRTZ/nJx4vaUjSJU2zNV8rAxSpmP3sYfPF5IokUg=; b=eIgKwar15aBzniGtBj2nzcxlLJb7P0USwemFbyf/wzWvbLh89OuI8Wt66NsdsiQZch l6gZQEcZn8AOwpDYfZq0pxK+WssUE1PsZUBeyNECugJhh7uF8wlyS3MGvKcrqo8+R/pI /TYkZtb7zs59XSwDuX8LS0PMewNy0lJH7Y+T4r+XQNhZZAsIwLoiDtFgc2ov1ZlGmFyC 0721Y4MWt9+ZK2+qvVAklmDjQh92YXs49FVbRecVX6CjqxYsiJSbXCaUGTDs9JJKSpu2 pjUteTtDPIUd/uckj0fINWgms+mrJioqulFiNQmV6Ql+b8wmnf5KB2T99oK04tvz/IcD Syrg== X-Gm-Message-State: ALoCoQkA+L8MbFH5414Nk+zE3UWc0JYeLNxy4e9un9IlCPV7g6YRUJ3d8kjIaEs1y35At+YSOzbr X-Received: by 10.112.158.202 with SMTP id ww10mr2015583lbb.13.1441613243405; Mon, 07 Sep 2015 01:07:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.66 with SMTP id a2ls500791laa.4.gmail; Mon, 07 Sep 2015 01:07:23 -0700 (PDT) X-Received: by 10.112.87.69 with SMTP id v5mr16382666lbz.12.1441613243222; Mon, 07 Sep 2015 01:07:23 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id wq7si9764856lbc.105.2015.09.07.01.07.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 01:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbmp1 with SMTP id mp1so35313444lbb.1 for ; Mon, 07 Sep 2015 01:07:23 -0700 (PDT) X-Received: by 10.152.198.140 with SMTP id jc12mr15816047lac.19.1441613243054; Mon, 07 Sep 2015 01:07:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp219549lbq; Mon, 7 Sep 2015 01:07:22 -0700 (PDT) X-Received: by 10.66.63.69 with SMTP id e5mr43621651pas.156.1441613241916; Mon, 07 Sep 2015 01:07:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o2si18783549pdn.73.2015.09.07.01.07.21; Mon, 07 Sep 2015 01:07:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbbIGIHU (ORCPT + 6 others); Mon, 7 Sep 2015 04:07:20 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38432 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbbIGIHS (ORCPT ); Mon, 7 Sep 2015 04:07:18 -0400 Received: by wiclk2 with SMTP id lk2so74744438wic.1 for ; Mon, 07 Sep 2015 01:07:16 -0700 (PDT) X-Received: by 10.180.77.68 with SMTP id q4mr30906863wiw.22.1441613236684; Mon, 07 Sep 2015 01:07:16 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id yu4sm18617565wjc.43.2015.09.07.01.07.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Sep 2015 01:07:16 -0700 (PDT) From: "Ivan T. Ivanov" To: Felipe Balbi , Tim Bird Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2] usb: phy: msm: Unregister VBUS and ID events notifiers Date: Mon, 7 Sep 2015 11:07:09 +0300 Message-Id: <1441613229-13867-1-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.ivanov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Right now even if driver failed to probe extcon framework will still deliver its VBUS and ID events, which will lead to random exception codes. Fix this by removing VBUS and ID events notifiers when probe fail. Fixes: 591fc116f330 ("usb: phy: msm: Use extcon framework for VBUS and ID detection") Reported-by: Tim Bird Signed-off-by: Ivan T. Ivanov --- Patch reworked to use new extcon API. drivers/usb/phy/phy-msm-usb.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index c58c3c0dbe35..0fd21c147c7e 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1598,6 +1598,8 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST, &motg->id.nb); if (ret < 0) { + extcon_unregister_notifier(motg->vbus.extcon, + EXTCON_USB, &motg->vbus.nb); dev_err(&pdev->dev, "register ID notifier failed\n"); return ret; } @@ -1660,15 +1662,6 @@ static int msm_otg_probe(struct platform_device *pdev) if (!motg) return -ENOMEM; - pdata = dev_get_platdata(&pdev->dev); - if (!pdata) { - if (!np) - return -ENXIO; - ret = msm_otg_read_dt(pdev, motg); - if (ret) - return ret; - } - motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), GFP_KERNEL); if (!motg->phy.otg) @@ -1731,6 +1724,15 @@ static int msm_otg_probe(struct platform_device *pdev) return motg->irq; } + pdata = dev_get_platdata(&pdev->dev); + if (!pdata) { + if (!np) + return -ENXIO; + ret = msm_otg_read_dt(pdev, motg); + if (ret) + return ret; + } + regs[0].supply = "vddcx"; regs[1].supply = "v3p3"; regs[2].supply = "v1p8"; @@ -1834,6 +1836,11 @@ disable_clks: clk_disable_unprepare(motg->clk); if (!IS_ERR(motg->core_clk)) clk_disable_unprepare(motg->core_clk); + + extcon_unregister_notifier(motg->id.extcon, + EXTCON_USB_HOST, &motg->id.nb); + extcon_unregister_notifier(motg->vbus.extcon, + EXTCON_USB, &motg->vbus.nb); return ret; }