From patchwork Thu Jul 10 06:25:03 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: 33376 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2BA0023932 for ; Thu, 10 Jul 2014 06:25:43 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 200sf19725538ykr.6 for ; Wed, 09 Jul 2014 23:25:42 -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=elxku3aPbLBU3TAdMldSJ0iYpZtJ/dUslqp2y4FLbrKmQJVA8xnjZL+JHlZ546Ibtr 1+kGQCqtSoefLY9j1s8VcJo7RllSi8HXZpApbHWomoq0k5cta2MJPyhAKhVbleV//FV9 JQ42hOP0kywM86xPCt8TfnBu8X4l0Q1POkkgI/2ar1a1HiEzOygdLS+cPJu4Qtk7mUx3 FoaKv49GG5XZigEVGQUi/DUsFkGC3NlJMBgTzy/88cW6Lu32S5XQ7q7Di5/50cHQ0qiP L344C1lBYi/Lwg/f/8AYr3s+B3nV7PLCcy2hKxuHsexNMRTw7n7KsO0OY7ThnhBSoGRq joqQ== X-Gm-Message-State: ALoCoQnKMyHBRzpyp+s08ga8THo42Y9I2CzpdFawR+q1rZHuS1yTNVJ9x43GnPGvwg0GuwTWsaJH X-Received: by 10.236.209.97 with SMTP id r61mr2055568yho.33.1404973542826; Wed, 09 Jul 2014 23:25:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.23 with SMTP id 23ls2757671qgi.26.gmail; Wed, 09 Jul 2014 23:25:42 -0700 (PDT) X-Received: by 10.221.49.200 with SMTP id vb8mr43396401vcb.17.1404973542619; Wed, 09 Jul 2014 23:25:42 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id eh6si22572124vcb.78.2014.07.09.23.25.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 23:25:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id il7so9553876vcb.40 for ; Wed, 09 Jul 2014 23:25:42 -0700 (PDT) X-Received: by 10.221.25.210 with SMTP id rj18mr43567224vcb.5.1404973542525; Wed, 09 Jul 2014 23:25:42 -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 tc5csp107990vcb; Wed, 9 Jul 2014 23:25:42 -0700 (PDT) X-Received: by 10.66.66.14 with SMTP id b14mr24433086pat.9.1404973541160; Wed, 09 Jul 2014 23:25:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn5si18109123pac.36.2014.07.09.23.25.40; Wed, 09 Jul 2014 23:25:40 -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 S1751585AbaGJGZa (ORCPT + 28 others); Thu, 10 Jul 2014 02:25:30 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:55133 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751487AbaGJGZ3 (ORCPT ); Thu, 10 Jul 2014 02:25:29 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6A6PSU1022892; Thu, 10 Jul 2014 01:25:28 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6A6PSfQ025306; Thu, 10 Jul 2014 01:25:28 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Thu, 10 Jul 2014 01:25:27 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6A6PIrZ010573; Thu, 10 Jul 2014 01:25:26 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 5/5] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove Date: Thu, 10 Jul 2014 11:55:03 +0530 Message-ID: <1404973503-3310-6-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404973503-3310-1-git-send-email-kishon@ti.com> References: <1404973503-3310-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.181 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; }