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: 145167 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3975677ljw; Mon, 27 Aug 2018 02:33:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYhjXb8tvsfdKOg0Lupe/+x/X5bjlVzTKDsqRgK/Q8jJ+c99USqbzW+Aw8jT3G6Y4AGJfoK X-Received: by 2002:a65:4384:: with SMTP id m4-v6mr11455002pgp.265.1535362430212; Mon, 27 Aug 2018 02:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535362430; cv=none; d=google.com; s=arc-20160816; b=oVIzMY9W9kCY/PT1hC9ebYcOTpN3SuZ+JABhXSFPg84a90cBKOt099dM1FTmZCFJpn MA6+wxJYKQpvOwHJUKDKBbMSLIlv9A7rZcNjYxyizxDF/pvtPXhaOa7AGHq7Dy5afYey aBj8cJPUtgyG2abYzttarmI5iCg7fD+7Mmt+CkfV94kbL+Xs59cT0AcsCNknZJi6eySA 1YiVeA0EPIXnvwM+mlmqMYF+czcs7RG7SQXtQwSR6Qndcgp0vie0y4IoxER1dqNKms9F r4nGO8D5IBbUIK2e5GDpVBQwme6SkmMFSrihbXgs0h3S7sA40A9KMPfz2JqyGxaLrIug 0FWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=kNnuvVHNDO72JJfSiBNDsx5kesLdzgcvxXm8Qay3N2o=; b=io06x0Ak6kyWgM1DPpw3atyiVEPytE6Bl2n4KbK7t67+a1yKxEer8jshJJ7fNJ+dFO 0kHLRVetNdt4JBOmzIqzaBS5WMl7/gbU8cBYwUu//Q0JYiSJ1QypLMeb8goPSegkNF4b 5GOIqpfzHVYUCHpZBGo8Udt7Tuw9NZHPNtnKaJDJjogVYeUOjVO/BoyuG6fCFmOT6Ncg GtVo8U6hLGhVKE6nZZEo0ypYlshhz9PgpmUvK3YJXO3++Dyz5cpmKJUISFAikfRBJhFW yjlluDZMwHDIWySK0vvNG3QbzY5H0hyLadyTf9NOYEdJYWMI81tMpyGjZxpq7sZA3Xa+ OTtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XeEUV6lf; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35-v6si13216871pla.453.2018.08.27.02.33.50; Mon, 27 Aug 2018 02:33:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XeEUV6lf; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727510AbeH0NTl (ORCPT + 5 others); 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-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 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(-) -- 2.7.4 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);