From patchwork Mon Jul 7 06:48:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 33125 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E53B220C88 for ; Mon, 7 Jul 2014 06:49:30 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id oy12sf16365374veb.6 for ; Sun, 06 Jul 2014 23:49:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=JGMFUHHEsNQ5iNgcT7PmKhcEj3ubQUOxyQsE6S17qsA=; b=GTWIYdQuUc07CMK34oD19uJAm1hltfpaYJ9he13awBYZg+lcDMqKjUghioTPQdrFvx RCMr1+5FewzMvrhwpkqHpSz+AjcVBp+r3qGKF4RQt2y3iDbSpks9M+Y3qUVheB+tPqQo M68haqt4+ANIUXSm7D6n4IRzeRKON7Eds4ROjXSqjGcT6HOaS9v1gH3YoDNYus/4y4Cs EIvXOdj8vHCOXgz/elsJndieR9N3jP6/XTgO1ACp0qMYqgbVUeKQkSh9kYBLXtMyXO/s AG7M4owdE4n3a8UrhrZExHVH8mOjVcggo7MPvqU1o91dnOmVfjLcayk0GDsy+KAyDcj3 jf8w== X-Gm-Message-State: ALoCoQngWdaCnC/3aX+73xMJ66va+8GzG+epiF6cbEQzs+9GxCtPkf1qA8hD+G+I8iFDdBGIvC87 X-Received: by 10.236.35.5 with SMTP id t5mr12876399yha.9.1404715770639; Sun, 06 Jul 2014 23:49:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.229 with SMTP id p92ls1595323qgp.92.gmail; Sun, 06 Jul 2014 23:49:30 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr26143842vcb.0.1404715770580; Sun, 06 Jul 2014 23:49:30 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id qi1si18447105veb.60.2014.07.06.23.49.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 06 Jul 2014 23:49:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so3471601vcb.21 for ; Sun, 06 Jul 2014 23:49:30 -0700 (PDT) X-Received: by 10.220.163.3 with SMTP id y3mr26010448vcx.7.1404715770511; Sun, 06 Jul 2014 23:49:30 -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.221.37.5 with SMTP id tc5csp643764vcb; Sun, 6 Jul 2014 23:49:30 -0700 (PDT) X-Received: by 10.68.69.11 with SMTP id a11mr1434344pbu.129.1404715769641; Sun, 06 Jul 2014 23:49:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nt4si40413000pbc.39.2014.07.06.23.49.28; Sun, 06 Jul 2014 23:49:29 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013AbaGGGtX (ORCPT + 27 others); Mon, 7 Jul 2014 02:49:23 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:55978 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbaGGGsz (ORCPT ); Mon, 7 Jul 2014 02:48:55 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s676ms09031785; Mon, 7 Jul 2014 01:48:54 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s676msf2008156; Mon, 7 Jul 2014 01:48:54 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Mon, 7 Jul 2014 01:48:54 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s676meME028360; Mon, 7 Jul 2014 01:48:53 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 8/8] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove Date: Mon, 7 Jul 2014 12:18:25 +0530 Message-ID: <1404715705-5041-9-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404715705-5041-1-git-send-email-kishon@ti.com> References: <1404715705-5041-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=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: , From: Roger Quadros If probe fails then we need to call pm_runtime_disable() to balance out the previous pm_runtime_enable() call. Else it will cause unbalanced pm_runtime_enable() call in the succeding probe call. This anomaly was observed when the call to devm_phy_create() failed with -EPROBE_DEFER. Balance out the pm_runtime_enable() call in .remove() as well. Signed-off-by: Roger Quadros Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-omap-usb2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 2063d54..34b3961 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev) otg->phy = &phy->phy; platform_set_drvdata(pdev, phy); - pm_runtime_enable(phy->dev); generic_phy = devm_phy_create(phy->dev, &ops, NULL); if (IS_ERR(generic_phy)) @@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev) phy_set_drvdata(generic_phy, phy); + pm_runtime_enable(phy->dev); phy_provider = devm_of_phy_provider_register(phy->dev, of_phy_simple_xlate); - if (IS_ERR(phy_provider)) + if (IS_ERR(phy_provider)) { + pm_runtime_disable(phy->dev); return PTR_ERR(phy_provider); + } phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); if (IS_ERR(phy->wkupclk)) { @@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev) if (!IS_ERR(phy->optclk)) clk_unprepare(phy->optclk); usb_remove_phy(&phy->phy); + pm_runtime_disable(phy->dev); return 0; }