From patchwork Mon Jan 21 06:48:11 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: 156155 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6076091jaa; Sun, 20 Jan 2019 23:35:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bYAsvtqZ7DE8QUy7k2R6GWXGn0i/2L6meiluyD9elthw0wkyOoIYz8/9AdfPUa5yS7q9Q X-Received: by 2002:a17:902:4225:: with SMTP id g34mr29709473pld.152.1548056109142; Sun, 20 Jan 2019 23:35:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548056109; cv=none; d=google.com; s=arc-20160816; b=HVI4wddTl8tlD4kT5JvNqJNYdnWaptsClbc5ePz2biHGI2n7XYzqseMHsTGVMvHkZh Ot2GdJH5oekhFUrlr5gx1cRZNFCOncsu1KY8eYIoP2LaingXBQWCNuQ8gBUhcFTZ6hpJ Gtwum6zdzLU9Z8bXYAWqvZAQEkuKWyTCawPDKiW9rI1QjM4PhLSnsn4SP2GRnrMnEOCz 508oFyJ8U23boyo4bEsw+KnKozAUrdCgC2aGV7vv7NS/Oz5WNV4v6odU0R5E/3mP96sO KPl4hnhVJ8aJJIDmL/Wv/ghIs1z9TCDlGD41ChtkxWhYtdArOBCc2Z4N+BCc9jTl+1fC waGg== 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=1OR4FV6bic24WdSJXJpptCw50x0hnyU1VN8fM2fF2dM=; b=aoW1BPOgK/f8XLItb4wOGfdD1RlX9m5L1B5liga5qJdARy3m7u+Uic8Y8kCoiUum4A Z2Mr3CI/Qh6W1N+XsMc8C9TcM6SHr1t1eqB4wE6+aYM10wF3UKwY6W72eItbsIFuG3po i2iSq+rT7RIQI1433v4LQwupwN5yqIoFOuqh0JTLy6xhZjwtOyq0t5x9QTz1kVKibd3Z 87N1CqDRL3EiEoFJHYInLRNSZytNhMAQAiHuzKSPq3HlmUh5qdY0iEy32Wtv/fQ9MgXQ nvpOwcOP79Gk+sISdqCMpBt8UqWMBZQTZZ0d96vDvolTJMaKz7qi2tlJWQbnZwf6RS1D /pYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lg9VzX1Z; 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 q189si7679169pfb.62.2019.01.20.23.35.08; Sun, 20 Jan 2019 23:35:09 -0800 (PST) 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=lg9VzX1Z; 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 S1728594AbfAUHfH (ORCPT + 24 others); Mon, 21 Jan 2019 02:35:07 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:55088 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728150AbfAUHfF (ORCPT ); Mon, 21 Jan 2019 02:35:05 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0L7Z3ZK007138; Mon, 21 Jan 2019 01:35:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1548056103; bh=1OR4FV6bic24WdSJXJpptCw50x0hnyU1VN8fM2fF2dM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lg9VzX1ZfYaK33YO3pV7Lh9fXzd/A0FnedzWiSRLByOmxim12B1yseXXVxern8c9Z N86AuL0dBaR3AS5vBodfhDDJqwwyEaERoDL+qtoxWewxt13FyughAL+/rEsZUV2llx ALPVQZAROSJQRP9spLhZ0dCQ9PhRwN04Zb9HDpr4= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0L7Z3mK057553 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Jan 2019 01:35:03 -0600 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 21 Jan 2019 01:35:03 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 21 Jan 2019 01:35:03 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0L7YwI8026303; Mon, 21 Jan 2019 01:35:01 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Rob Herring CC: Sekhar Nori , Roger Quadros , , Subject: [PATCH 1/3] phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback Date: Mon, 21 Jan 2019 12:18:11 +0530 Message-ID: <20190121064813.18444-2-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190121064813.18444-1-kishon@ti.com> References: <20190121064813.18444-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 19b05e824ee4..bf3a1fc18117 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);