From patchwork Mon Aug 27 09:33:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10576781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7020A13B8 for ; Mon, 27 Aug 2018 09:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 625DA2847D for ; Mon, 27 Aug 2018 09:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56B5E297A9; Mon, 27 Aug 2018 09:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0961B2847D for ; Mon, 27 Aug 2018 09:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727510AbeH0NTl (ORCPT ); Mon, 27 Aug 2018 09:19:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38861 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727505AbeH0NTl (ORCPT ); Mon, 27 Aug 2018 09:19:41 -0400 Received: by mail-wm0-f66.google.com with SMTP id t25-v6so7609105wmi.3 for ; Mon, 27 Aug 2018 02:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kNnuvVHNDO72JJfSiBNDsx5kesLdzgcvxXm8Qay3N2o=; b=XeEUV6lf6MjQOt1Fb5KG8H5r9UoDYS/z86+YbL/omuzZwWSJ9SWhkxU3/HGj1A5Jfq inJoBXiIfKKhYO/ucxYwh7A7r7OIxVBg3msglBGh0Rgmcqf5CdXZFgv61bFZvUljZtVs FGEQcjiD7xo4VBPhoud3TTxFwfluVZVDz7v08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kNnuvVHNDO72JJfSiBNDsx5kesLdzgcvxXm8Qay3N2o=; b=qGFjtDS6+53NsyaWiur1p/iYAwNo988Doo+mdfQmnXocR7hTz6U7RV/KQxxnV/1ynl eHMtxtepKQakYc3VExdF+/cGMCHKLV4a+wJcEPCmvH7wnYGyptj06VEJMW4KHgBIfc78 kYV6OeGMEUYA83KlS+9tLRLasb97ebaC/en4/sqU8l7aNJgJv5g1sqeoNqgTt+pNE3Ip 0KkDE9uxQFa+PFL7qUc+sXP/TZxSRRvDMmYGuJAMbRRPiHndktW9h2tHrQpLTKBIyNPl dpg9+D9Fc1XyifICajYALLAhVR3Otxrs81M8EP0+ikVhMJR4QnezloZksQHZMjhYOU/H NIJw== X-Gm-Message-State: APzg51AqT7mzaRLQlIXvnI+4uFfHes78h77j7Nvl0uSdx92mZzEyWuIc rCrIfuR906ifQD1HHFzWWr9Jpg== X-Google-Smtp-Source: ANB0VdYYjgLAsdeQqgLHZ7r2TBWd/APLGiab4PpbrwGtRCzaNuL9p8inAIOE0VmjdorwuvQBV2usJA== X-Received: by 2002:a1c:d1c3:: with SMTP id i186-v6mr5183018wmg.5.1535362426017; Mon, 27 Aug 2018 02:33:46 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:45 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v2 6/7] phy: qcom-usb-hs: Fix unbalanced notifier registration Date: Mon, 27 Aug 2018 11:33:34 +0200 Message-Id: <1535362415-16559-6-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Phy power on/off cycle can happen several times during device life. We then need to balance the extcon notifier registration accordingly. Fixes: f0b5c2c96370 ("phy: qcom-usb-hs: Replace the extcon API") Signed-off-by: Loic Poulain --- v2: don't use devres version (power-on always followed by power-off) drivers/phy/qualcomm/phy-qcom-usb-hs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c index 2d0c70b..18da6e2 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c @@ -159,8 +159,8 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy) /* setup initial state */ qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state, uphy->vbus_edev); - ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev, - EXTCON_USB, &uphy->vbus_notify); + ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB, + &uphy->vbus_notify); if (ret) goto err_ulpi; } @@ -181,6 +181,11 @@ static int qcom_usb_hs_phy_power_off(struct phy *phy) { struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy); + if (uphy->vbus_edev) { + extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB, + &uphy->vbus_notify); + } + regulator_disable(uphy->v3p3); regulator_disable(uphy->v1p8); clk_disable_unprepare(uphy->sleep_clk);