Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2169727yba; Mon, 22 Apr 2019 01:32:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgLn16XU23kteRsfNahh0pWj7/15C5J6FSJLGWRkYAVLmC/7HTY5j3vwW/m9dkDcOpeygX X-Received: by 2002:a65:5003:: with SMTP id f3mr17956337pgo.29.1555921964875; Mon, 22 Apr 2019 01:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555921964; cv=none; d=google.com; s=arc-20160816; b=CoQs/9XNrzp4LGwkeY087oBP6WwPYV29qJLxoHEke4jy9W7SR288XvPs72ge3onPhK UIDZKWD666lSZgN7//z/q4nMH+mycbadl2EP8NJnNhsRpzq9W8RFaRSF3PERf7+5hqS8 7eshn/4YUxgpzMSiRD/eTmg6xLLSsaLoR+imR7Bq97PQUX3No6U/cxefKxFCt2G2Uew2 vUZ/fVfOFLfM6LppjIvHLDAikMDrBc+dzz1c/jTREYPXYLWbz3P5eA5fiuij2xpyEUf7 Z5wNUzQF5FcRf9GJ3GCgNNNDaTZZG+7KwfQ1B7JOf35DeQb3mkAb6zCyCIId4SXhemJI uKQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=V4IK6/LbTG+pV15gAybXjSOxXA+cfXdQyo/voA2qF90=; b=RM5v0Z+2ktSu2X+xZUQWt440w5xO30kMBc1cmg5IR71OhUZJNRgFPIBG2TwAGS58g+ a4mF/1krUTXDYYmz+HtM/eYVBMlMOvQ7Gdku9phoaO5jRESTg0zpqW8WoYSnqHhVDsSj DeXBjxj63JbU+9Ar35UOz4GDvUPw3JBZ2pfQdNydRmVgagmZGB30SU+vQN009Jnx+5RM WRrKOqaMoS/SLXD88For94JIx7DiLw2cBdFBszQHn4ilm9nePtepmrmPZCmjF305qIWR CyYP8J2/HbYUPNFBMaJvo7kBF/KiwNikNDdFF16ESkUQLlakXocRRdKkCi/pNkAwoRaX vAyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pRX5aSNn; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k71si11758077pgd.583.2019.04.22.01.32.29; Mon, 22 Apr 2019 01:32:44 -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=@linaro.org header.s=google header.b=pRX5aSNn; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbfDVIbH (ORCPT + 99 others); Mon, 22 Apr 2019 04:31:07 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37127 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726632AbfDVIbH (ORCPT ); Mon, 22 Apr 2019 04:31:07 -0400 Received: by mail-pl1-f193.google.com with SMTP id w23so5494096ply.4 for ; Mon, 22 Apr 2019 01:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=V4IK6/LbTG+pV15gAybXjSOxXA+cfXdQyo/voA2qF90=; b=pRX5aSNnEO6HydPKb/DaMq8xerPdRAjcvmwQn6olPCVKhtmP/IzJ0EVPkUPMZt11xc 8vzf95muBZVfXvHdV9uJUec21UBK8i48xg6sQdpo1ERCVj3cPVtzkJDBeRYtF6yW9ZIg qI3pinyPnl3waXpftKbdOCy5ATEuitXS0jtVg/GyRaLrzZdcALIHBrJn4ujYof8PYeGI aip1kBmLvArBpshV8bjYKbKeIBfxdXkMFIda3vM/8QA0nnsbtG6+Sk38ydw1gmnNuVBQ FRmlP2MJrdSyUA1LvcnaZX+aijbNPlbuFCwE7bxG5cQZujtaV4w9er0Vcp5hP/sQCgN6 zWKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=V4IK6/LbTG+pV15gAybXjSOxXA+cfXdQyo/voA2qF90=; b=ZlvQQ7haY6odNxewsGI2/vkdg38w4pOBOn6rXgfE8D/v0NARYVQmaP6IqrdFUCRPXc ca1xcpGmIMvVZsEyDLtY64L2Jfv+LOkt3BvJv2iyFbnotX5WQtRiEPiF8Tep5f/Cg10b +fSXME42DVoCxNlaK5berKmcxxlgab5uClDv0suGR12N+s3Su0vlghvG5JZaqYrkT3SI UtnRidkkvGlWgCbKNGIZG8bcp2yQFl3k1i+Md7vFOXyKiCCJd38S07taLLK45PJWBfKH yMUimpTR2z/HHAiBQKFCHx+dOqgLuuFEQDb25WTi+Brz9rTdMYgZ/jogQtKP0NXWb8Dg 28kg== X-Gm-Message-State: APjAAAVGRXDMQUr5KNmTcdmLpNEfgSrZwbjmdmvaadR0w1yEpx6h3ISV xMwLyHhUchqs0YstzB96CsTJBg== X-Received: by 2002:a17:902:b210:: with SMTP id t16mr18964713plr.84.1555921866253; Mon, 22 Apr 2019 01:31:06 -0700 (PDT) Received: from localhost ([122.166.139.136]) by smtp.gmail.com with ESMTPSA id p6sm15229242pfd.122.2019.04.22.01.31.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 01:31:05 -0700 (PDT) Date: Mon, 22 Apr 2019 14:01:03 +0530 From: Viresh Kumar To: Ulf Hansson Cc: "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Greg Kroah-Hartman , Jon Hunter , Rajendra Nayak , Niklas Cassel , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Message-ID: <20190422083103.xnuvmap5zgbdyk4v@vireshk-i7> References: <20190418102757.1246-1-ulf.hansson@linaro.org> <20190418102757.1246-4-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190418102757.1246-4-ulf.hansson@linaro.org> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18-04-19, 12:27, Ulf Hansson wrote: > If a call to dev_pm_domain_attach() succeeds to attach a device to its > single PM domain, the important point is to prevent following calls to > dev_pm_domain_attach_by_name|id() to fail. This is managed by checking the > dev->pm_domain pointer and then return -EEXIST, rather than continue > calling genpd_dev_pm_attach_by_id|name(). > > For this reason, let's enable genpd_dev_pm_attach_by_id|name() to be used > for also single PM domains. This simplifies for future users to solely make > use of dev_pm_domain_attach_by_id|name() rather than having to combine it > with dev_pm_domain_attach(). > > Signed-off-by: Ulf Hansson > --- > drivers/base/power/domain.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 801f31c87d16..1b026704a8fc 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2512,10 +2512,10 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > if (!dev->of_node) > return NULL; > > - /* Deal only with devices using multiple PM domains. */ > + /* Verify that the index is within a valid range. */ > num_domains = of_count_phandle_with_args(dev->of_node, "power-domains", > "#power-domain-cells"); > - if (num_domains < 2 || index >= num_domains) > + if (index >= num_domains) > return NULL; > > /* Allocate and register device on the genpd bus. */ Acked-by: Viresh Kumar -- viresh