Received: by 10.192.165.148 with SMTP id m20csp3086849imm; Sun, 22 Apr 2018 23:44:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx483KRe7/d2fYtnlx7k1mwqN9TVzuQ6591gSxdGS1yRhGHtUi6Q8s8HIOweFn2G072hg9gtC X-Received: by 10.99.148.1 with SMTP id m1mr16072910pge.140.1524465843016; Sun, 22 Apr 2018 23:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524465842; cv=none; d=google.com; s=arc-20160816; b=XrCxlvtgBauUTPqr8cyi0icZu/fU4hZmicFm7pLXh6OdDtgMI4qTCdVjhd5jqu65J7 Iopks/nklMOIdMit/CanYx/MY825y+krW8eK1WrbBcObi8jYjmoZzxakni98tLHntfz7 vG0lT7siEUBGpeHYxc+aFOZ97xYVvf9+EJL0BlXw6PkxNa1dMNhsCQnAi1lTJRRa0ESW MVJD+hdIteVph7ymeYUxu2dUCsJiPCNPdnqvjpoLV2j+lb+cyy2W7W96Nv27x7stwWWS ZfQL28bfzMJMBE5/tC2J4tHKpPJIWxj6phnQRRhZuOX/0gAG/FLW5WmSZnv7Zv80vhA0 I2kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=qvCVZ3IimW5a5/CSGlBGSw79ntTam7azfG+FrI8+0B0=; b=UPNVe8D43grDdkoJg0VhKlXHPVC+czlf4r3aUTA2Fd+6tkuAzW+FZvAsBd2SmnsMN0 f4bMwur3ypvYhd5NsvHsxWqDzWPueaKFl54SuNQiDjYiWGuabZrLM5AHASv8zqB1AMxt jNszvqmEG1Q71oOR2J2QlniK51KgboUHO5O+8agEaH/O+4DhCXpwP6jAXVxVdqhhUiiF MNA8pMOO2ibOdstDJiOyImfiv52CK/Xm40pkqwPG4Bs5VCMAAWgM/mBpJlM5RdOVP86k g79LoxC5UOAoGBs4FY1ad+gOiyKiK1cglRSkEGdZy5I7/bxoRs8eY00ZMUSwBWI6YJQ0 3U7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wUCMLdM4; 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 9-v6si11312774plb.415.2018.04.22.23.43.47; Sun, 22 Apr 2018 23:44:02 -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=wUCMLdM4; 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 S1752856AbeDWGmi (ORCPT + 99 others); Mon, 23 Apr 2018 02:42:38 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:57736 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbeDWGmh (ORCPT ); Mon, 23 Apr 2018 02:42:37 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3N6gXn7022587; Mon, 23 Apr 2018 01:42:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524465753; bh=7opzJSluZsI6q++1CXwSqqGMOWm11KyRkIcdZvRJr6M=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=wUCMLdM43BbNP1twVx+IbByhQ8k5lkTs7p1ot0QFvNvN8yZR4Pkdtfg0M784Iot72 zYoIihvOuWlFRW0Y0ifd0aM4VFXCOklRDz/uWVzKgZzkR7ENBUTE3i9pHaf61vRExw k0dCHMi7v6ar5iG17Fj3GRQO9OFvCKtEyN+ch570= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3N6gXCQ004069; Mon, 23 Apr 2018 01:42:33 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 23 Apr 2018 01:42:33 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 23 Apr 2018 01:42:33 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3N6gVU4022729; Mon, 23 Apr 2018 01:42:32 -0500 Subject: Re: [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy To: Manu Gautam References: <1521525707-23927-1-git-send-email-mgautam@codeaurora.org> CC: , "open list:GENERIC PHY FRAMEWORK" From: Kishon Vijay Abraham I Message-ID: Date: Mon, 23 Apr 2018 12:12:31 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1521525707-23927-1-git-send-email-mgautam@codeaurora.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit 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 On Tuesday 20 March 2018 11:31 AM, Manu Gautam wrote: > 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 merged, thanks! -Kishon > --- > 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; > >