Received: by 10.213.65.68 with SMTP id h4csp147245imn; Mon, 19 Mar 2018 23:03:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELt6RxDTyv2DDfntLWySP/Ng3T3vgXDjuMeLquJ9TqbyGjwsf9qKf9xF4Caa4yVFENXPnUeo X-Received: by 2002:a17:902:5205:: with SMTP id z5-v6mr780501plh.268.1521525807086; Mon, 19 Mar 2018 23:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521525807; cv=none; d=google.com; s=arc-20160816; b=ndr7bLEAJ2chXi4ejOQ38i237sCGqthyfTjk3vDXLpKpmNBI6Lx3fX2kvznP5QQbdT 0IvBL9hnrLK8x1azPIHGYTi6r29aS1HWBWhl8wlMUGeqVJP26Uy35RVGt7rFdp2/UcSv IU4Dn0qVM9s2OhmOsQr4uTsodbJ/TwMV7Fa61IfHHnGbciDMbrSw/THYadwpRMqU79IR 8DaCGiBrMnLSaBB9J/TG0F9sqX77vDUabNjwSoagXfbcys9tHnnWd+KmJE56JG8sNnPU WABogi5k59ue2di3K2Sr9c29GXL2fX9HcjdvRp+W2l4aKYITxpJBDh2uptCqDZ8VO1ov Ie5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=ktcR15HGGCg1EaSuusqvHvWdQNR8WpTqHBzrePMODcU=; b=ris0+MW3+Z8XBs8OpNB1I8iRG2NN+C4nuKIBCyNVM0bW6uy8+TxRMqDjiC3AP43YBQ 3JPdfTAXCVlXQ+qSuA6D89VjJ5fF39RsC7E6Fq4U2omaW+Gss4QjF640IxpGrBPdDPqJ ZAl2t+AB8st4KG9kX5WMAdQCzInZFwmz9HnVKuYbr7qKgRq/gaZ6E5eV1hecOgL0PCL8 eBF3qs2Pd7Sy47hcbpcXisnDzdyfBqvObr/iX6dGDWBVyhlBeHLIP75KMWw2UPOaQO7P N+Q4kX4qes6dUVctUvrrxQ+DKaAGzvohfwzW8ZZamFnnVAf2tlvBIEdF2VOGIVwQ0irL Dyag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=E2n7YjG+; dkim=pass header.i=@codeaurora.org header.s=default header.b=E2n7YjG+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i23-v6si264139pll.251.2018.03.19.23.03.13; Mon, 19 Mar 2018 23:03:27 -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=@codeaurora.org header.s=default header.b=E2n7YjG+; dkim=pass header.i=@codeaurora.org header.s=default header.b=E2n7YjG+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751514AbeCTGCE (ORCPT + 99 others); Tue, 20 Mar 2018 02:02:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60762 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751022AbeCTGCC (ORCPT ); Tue, 20 Mar 2018 02:02:02 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A059F60C5F; Tue, 20 Mar 2018 06:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521525721; bh=mm6TeliGUDwtR9K8WxlJWKmBJaEgTQDR97OKrKVOrAA=; h=From:To:Cc:Subject:Date:From; b=E2n7YjG+OnWQDsVrUz84JpJHJTZZmZhEI/x8Locxzn4VNtuBCc7Y59klhVXIeqaXc pgx135HjLTi6LHCj0p2GrdcIhSdr2oIjdLYovZdOBWF4CCYjGhGPa5zziI2YP5oghY 2iJODG1n0A/J0jJmVOFEwIdYCwjc3tXkJI5qBu3Q= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mgautam-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3AC84603AF; Tue, 20 Mar 2018 06:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521525721; bh=mm6TeliGUDwtR9K8WxlJWKmBJaEgTQDR97OKrKVOrAA=; h=From:To:Cc:Subject:Date:From; b=E2n7YjG+OnWQDsVrUz84JpJHJTZZmZhEI/x8Locxzn4VNtuBCc7Y59klhVXIeqaXc pgx135HjLTi6LHCj0p2GrdcIhSdr2oIjdLYovZdOBWF4CCYjGhGPa5zziI2YP5oghY 2iJODG1n0A/J0jJmVOFEwIdYCwjc3tXkJI5qBu3Q= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3AC84603AF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mgautam@codeaurora.org From: Manu Gautam To: Kishon Vijay Abraham I Cc: linux-arm-msm@vger.kernel.org, Manu Gautam , linux-kernel@vger.kernel.org (open list:GENERIC PHY FRAMEWORK) Subject: [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy Date: Tue, 20 Mar 2018 11:31:47 +0530 Message-Id: <1521525707-23927-1-git-send-email-mgautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org phy_init() and phy_exit() calls, and phy_power_on() and phy_power_off() already accept NULL as valid PHY reference and act as NOP. Extend same concept to phy runtime_pm APIs to keep drivers (e.g. dwc3) code simple while dealing with optional PHYs. Signed-off-by: Manu Gautam --- Changes for v2: - Fixed compilation warning drivers/phy/phy-core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 3c31ce5..1fda576 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -153,6 +153,9 @@ int phy_pm_runtime_get(struct phy *phy) { int ret; + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -168,6 +171,9 @@ int phy_pm_runtime_get_sync(struct phy *phy) { int ret; + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -181,6 +187,9 @@ int phy_pm_runtime_get_sync(struct phy *phy) int phy_pm_runtime_put(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -190,6 +199,9 @@ int phy_pm_runtime_put(struct phy *phy) int phy_pm_runtime_put_sync(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -199,6 +211,9 @@ int phy_pm_runtime_put_sync(struct phy *phy) void phy_pm_runtime_allow(struct phy *phy) { + if (!phy) + return; + if (!pm_runtime_enabled(&phy->dev)) return; @@ -208,6 +223,9 @@ void phy_pm_runtime_allow(struct phy *phy) void phy_pm_runtime_forbid(struct phy *phy) { + if (!phy) + return; + if (!pm_runtime_enabled(&phy->dev)) return; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project