All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brendan Jackman <brendan.jackman@arm.com>
To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net
Cc: andy.gross@linaro.org, sboyd@codeaurora.org,
	linux-arm-msm@vger.kernel.org,
	Axel Haslam <ahaslam+renesas@baylibre.com>,
	devicetree@vger.kernel.org,
	Marc Titinger <mtitinger+renesas@baylibre.com>,
	Lina Iyer <lina.iyer@linaro.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: [RFC 2/6] cpuidle: Add public funcion to get driver from CPU index
Date: Wed, 24 Aug 2016 14:48:18 +0100	[thread overview]
Message-ID: <20160824134822.3591-3-brendan.jackman@arm.com> (raw)
In-Reply-To: <20160824134822.3591-1-brendan.jackman@arm.com>

This will be used to enable the PSCI driver to get a reference to the
cpuidle driver, in absence of a registered cpuidle_device, in order to
get the idle states that the cpuidle driver init discovered.
---
 drivers/cpuidle/driver.c | 14 +++++++-------
 include/linux/cpuidle.h  |  3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 9e0ec15..9cb4300 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -24,13 +24,13 @@ DEFINE_SPINLOCK(cpuidle_driver_lock);
 static DEFINE_PER_CPU(struct cpuidle_driver *, cpuidle_drivers);
 
 /**
- * __cpuidle_get_cpu_driver - return the cpuidle driver tied to a CPU.
+ * cpuidle_get_cpu_driver - return the cpuidle driver tied to a CPU.
  * @cpu: the CPU handled by the driver
  *
  * Returns a pointer to struct cpuidle_driver or NULL if no driver has been
  * registered for @cpu.
  */
-static struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
+struct cpuidle_driver *cpuidle_get_cpu_driver(int cpu)
 {
 	return per_cpu(cpuidle_drivers, cpu);
 }
