From patchwork Tue Sep 4 15:18:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10587511 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 46B8514BD for ; Tue, 4 Sep 2018 15:19:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AC7629BA3 for ; Tue, 4 Sep 2018 15:19:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F6D029C6F; Tue, 4 Sep 2018 15:19:15 +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=unavailable 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 151BF29BAD for ; Tue, 4 Sep 2018 15:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbeIDTop (ORCPT ); Tue, 4 Sep 2018 15:44:45 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36583 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727629AbeIDToo (ORCPT ); Tue, 4 Sep 2018 15:44:44 -0400 Received: by mail-wm0-f65.google.com with SMTP id j192-v6so4713515wmj.1 for ; Tue, 04 Sep 2018 08:19:10 -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=JUgb9vugJT+6B6QjtpmWBvMX+Wq5UlUI1pzbqQTz2N0=; b=PycRToe0oOvXjpgTCn7Ysl2ixJnrbemOp0tYouNO48u176Tn+sTEERxCOPgOcpvrK3 Khr0qj2AP9ZIJjI9K6PezWog8YLCSg7PG+d5i83AEwl3I13lGmvrWKTWYqe9TEdjBPtP y2FSme9twOy5JvrsclQGPg79UrblxbMYtAKOM= 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=JUgb9vugJT+6B6QjtpmWBvMX+Wq5UlUI1pzbqQTz2N0=; b=uCkLJzpOu8MBSzH1RuWen1r8SPhi0zHZnC8YxE2Kvce0NMee8NOBS/uohgfPs1t9ER yeUOIWbrmkqansLVwbLkL35rhCcxcxYHL2k33r+2/sJ0h7OT7x+qNKsLohgw+j06JQ/I CNj3TNc6bEVkd1hbiH7+P39Be6QIkivHMgOr3sNym1yksh5LNZEJMRmIJPvPmRALjBzI BCIZU1wn/X/3wa/Xmg5PBg+vpDg4FFiQ36crk8D9wlzjIJfP5m9LtS2KRaKcbjp2+UdF +blg/2ThAekB2olfQiH6FQq7Qvv7yFl5Czt5Tv2ODOYLFHfvmyrLARS6gt9N4Huq9Qqr U8Iw== X-Gm-Message-State: APzg51BzYeG8EIHE3FVV5RwjnqV5AoajwYbdzOIeV1hwG32M32iQi0Zw DFrPEPZbnKw+BYVFI9vbeyDipfUKT80= X-Google-Smtp-Source: ANB0VdYnfc4iZOTpqyi7FhScWptCSUW68ggB7PRjxLLSOz28/ZXYj4ughNMqSz5AJZgTVyoTcOfRdg== X-Received: by 2002:a1c:a386:: with SMTP id m128-v6mr2626711wme.139.1536074349982; Tue, 04 Sep 2018 08:19:09 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:09 -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 v3 5/6] phy: qcom-usb-hs: Fix unbalanced notifier registration Date: Tue, 4 Sep 2018 17:18:59 +0200 Message-Id: <1536074340-14840-5-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-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) v3: no change 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 abbbe75..7153dde 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c @@ -160,8 +160,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; } @@ -182,6 +182,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);