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: 10587509 X-Patchwork-Delegate: agross@codeaurora.org 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 92EFF1669 for ; Tue, 4 Sep 2018 15:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82CB629C6A for ; Tue, 4 Sep 2018 15:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76CB629C88; Tue, 4 Sep 2018 15:19:14 +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 61B3229C6A for ; Tue, 4 Sep 2018 15:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727388AbeIDToo (ORCPT ); Tue, 4 Sep 2018 15:44:44 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37564 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727627AbeIDToo (ORCPT ); Tue, 4 Sep 2018 15:44:44 -0400 Received: by mail-wm0-f68.google.com with SMTP id n11-v6so4667237wmc.2 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=jtv2DrLsJQvZigraGep6lZtIEwYe6n7HOB13xA1b1z2DaALFXxp8SSBfLVXdfDIECf GA2JcgvxP7CwmNSdOiAYq07dfrapY7THHZXmGeWj9D/VKCE6x5hzQSfW01oxIJco+8Nk ia3EqN7cwQoJnbIkood/1PxQX8F1NYW1+XrSu3vujwcR6N9bK8S149dryakoF5F4karS q+mohm5ByF/GhD8MjdLnRXzbBLjojMO7SaWmz8S9s9ETncWabd71T0LfqwzCNwgXGGW9 zmol+CRDbdKV2EkQ91PmLBOP1/diW033nq0Ac07qwCpfOUNjeva1MV7zvXE8tMGz/QYw Ps9Q== X-Gm-Message-State: APzg51DbyZWa+sQqeMUnOD6cpp4R9W9zEGOaBntfxq6muq8ZUh2xiTzN F5o6BzatnpSNZG/0edM6fYA8Fw== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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);