diff mbox

[v5,3/7] cpus: Add a macro to walk CPUs in reverse

Message ID 1434432618-19035-4-git-send-email-bharata@linux.vnet.ibm.com
State New
Headers show

Commit Message

Bharata B Rao June 16, 2015, 5:30 a.m. UTC
Add CPU_FOREACH_REVERSE that walks CPUs in reverse.

Needed for PowerPC CPU device tree reorganization.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
---
 include/qom/cpu.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Gibson June 18, 2015, 6:25 a.m. UTC | #1
On Tue, Jun 16, 2015 at 11:00:14AM +0530, Bharata B Rao wrote:
> Add CPU_FOREACH_REVERSE that walks CPUs in reverse.
> 
> Needed for PowerPC CPU device tree reorganization.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas,

I've put this into spapr-next tentatively.

Are you ok with this being merged from there, or shoud it go through a
different tree?
diff mbox

Patch

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 39f0f19..42f42f5 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -323,6 +323,8 @@  extern struct CPUTailQ cpus;
 #define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node)
 #define CPU_FOREACH_SAFE(cpu, next_cpu) \
     QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu)
+#define CPU_FOREACH_REVERSE(cpu) \
+    QTAILQ_FOREACH_REVERSE(cpu, &cpus, CPUTailQ, node)
 #define first_cpu QTAILQ_FIRST(&cpus)
 
 DECLARE_TLS(CPUState *, current_cpu);