From patchwork Mon Jul 8 06:00:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 168603 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp6700567ilk; Sun, 7 Jul 2019 23:00:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgNgHZykwNTgVu9WgVRuEpqFImWIvxjs43Wuwq8aLKEsbXuOPt3huQlXFlBuhOoH35bpvC X-Received: by 2002:a17:902:e65:: with SMTP id 92mr21386464plw.13.1562565621168; Sun, 07 Jul 2019 23:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562565621; cv=none; d=google.com; s=arc-20160816; b=GRh4eKv5fbfcT8MyRkwwka3CGpEXl18ow8AkX1fLp9u/FYY2zYfHuEliEnqA9g3z9E xSJMfmI5v7qGhWbUILsa0hFra3Orb9bzWyIFZHHMzY+9IqIviM17r+NlECvK24Dgz186 a5bFiK5UWmQut5NihlbFVNDrm63VyiSTSapAzBJwKxoQhDUo2FZ+Pelx+5OVQ9FTsRHZ 2FgTo7eAND91o3jKV0Qo6Nk1HV7Z6KfelRy82VaUJi6tw7pMZuppZNmfVwjdd3QhrEaz 3upk+ydZBfFYUNxQRzTIdaBNfQo/FF/pc9JvXMNl/V8BpeO7/hc6gieHqrcgqB4c6giy NzyA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6q22eQDDCUZWlcpujovTPxDLV/PDTFZTJgjMkPGNMDU=; b=Ugv9Qgk5/6C1vTqbkY2762DG0fpkVUD/GJjMkXBXzjP1Cv7IzYRPFhxRQnp5RFhfz6 dgJf8wXfuPpNkNO4tcuCQw/s79IFHYdyRP0Ywzrj0N4pIsvlOEilKiDQbCCcHywC1UbA QqZBSZxv2KpWnideBHytZ469Hs/GIFx1BmIc3kWwkmKBQ/GkbHLEMGSl9xN8cHtyhg2N vG5EtJ5CxB5B/JPHZVCbrU15UY+5UXvl2D527LcOxy6kx4nRR9UstNsu68RN2AHYtqQR XAc4j+TUC8VP5L5gCLORrUBAtWrcJD5ffPH7cmrfN/q5BkVHESYmuqFuSNiABsJKOZ+f JU0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qCFcjFeC; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 d6si18591867pjc.7.2019.07.07.23.00.20; Sun, 07 Jul 2019 23:00:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=qCFcjFeC; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1727908AbfGHGAU (ORCPT + 11 others); Mon, 8 Jul 2019 02:00:20 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33417 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727406AbfGHGAU (ORCPT ); Mon, 8 Jul 2019 02:00:20 -0400 Received: by mail-pl1-f196.google.com with SMTP id c14so7660696plo.0 for ; Sun, 07 Jul 2019 23:00:19 -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:mime-version :content-transfer-encoding; bh=6q22eQDDCUZWlcpujovTPxDLV/PDTFZTJgjMkPGNMDU=; b=qCFcjFeCt5a05VcS5Cjwgn22CsE/7DQLunpoWaYJxF06aSHKpcocF0SZYql/0vvOYP gPHsR+rNQ8P0MLJcpgJMZv56u/hBqdpZ+4ywoAGXcYG7ooS3XQGOlYkBql1rIr38HYqu zXO/ZmzprkLvQ+rKetYp4s1jyIcpCCyb5Yum+pq78zZQC78pLqdUN+WUEssnXexeUcl2 6r7akeSW1kIBwVhljmpM32CmF2uqDXRZRx1l3pUy2HmHEpgzOjQvbhy6q8r+XK8pAmUJ 0nOeDi2SQsTmFSpK+2c+gl8zE08CvsvEj+Ys1POjFUK/eul15t4sQnwNGka0hZ+Hicpr VmWg== 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:mime-version :content-transfer-encoding; bh=6q22eQDDCUZWlcpujovTPxDLV/PDTFZTJgjMkPGNMDU=; b=RcO0wO306MndHxB7nlIfbFD9Q6i8F9WAU9ezeOQe5Tq/FWwARG/350FgS2GKzJfd7S 3lkaFVm205ICgLevbZMKCCYYHckTO4BypP19guwljyAdTWJXhKJqihqnliBcpzmE7XTY sF89E96+GzAvcT2Fp+KWeEwcrP+OK8rP1CTsTjpR0XkndN46+j5Aa5grjOUKoJ8TMWx1 SWpOL2MwgkyJXRzMT4tps+d/7te0BUePCXd+bDq+3r8Mu6JtylnbNp7haT68OA0v58zp xl5mpMEg3KmPWdhM1t6FPjCqzAzCM6kckHYNKAon7S1gInpezatNwjI6KV7F4Y9aN+Nh cKzw== X-Gm-Message-State: APjAAAV/3WnNgnYRo0MjlpqGaPVfYXFlrb/WAjOGGdGykmQWJTqDdVJe wzly+dGA1eAcWpWkJpzDhMTnFA== X-Received: by 2002:a17:902:1e7:: with SMTP id b94mr22716751plb.333.1562565619188; Sun, 07 Jul 2019 23:00:19 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id f15sm21479445pje.17.2019.07.07.23.00.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Jul 2019 23:00:18 -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 , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH] opp: Return genpd virtual devices from dev_pm_opp_attach_genpd() Date: Mon, 8 Jul 2019 11:30:11 +0530 Message-Id: <027985ce35873cd218298302a1408da06d48458b.1562565567.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 Signed-off-by: Viresh Kumar --- @Rajendra: Can you please test this one ? I have only compile tested it. drivers/opp/core.c | 5 ++++- include/linux/pm_opp.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 2958cc7bbb58..07b6f1187b3b 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 @@ -1789,7 +1790,8 @@ static void _opp_detach_genpd(struct opp_table *opp_table) * This helper needs to be called once with a list of all genpd to attach. * Otherwise the original device structure will be used instead by the OPP core. */ -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; @@ -1850,6 +1852,7 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names name++; } + *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); }