From patchwork Wed Feb 6 11:07:51 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: 157618 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6277076jaa; Wed, 6 Feb 2019 03:08:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IZmXKrBOxAUpUd/pJJt9C2z+Stxab5zM1fNWA0C2LjUy8JHpdihl99CAtV2AIq3NjgVXNZL X-Received: by 2002:a17:902:8ec9:: with SMTP id x9mr10258417plo.27.1549451324965; Wed, 06 Feb 2019 03:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549451324; cv=none; d=google.com; s=arc-20160816; b=qILG0N5USZRWcjOhWdQ05S8MRfAMMUu9DuXqgmF2WxHH6wVyBAs8Pubxo4vkkFS4FQ 4Z7btmZycZaZQabonka1zzXTy+IJgGqVg8RR9/8Kl+7M8QMYFjhRM5ptbGRWFvfxpLDI Xq/+lepPQ87wWIer1uFVHHuEoTzoNky6oF6XHqIsFtnD1b26nelslgyrL6IdEESS1LdB 4b9lEl4s6w0v33ZUtNLzzMXNwjzKNLF6z0CT9T4tq+sIYonikPKI8cnEvfGFe06ekDxJ Z81RX1Ku5Az44YBLQydaSY1Q1GzGaYcr9vQTKxVk/38ck9DcHxTDRrFROQI2wBLeAxW4 370g== 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=QbjnrCOwfvbyve0jHgDFi86DKkrVu+fyy4HtOfhZMps=; b=Mf1olPVlB5FqogsGo+Yznkc7OfiBs3PH0AFWCg451ynlewIlAzZWgqbUi7poyoxa/2 Mruk+0PFvpbIPaL2jzWI12ieYUnet1hHJFqbp9ibaaO4GvynabeOxGTgzfM3Xx2durwJ Ip9FDuRGKIVrENIUg/CwwMwdC1AduJqcxROvLvqu5O3y+wH755cWFKLOb6s0dg+DHrVh Tv8MPZyz2GM5KHgyJj5LSqAYUNEk0sHXqSe5eDp7t/LiT1lTAwYTHMc8u/8lhwuV9uZ7 BbOVGbxWWFmeVXxRq6jGj/O5FixOO1jFbLxD8uR4iCYD9IMM8ZwC9W3paBRLiFcUtpxT eFIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EJetejEO; 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 r14si5401726pgh.39.2019.02.06.03.08.44; Wed, 06 Feb 2019 03:08:44 -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=EJetejEO; 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 S1729751AbfBFLIm (ORCPT + 31 others); Wed, 6 Feb 2019 06:08:42 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:33520 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729155AbfBFLIk (ORCPT ); Wed, 6 Feb 2019 06:08:40 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x16B8dH7103492; Wed, 6 Feb 2019 05:08:39 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1549451319; bh=QbjnrCOwfvbyve0jHgDFi86DKkrVu+fyy4HtOfhZMps=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EJetejEOOvfBYgSFiAIAkQ3eQ+YAPxVoAvnppalLyc8NmvMEJfxYSv+e4ts88hGds fqOVXycJh2qHZAKiPexgtyJUm/I9GKR9htLxmxE4nsv9EMOTxp98W/HE4grDhhiV/M NSf5HOou9xdlVORtnR4Owo5DHh6deSmu9NSuPams= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x16B8dXf015369 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 6 Feb 2019 05:08:39 -0600 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 6 Feb 2019 05:08:38 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 6 Feb 2019 05:08:38 -0600 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 x16B8Waa024645; Wed, 6 Feb 2019 05:08:37 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Rob Herring CC: Roger Quadros , , Subject: [PATCH v2 2/4] phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback Date: Wed, 6 Feb 2019 16:37:51 +0530 Message-ID: <20190206110753.28738-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190206110753.28738-1-kishon@ti.com> References: <20190206110753.28738-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 d4bd85afdc91..fb66f93cd61c 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);