From patchwork Wed Jul 17 10:19:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169108 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp772094ilk; Wed, 17 Jul 2019 03:20:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9zUicOCUTQQeTaoYqRM8B1blqFDbEgtL8UOcVNP8sYFx4bAoWm74ce9qQpMWOzbJg2cVq X-Received: by 2002:a63:ec03:: with SMTP id j3mr13051338pgh.325.1563358800167; Wed, 17 Jul 2019 03:20:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563358800; cv=none; d=google.com; s=arc-20160816; b=k4+buYV4I9bme2uuIUp/IOLmz75mc9zE4H7V1hW7/CX7ViscH3AwcorYRPerK2/dTP FpPV//+rLCmTqduk0PGX9ajbqINULV5Zna9dQaTmRvjzGGSVQCvQtoPrYhhc8LyYKVVB Q2oB3yF436aJLQfCJRyYP0I4XgXaouPN/qSJcC00vwOzaFi4StDfrMwfB9MLeDOod8RC pxGFmdyWZ4TBYltmjuZcMg/zP0xLOu5QqYx4zhnHSkeF9AImhfepCX+sLqJEV9RGl5CT u0F2iHSDLx1ueEmR5L8jxoIoAGreEtY70Iw3KL8o7Gar0ZwhSFhEA99z6FWC9QY/Q1pp wEpg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VK4VAAKwmD6vCOcxsuweQdA7aImoD6BI1bwtOEYy7Ec=; b=k1NxSV5YnSOt3ifEBhctVDsuJc0XLo3KGxsBbEiXPcMhrJ+UUxjm0rR5g3d72roYwD OCE8nZ1cf2immY4QPH5DmfGSA8gvlUOoBdSvYPNMgfO+g+q11pC0fZK+35c+RkiPBizg TEWc4Kk8IUm62d+8/IGaaLxZINVpI2gBqfQnbpsWtBPyK4+NH9/jrLZzV/QTPWcLisQ/ Gl/zR/ONYPSRENfE6CEbsQ6eQWR95v/sNgFQlJPyLi5+VyUW4Jw8qt2mpgWgqx+aIkEV huGD7bwEdnEzk/GLoNnml/LZ+TAfo0IeRbDcid3NcMZwKwFj9yLiCa8QHXmSy8GkXkKg tWsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AJQ2aUxd; 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 cb5si21399303plb.172.2019.07.17.03.19.59; Wed, 17 Jul 2019 03:20:00 -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=AJQ2aUxd; 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 S1726704AbfGQKT6 (ORCPT + 29 others); Wed, 17 Jul 2019 06:19:58 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41017 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726568AbfGQKT5 (ORCPT ); Wed, 17 Jul 2019 06:19:57 -0400 Received: by mail-pg1-f193.google.com with SMTP id x15so592529pgg.8 for ; Wed, 17 Jul 2019 03:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VK4VAAKwmD6vCOcxsuweQdA7aImoD6BI1bwtOEYy7Ec=; b=AJQ2aUxdLzlHM27/CtHDPhhfUR2r74bNE+Fqr8namI4DMjtm0Ji7+gNHpxvvqiRDFx bS/TqlbQ6J90Uxwy03MVOU1uUp0BxIa1DOVdxUbaoshON5cRSy5QWQOcrDfOaIEIPcdP Gj2ufs3wvpr0tw0Iq50TgspWBICEBWEol53OGPNkl8cZtKwGcqeS38ztPFf5v/Wd+nLa kX3Mi6+0hE6FPSjCsz+vronqX1BzubKEO3WPstJw0glwlOgwWZqVOv/G7bW0m2LHVVGK zPjPsD7GYAXYfav8ZhSf5kMBqYM5zQNLyMN2FfN9Agg5SVevn8e/U2FH1BycN/4I9raM ejMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VK4VAAKwmD6vCOcxsuweQdA7aImoD6BI1bwtOEYy7Ec=; b=KF9AX0e1LQuCmXG/OsxZW6mZvsnTkl5Q+t2c8ZnxjCdjRO+5qEEKlFgnVXh+XBp0BD M2P4WMRjT8nPJKOYJN+p1dUnkXALTybnXy2PlKXs6GIhLWfYO0bnmeXn9DVnJ4Xzi/wg 5iZe+TAXBlpCC0i9ruStigM2jmDXGz7cQJ5Nr4pg3rmYCJRNdLn/M6j+yaelvmEClCxW 1iAbVqZWW9iaciXdhpiyFwqoF0Y98aiCUefHzeG8fZYpu09decjxybVbH+driwXrLV4C zPsB+OJBB2unuFlEDrUQ6nxQEIt9wfci+NSVsKhIYLlNAkOS/5vEcYU1HuK/I9pBudWH OiOA== X-Gm-Message-State: APjAAAW7r60A4g2OBjauyx//rn8oG1IvdpkrjZTssmV+nW5E0aVjG8K6 tyUJIRSWAkTBCqYwi+vHL2eP1A== X-Received: by 2002:a63:9318:: with SMTP id b24mr30127568pge.31.1563358796826; Wed, 17 Jul 2019 03:19:56 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id r1sm27721976pfq.100.2019.07.17.03.19.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 03:19:56 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , niklas.cassel@linaro.org, Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH V2 2/2] opp: Return genpd virtual devices from dev_pm_opp_attach_genpd() Date: Wed, 17 Jul 2019 15:49:47 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: <90ba3941b56e50ea5548dd1e90bf3bcd8c9da4fe.1563358721.git.viresh.kumar@linaro.org> References: <90ba3941b56e50ea5548dd1e90bf3bcd8c9da4fe.1563358721.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq drivers don't need to do runtime PM operations on the virtual devices returned by dev_pm_domain_attach_by_name() and so the virtual devices weren't shared with the callers of dev_pm_opp_attach_genpd() earlier. But the IO device drivers would want to do that. This patch updates the prototype of dev_pm_opp_attach_genpd() to accept another argument to return the pointer to the array of genpd virtual devices. Reported-by: Rajendra Nayak Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- V1->V2: - Check virt_devs pointer before assigning. drivers/opp/core.c | 6 +++++- include/linux/pm_opp.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 4e2a81698cd2..1f11f8c92337 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1775,6 +1775,7 @@ static void _opp_detach_genpd(struct opp_table *opp_table) * dev_pm_opp_attach_genpd - Attach genpd(s) for the device and save virtual device pointer * @dev: Consumer device for which the genpd is getting attached. * @names: Null terminated array of pointers containing names of genpd to attach. + * @virt_devs: Pointer to return the array of virtual devices. * * Multiple generic power domains for a device are supported with the help of * virtual genpd devices, which are created for each consumer device - genpd @@ -1792,7 +1793,8 @@ static void _opp_detach_genpd(struct opp_table *opp_table) * The order of entries in the names array must match the order in which * "required-opps" are added in DT. */ -struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names) +struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, + const char **names, struct device ***virt_devs) { struct opp_table *opp_table; struct device *virt_dev; @@ -1846,6 +1848,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names name++; } + if (virt_devs) + *virt_devs = opp_table->genpd_virt_devs; mutex_unlock(&opp_table->genpd_virt_dev_lock); return opp_table; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index be570761b77a..7c2fe2952f40 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -131,7 +131,7 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); void dev_pm_opp_put_clkname(struct opp_table *opp_table); struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names); +struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs); void dev_pm_opp_detach_genpd(struct opp_table *opp_table); int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); @@ -295,7 +295,7 @@ static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} -static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names) +static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs) { return ERR_PTR(-ENOTSUPP); }