From patchwork Fri Apr 5 11:08:31 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: 161837 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp298064jan; Fri, 5 Apr 2019 04:09:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6HOxeSEPPTXi7lyhij6qk4Mfx4GQcfSbd4gDkr4O8y/DEl1tWGlJFk0EpjNj+bWUy/1TP X-Received: by 2002:a63:7e10:: with SMTP id z16mr4745181pgc.40.1554462590323; Fri, 05 Apr 2019 04:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554462590; cv=none; d=google.com; s=arc-20160816; b=VT+SHzdaV57d146pm1le1CsnF92CtrbZjPJKLcRFVzgJw74RSF+t+azc9b2PoyNoKO F4LZtjZGPh2iA1d7I8ehjZh7Q72oJcuy9fCnxIv4bClTHlHxRn13jO4KYbF1WvpUFJ5h oHqmLNTBspQCg1Xn9M/t6TRgGzUC4WpH+13THHJl4gi2R0SWxv0sRWzDU8L9KOumhM5y a+6iSiJocilVU/GxlVKDoOh1nqXkY6pmdOYkPMrsqotte6WKJDH6VV4zZJaFAFqSR6rZ uisfYvfqG28puXIVNFn7iQrLQUu0tbTeZf5qCq1XKkWsMC9TX8DmAHat+g3RGMts3zCg 833A== 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=cPk/44/l0wf1qI6rhPmQJE+OYQo/gm0Zl/ec6V/DTtZgGitTVZyIYZnmNYPufB5ibs I1tA0p9Tm+nRLVPXx1SwBXTxC0UhjI3yKc7K8UBPZLJ+zuwVHC4oNITKJ2EIZJDcjR3L sQK6akqVFzI2/jeWBDl/StbcQoEgppDauUOo73zIhgJFyKRyizlXlEkYZ8qLot7GTIXy AIHf2F+Nf658b7pMqbEj6X9PIitSoD6U/Jw2jOv73fhWlbvZpfqbQ2Ze5gxDXJVAF3FH +40wrTqVL+6LbKocRVQulyYEC3DKtWI0SwrhPYIAdoJb+vQ+nIOimyo7KAa0rDKoa1Tx KN9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=KgrmUA3s; 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 w7si16977445pgs.230.2019.04.05.04.09.50; Fri, 05 Apr 2019 04:09:50 -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=KgrmUA3s; 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 S1730975AbfDELJt (ORCPT + 31 others); Fri, 5 Apr 2019 07:09:49 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:50344 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730497AbfDELJr (ORCPT ); Fri, 5 Apr 2019 07:09:47 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x35B9hoB129252; Fri, 5 Apr 2019 06:09:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554462583; bh=/QInjG/03abJVlZotne87DnL13Y9btTLzIL3PeoAEIk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KgrmUA3sMtHCUW24sYcBUpAVLH4LEqw5rj/e/2nN7XqB+RugNI6acaAmjuSSjAFtc RkMNFfS543jdS5YhntqYZuXmepcqgY4xNE+4YSgmMf1pj0LV2UN2bvC1ktoIjSJNzS kvKvXpMwkbOo5P2wkm+Q/dg0Kq7x9Ou7DoF1rlkk= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x35B9hbr019994 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Apr 2019 06:09:43 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 5 Apr 2019 06:09:42 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 5 Apr 2019 06:09:42 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x35B9aS2100251; Fri, 5 Apr 2019 06:09:41 -0500 From: Kishon Vijay Abraham I To: Rob Herring , Kishon Vijay Abraham I , CC: Mark Rutland , , Subject: [PATCH v4 2/5] phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback Date: Fri, 5 Apr 2019 16:38:31 +0530 Message-ID: <20190405110834.13083-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190405110834.13083-1-kishon@ti.com> References: <20190405110834.13083-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);