From patchwork Mon Mar 25 08:08:12 2019 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: 161025 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3675700jan; Mon, 25 Mar 2019 01:09:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkYCC9IsN2RWW11EQRazan0C4v8csF1MBa4l3CBuQ1B9A3DBtexBvYouDhObxX9aG2U4am X-Received: by 2002:a65:4bcc:: with SMTP id p12mr22163495pgr.187.1553501382560; Mon, 25 Mar 2019 01:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553501382; cv=none; d=google.com; s=arc-20160816; b=iixqKoPKcKBoRwU1o4k0F9r4h9rBTzb33xCfi5uN6ysGqJwKKucIA/bTkt5zXGqtSs IgZ4MM6rbAGLBNW9xWdI5r7uHfOjkXGHcnnbhZ+2IOKX3CC2Zu/1XU3SWVG8puSp1g4w hd0VWKkOcih2LzUz3xx85RCSeZw4sOBTfXpDjmnOjTzTiyQn8fqrD6ZFpfpITS65znRU 7gDqTzrjY+avsLM/Aq7K5hQSFQVG+Z3p+oE4mo4kOWsls+8GrjWlZngc4i+M/hVfnhc4 1KXaOFtMJ8L+XbMRyY+2jxruEiIQpA2JnFMY683Ne4GLoEaRgAiINXcO5V5uZVsEvSrD BI/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=/QInjG/03abJVlZotne87DnL13Y9btTLzIL3PeoAEIk=; b=pACPYuNwIjWwDjfpv+VGAzt/0w44j1FdQOI9tvv4I4Mv4rA3opkhRb69S5pf9YDjnJ t3S2DQeHv8i6bNHyz9GCxs+SXW1A7jSsEV1lDzXW3jgtod44RNFoRThsmtleNTFLJMW/ GD3x/V0TaiZkRUebmR3ObOVQbmkr4PIPD6lUOcuUARqG/p+7fsv4qRY8/2/CMThLJYIU nVYKsIFFGYVXz/DI/ypFVRQZjWNG3AF+ZSQjMNA5p+l5+juonMj+pSdynfJgEJ2Lw/iI hafq4IMjqRrCsWDGIINY0CIa0XQUhDLp6lyQOiQZxdWc8pxPfa+/G3moNTeBJtl0PzGB Ip2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lrihuwEl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si13468702plo.41.2019.03.25.01.09.42; Mon, 25 Mar 2019 01:09:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@ti.com header.s=ti-com-17Q1 header.b=lrihuwEl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730003AbfCYIJV (ORCPT + 31 others); Mon, 25 Mar 2019 04:09:21 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57316 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729946AbfCYIJT (ORCPT ); Mon, 25 Mar 2019 04:09:19 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2P89HxJ015494; Mon, 25 Mar 2019 03:09:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553501357; bh=/QInjG/03abJVlZotne87DnL13Y9btTLzIL3PeoAEIk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lrihuwEl22andwhovLQ3v3aELCu7Z7mJH/bw8JrIRm+GvrDJUUxaxPFUSh7SJCnzM LmlxlLSNRBX/8zO8fC281/9wiJCUmhdSgDnNb9lyurLXNFkMwUFkWZDT21GeUfupYl SNwiWSD+UQyqJhq4kW5+I+RNidf0nrP1z640uIwQ= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2P89HFZ051420 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Mar 2019 03:09:17 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 25 Mar 2019 03:09:16 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Mon, 25 Mar 2019 03:09:16 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2P89AkY019470; Mon, 25 Mar 2019 03:09:15 -0500 From: Kishon Vijay Abraham I To: Rob Herring , Roger Quadros , Kishon Vijay Abraham I CC: , Subject: [PATCH v3 2/5] phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback Date: Mon, 25 Mar 2019 13:38:12 +0530 Message-ID: <20190325080815.6056-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325080815.6056-1-kishon@ti.com> References: <20190325080815.6056-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PHY drivers may try to access PHY registers in the ->reset() callback. Invoke phy_pm_runtime_get_sync() before invoking the ->reset() callback so that the PHY drivers don't have to enable clocks by themselves before accessing PHY registers. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-core.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index b9a4ebf35dd3..c147ba843f0b 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -384,10 +384,16 @@ int phy_reset(struct phy *phy) if (!phy || !phy->ops->reset) return 0; + ret = phy_pm_runtime_get_sync(phy); + if (ret < 0 && ret != -ENOTSUPP) + return ret; + mutex_lock(&phy->mutex); ret = phy->ops->reset(phy); mutex_unlock(&phy->mutex); + phy_pm_runtime_put(phy); + return ret; } EXPORT_SYMBOL_GPL(phy_reset);