Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3339760imm; Fri, 25 May 2018 04:09:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZojVIVhVDLC8J9N2NszXz4yZuQM3X/22ObOOecRm93KT9ikSvcAIFDKZx19nvyd0QUFbb8a X-Received: by 2002:a65:424d:: with SMTP id d13-v6mr1622760pgq.234.1527246557989; Fri, 25 May 2018 04:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527246557; cv=none; d=google.com; s=arc-20160816; b=0e37ynFDDIZu5SS1XtkIiNo9EDQV+w33ReafbcWhr9sBUHczUi6WJAcsrCAIUN8lOO jBojA21JsQ/QmELhLrK3jfUc+9Yjt3clmZ8s1OlUvvDAC0bTWPT5jpy1mbFma9Vp/FGL SFQ3YL7zdPCOcetCuVuH3QYwcAKK6uR5pukRIyfS8g60LhobnmsQJJMbJcuE6kkk//iC HTzCq4NgCCSgbLUl4dk266NkzBESFhff2uLeW0ZkKmdZ2I22l+2AHMS8AyN+/Wk2y7U4 uv8fQEpLb5mupgsP4YW428p/MtcGWy4WdbQK51jfoRz1Cn88hIVuDTD1qw2zNCEbM9ZR eGww== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=TStoP6ZVku3OihU4c1auYb96IF3kD+mufYdYBCa0ACw=; b=ng212qaPEdiAZ/ktJmRzxDU249Yxcf29zDTbIz5Z8BHht04qVmb9gPCE4shFzNEEjf SkNDmYzYZv3shq8FQP9OfO6+7KbqH+98mfOKN9ITJ9y62iFbanga6pGgAixtZZhbwjwx 897hBnjALYlN3iXtCFjTVl0cGu4tT+l/e7vnx9ngK6QZ7HWlveQH0H59Ezd4NBcKwk0B PxnDzuD/GVgExq3fG3I7blBH2k+GYoK57fMHNhNWv9TDssBGtne7EaCI51rWFnwxRyK4 N2IntEa1MwQ3ki+kdoIW9N43yWyiwoEguPJ9Gie3O4L04dALaPqjDTBQzNqOamuqr2OB dKgg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5-v6si18289827pgp.666.2018.05.25.04.09.02; Fri, 25 May 2018 04:09:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966318AbeEYLH7 (ORCPT + 99 others); Fri, 25 May 2018 07:07:59 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:4077 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966195AbeEYLH5 (ORCPT ); Fri, 25 May 2018 07:07:57 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Fri, 25 May 2018 04:08:02 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 25 May 2018 04:07:59 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 25 May 2018 04:07:59 -0700 Received: from [10.21.132.148] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 25 May 2018 11:07:06 +0000 Subject: Re: [PATCH 9/9] PM / Domains: Add dev_pm_domain_attach_by_id() to manage multi PM domains To: Ulf Hansson CC: "Rafael J . Wysocki" , Linux PM , Greg Kroah-Hartman , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , Linux Kernel Mailing List , Linux ARM , References: <1526639490-12167-1-git-send-email-ulf.hansson@linaro.org> <1526639490-12167-10-git-send-email-ulf.hansson@linaro.org> <1c21d18e-954a-f3a8-9817-0117b7cb7e4f@nvidia.com> <2c63af8c-4745-a751-8d3d-f7122e921e6f@nvidia.com> From: Jon Hunter Message-ID: Date: Fri, 25 May 2018 12:07:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/05/18 11:45, Ulf Hansson wrote: ... >> Right, but this case still seems like an error. My understanding is that >> only drivers will use this API directly and it will not be used by the >> device driver core (unlike dev_pm_domain_attach), so if anyone calls this >> attempting to attach another PM domain when one is already attached, they >> are doing something wrong. > > [...] > > You may be right! > > What I was thinking of is whether multiple PM domains may be optional > in some cases, but instead a PM domain have already been attached by > dev_pm_domain_attach(), prior the driver starts to probe. > > Then, assuming we return an error for this case, that means the caller > then need to check the dev->pm_domain pointer, prior calling > dev_pm_domain_attach_by_id(). Wouldn't it? Perhaps that is more clear > though? IMO the driver should know whether is needs multiple power-domains or not and if it needs multiple then it should just call dev_pm_domain_attach_by_id() N times without needing to checking dev->pm_domain first. If it fails then either the PM domain core did something wrong or power-domains are missing from DT, but either way there is an error, so let it fail. Cheers Jon -- nvpublic