From patchwork Fri Jul 4 09:55:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 33079 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 63A76203AC for ; Fri, 4 Jul 2014 10:00:04 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf7436572obc.7 for ; Fri, 04 Jul 2014 03:00:04 -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=N3QClJgT9xAZZpfSEN1JPsliLUnGy8FaqJOxuLOLixw=; b=Ek/VALjyhHCE/gleBWaRh8PAbn5QfRQfyAI4xIFXQ2Q3vR4+vZ4GBo3QeWLG1ZbxIZ McuLB0eBJZv3S0AGJCtbBYcyCxPgfmmc/5Y5edCI7/NSuuSS1qhjxnOMfyYK1jrpF82Y ydhzejlxNrKBPYBhdumQMEnnihF5DTPfbLVxeR2KuPJ6prnNybD2TX8qJ54p/PrbqmcN cLGb6uTaN2fgC+BVoPc20XifX8XUzSEK1bOZu00u2oejv8Mc57GOaY7Vbqq/BRSBHBT2 7TqTpTje8MJwl7AuHTM9CUZJ+D1NXqmJsOuIeXq3sDsuwMkTZh5S5/cjpdnVH0InwwAW R3MQ== X-Gm-Message-State: ALoCoQk3/bc0iuq+hUx7+5Ru5KwzFRmVjVti1tBqi0ocAb9fBlx1+1Nos4hk8p9XhLGYYbfc8POe X-Received: by 10.50.148.1 with SMTP id to1mr28497848igb.0.1404468003993; Fri, 04 Jul 2014 03:00:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.171 with SMTP id 40ls844036qgx.9.gmail; Fri, 04 Jul 2014 03:00:03 -0700 (PDT) X-Received: by 10.58.165.106 with SMTP id yx10mr9120751veb.17.1404468003881; Fri, 04 Jul 2014 03:00:03 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id rw10si15329421vcb.44.2014.07.04.03.00.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Jul 2014 03:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so1372974vcb.23 for ; Fri, 04 Jul 2014 03:00:03 -0700 (PDT) X-Received: by 10.58.210.168 with SMTP id mv8mr8945871vec.12.1404468003696; Fri, 04 Jul 2014 03:00:03 -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 tc5csp453568vcb; Fri, 4 Jul 2014 03:00:03 -0700 (PDT) X-Received: by 10.68.182.98 with SMTP id ed2mr50712243pbc.115.1404468003002; Fri, 04 Jul 2014 03:00:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rw8si34941133pab.167.2014.07.04.03.00.02; Fri, 04 Jul 2014 03:00:02 -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 S1758344AbaGDJ7h (ORCPT + 27 others); Fri, 4 Jul 2014 05:59:37 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:33864 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030275AbaGDJ4N (ORCPT ); Fri, 4 Jul 2014 05:56:13 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s649uCjV029713; Fri, 4 Jul 2014 04:56:12 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s649uC1V010860; Fri, 4 Jul 2014 04:56:12 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 4 Jul 2014 04:56:11 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s649tpYi017971; Fri, 4 Jul 2014 04:56:08 -0500 From: Roger Quadros To: , , CC: , , , , , , , Roger Quadros Subject: [PATCH v2 5/6] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove Date: Fri, 4 Jul 2014 12:55:47 +0300 Message-ID: <1404467748-12154-6-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404467748-12154-1-git-send-email-rogerq@ti.com> References: <1404467748-12154-1-git-send-email-rogerq@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: rogerq@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.178 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: , 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 --- 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 7007c11..3a1d00e 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; }