Received: by 10.213.65.68 with SMTP id h4csp261736imn; Fri, 16 Mar 2018 02:12:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELsGBud5XTJPAwbUpxhcQDybaxMBYQC7XN9lQ03WGui+mZV5R1u5gMMbrIDK026RpHnY9VL6 X-Received: by 10.99.105.202 with SMTP id e193mr879660pgc.84.1521191543931; Fri, 16 Mar 2018 02:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521191543; cv=none; d=google.com; s=arc-20160816; b=q5ALx6K2MEbMhiRWJiph+4wE7TMG59hrypmguiouJlAnbW32aRufxC/2lD96+eKuCx 6DiE//5hVpLoxdGi04yQJoEas2Deu87VvEK8I5X4MRyuSSFrNE2kjzXZV4W5adT+qPoq 5bCEyCJWOyhR8ZH5RWvWFBiGZ7fe/67tchn3x8/3SCaAVpigBgAeGH5RiH/pgqxZjwVA 913RzFvxOe8VqKyhLhLwOwtHq0QGXHcpN+FkGPZH4vbb+6XmNVuLMiqgUXUfPUQEMVQQ Y8QjXp4+EtTjJfvux8wcPOxnzdqFQFtf4LpnoEiyHiT/CkqJKQUWWfeZ0ggzTJGraR1z M1GQ== 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=0GEBH5FuheOGyxTwNFC4hQMsqxaPKE2OPB/MI8tRYV8=; b=ISM6RLFR/q5xpVSIvZG3FxrgR5ZR+4gxuEQQBhdiPdKcPTrxJ8jzUyD7QVylddTR+Z T4+c/cPcWx6kugxqoBCpxRQwz37qSWYntg2PPAiq1QE4UDydI0EEBvwd/jHRyhFhc+h5 tKmOux9SY9xYHzHoT8qzypQXhYesyqt+mF4cg58ynLTrwFSFGzJ+YvPZdAP2x2SEgMQ5 Eism60Y+ZWGDlRnXKAna0tWCJR17Uea7t22fj5sAhuVgS3ucdA5AaQBF/+00+DJ8p9b9 W57HhwyePqdTrcJZ8+N8sUhVNuIa4roIL7IHF+bkk+UGuvHJVMKkCe4WtdHMy3/B2yxi qVag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hAEoMLJJ; dkim=pass header.i=@codeaurora.org header.s=default header.b=I8YD5bKN; 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 a29si5283628pfe.34.2018.03.16.02.12.09; Fri, 16 Mar 2018 02:12:23 -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=hAEoMLJJ; dkim=pass header.i=@codeaurora.org header.s=default header.b=I8YD5bKN; 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 S1753483AbeCPJLW (ORCPT + 99 others); Fri, 16 Mar 2018 05:11:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59532 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbeCPJLT (ORCPT ); Fri, 16 Mar 2018 05:11:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6921760C64; Fri, 16 Mar 2018 09:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521191479; bh=XOlot3QcEVzxAdTRESb+WG7XMr1rVim9kISJs9qR95w=; h=From:To:Cc:Subject:Date:From; b=hAEoMLJJk5lefG7DIg0iRFAsTVrqxCt0jChwDA4DxVN2pAQThNEdaEwzXfxYNjky9 u9vVtJJPzoVaj+xhJS520AUnkxfQQygdwPndIw6cj8sSjBxaPhP9bz2gKqVj9Ten8q u1obUF8WpFCUpBbhQd4GERYXQfToUfir86VpJ9FM= 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 52AA860590; Fri, 16 Mar 2018 09:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521191478; bh=XOlot3QcEVzxAdTRESb+WG7XMr1rVim9kISJs9qR95w=; h=From:To:Cc:Subject:Date:From; b=I8YD5bKNuTDJhDPAlvLGOzQEgEy+9sSr7uffimE/rcNV/hAIu33GiJVMFJ4WCVQOg ux/hpAPNdtSMPeFs8bbXHtrKj9QPc5zGRd+6gVKiJVIK0buQBvqWMxoDEuB6ax91LV ZxPlk0qa5zhihczx/5fflDh9F8omlya9mJBI4+Ks= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 52AA860590 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] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy Date: Fri, 16 Mar 2018 14:40:51 +0530 Message-Id: <1521191452-30089-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 refernece 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 --- 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 09ac8af..48b9615 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 0; + 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 0; + 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