@@ -49,7 +49,7 @@ static inline void __cpuidle_unset_driver(struct cpuidle_driver *drv)
 
 	for_each_cpu(cpu, drv->cpumask) {
 
-		if (drv != __cpuidle_get_cpu_driver(cpu))
+		if (drv != cpuidle_get_cpu_driver(cpu))
 			continue;
 
 		per_cpu(cpuidle_drivers, cpu) = NULL;
@@ -71,7 +71,7 @@ static inline int __cpuidle_set_driver(struct cpuidle_driver *drv)
 
 	for_each_cpu(cpu, drv->cpumask) {
 
-		if (__cpuidle_get_cpu_driver(cpu)) {
+		if (cpuidle_get_cpu_driver(cpu)) {
 			__cpuidle_unset_driver(drv);
 			return -EBUSY;
 		}
@@ -87,13 +87,13 @@ static inline int __cpuidle_set_driver(struct cpuidle_driver *drv)
 static struct cpuidle_driver *cpuidle_curr_driver;
 
 /**
- * __cpuidle_get_cpu_driver - return the global cpuidle driver pointer.
+ * cpuidle_get_cpu_driver - return the global cpuidle driver pointer.
  * @cpu: ignored without the multiple driver support
  *
  * Return a pointer to a struct cpuidle_driver object or NULL if no driver was
  * previously registered.
  */
-static inline struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
+inline struct cpuidle_driver *cpuidle_get_cpu_driver(int cpu)
 {
 	return cpuidle_curr_driver;
 }
@@ -321,7 +321,7 @@ struct cpuidle_driver *cpuidle_get_driver(void)
 	int cpu;
 
 	cpu = get_cpu();
-	drv = __cpuidle_get_cpu_driver(cpu);
+	drv = cpuidle_get_cpu_driver(cpu);
 	put_cpu();
 
 	return drv;
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index e32c72b..8435577 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -134,6 +134,7 @@ extern int cpuidle_enter(struct cpuidle_driver *drv,
 extern void cpuidle_reflect(struct cpuidle_device *dev, int index);
 
 extern int cpuidle_register_driver(struct cpuidle_driver *drv);
+extern struct cpuidle_driver *cpuidle_get_cpu_driver(int cpu);
 extern struct cpuidle_driver *cpuidle_get_driver(void);
 extern struct cpuidle_driver *cpuidle_driver_ref(void);
 extern void cpuidle_driver_unref(void);
@@ -168,6 +169,8 @@ static inline int cpuidle_enter(struct cpuidle_driver *drv,
 static inline void cpuidle_reflect(struct cpuidle_device *dev, int index) { }
 static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
 {return -ENODEV; }
+static inline struct cpuidle_driver *cpuidle_get_cpu_driver(int cpu)
+{return NULL; }
 static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
 static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; }
 static inline void cpuidle_driver_unref(void) {}
-- 
2.9.3

  parent reply	other threads:[~2016-08-24 13:55 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 23:04 [PATCH v3 00/15] PM: SoC idle support using PM domains Lina Iyer
2016-08-04 23:04 ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 01/15] PM / Domains: Allow domain power states to be read from DT Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 02/15] dt/bindings: Update binding for PM domain idle states Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-09 23:55   ` Rob Herring
2016-08-09 23:55     ` Rob Herring
2016-08-10 15:14   ` Sudeep Holla
2016-08-10 15:14     ` Sudeep Holla
2016-08-10 16:40     ` Lina Iyer
2016-08-10 16:40       ` Lina Iyer
     [not found]       ` <20160810164034.GA1401-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-08-10 18:09         ` Sudeep Holla
2016-08-10 18:09           ` Sudeep Holla
2016-08-10 18:13           ` Sudeep Holla
2016-08-10 18:13             ` Sudeep Holla
     [not found]           ` <5e59874c-bbb7-270a-199c-da1ff5932554-5wv7dgnIgG8@public.gmane.org>
2016-08-11 21:10             ` Lina Iyer
2016-08-11 21:10               ` Lina Iyer
     [not found]               ` <20160811211023.GC1401-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-08-12  9:47                 ` Brendan Jackman
2016-08-12  9:47                   ` Brendan Jackman
2016-08-12 10:08               ` Sudeep Holla
2016-08-12 10:08                 ` Sudeep Holla
2016-08-15 16:08                 ` Lina Iyer
2016-08-15 16:08                   ` Lina Iyer
2016-08-15 16:14                   ` Sudeep Holla
2016-08-15 16:14                     ` Sudeep Holla
2016-08-15 22:40                     ` Lina Iyer
2016-08-15 22:40                       ` Lina Iyer
     [not found]                       ` <20160815224014.GF1401-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-08-16  8:34                         ` Brendan Jackman
2016-08-16  8:34                           ` Brendan Jackman
2016-08-16  8:41                       ` Brendan Jackman
2016-08-16  8:41                         ` Brendan Jackman
2016-08-16  9:19                         ` Sudeep Holla
2016-08-16  9:19                           ` Sudeep Holla
2016-08-12 12:35               ` Brendan Jackman
2016-08-12 12:35                 ` Brendan Jackman
2016-08-15 16:06                 ` Lina Iyer
2016-08-15 16:06                   ` Lina Iyer
2016-08-19 18:10           ` Kevin Hilman
2016-08-19 18:10             ` Kevin Hilman
2016-08-24 14:07             ` Sudeep Holla
2016-08-24 14:07               ` Sudeep Holla
     [not found]   ` <1470351902-43103-3-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-08-24 13:48     ` [RFC 0/6] Illustration of using domain-idle-states for CPU " Brendan Jackman
2016-08-24 13:48       ` [RFC 1/6] cpuidle: Rename cpuidle_get_{cpu->dev}_driver Brendan Jackman
2016-08-24 13:48       ` Brendan Jackman [this message]
     [not found]       ` <20160824134822.3591-1-brendan.jackman-5wv7dgnIgG8@public.gmane.org>
2016-08-24 13:48         ` [RFC 3/6] cpuidle: Add device_node pointer in cpuidle_state Brendan Jackman
2016-08-24 13:48         ` [RFC 6/6] arm64: dts: Add domain-idle-states for Juno r0 power domains Brendan Jackman
2016-08-24 13:48       ` [RFC 4/6] cpuidle: dt: Add support for reading states from " Brendan Jackman
2016-08-24 13:48       ` [RFC 5/6] arm64: dts: Add Juno r0 CPU power domain tree Brendan Jackman
2016-08-04 23:04 ` [PATCH v3 03/15] PM / Domains: Abstract genpd locking Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 04/15] PM / Domains: Support IRQ safe PM domains Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 05/15] PM / doc: Update device documentation for devices in " Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 06/15] PM / cpu_domains: Setup PM domains for CPUs/clusters Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 07/15] ARM: cpuidle: Add runtime PM support for CPUs Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 08/15] timer: Export next wake up of a CPU Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 09/15] PM / cpu_domains: Add PM Domain governor for CPUs Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 10/15] doc / cpu_domains: Describe CPU PM domains setup and governor Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 11/15] drivers: firmware: psci: Allow OS Initiated suspend mode Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:04 ` [PATCH v3 12/15] drivers: firmware: psci: Support cluster idle states for OS-Initiated Lina Iyer
2016-08-04 23:04   ` Lina Iyer
2016-08-04 23:05 ` [PATCH v3 13/15] dt/bindings: Add PSCI OS-Initiated PM Domains bindings Lina Iyer
2016-08-04 23:05   ` Lina Iyer
2016-08-05 14:44   ` Lina Iyer
2016-08-05 14:44     ` Lina Iyer
2016-08-04 23:05 ` [PATCH v3 14/15] ARM64: dts: Add PSCI cpuidle support for MSM8916 Lina Iyer
2016-08-04 23:05   ` Lina Iyer
     [not found] ` <1470351902-43103-1-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-08-04 23:05   ` [PATCH v3 15/15] ARM64: dts: Define CPU power domain " Lina Iyer
2016-08-04 23:05     ` Lina Iyer
2016-08-10 15:27     ` Sudeep Holla
2016-08-10 15:27       ` Sudeep Holla
2016-08-10 17:35       ` Lina Iyer
2016-08-10 17:35         ` Lina Iyer
2016-08-11  9:30         ` Sudeep Holla
2016-08-11  9:30           ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160824134822.3591-3-brendan.jackman@arm.com \
    --to=brendan.jackman@arm.com \
    --cc=ahaslam+renesas@baylibre.com \
    --cc=andy.gross@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=khilman@kernel.org \
    --cc=lina.iyer@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mtitinger+renesas@baylibre.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.org \
    --cc=sudeep.holla@arm.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.