hdata: make for_each_pcia take spiras as an argument

Have for_each_pcia take spiras as an argument rather than use the
global variable.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
diff --git a/hdata/memory.c b/hdata/memory.c
index 0b4e785..53a1625 100755
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -243,7 +243,7 @@
 		return;
 	}
 
-	for_each_pcia(pcia) {
+	for_each_pcia(spiras, pcia) {
 		const struct sppcia_core_unique *id;
 
 		id = HDIF_get_idata(pcia, SPPCIA_IDATA_CORE_UNIQUE, &size);
diff --git a/hdata/pcia.c b/hdata/pcia.c
index 47f40cf..36fc84c 100644
--- a/hdata/pcia.c
+++ b/hdata/pcia.c
@@ -190,7 +190,7 @@
 	dt_add_property_cells(cpus, "#address-cells", 1);
 	dt_add_property_cells(cpus, "#size-cells", 0);
 
-	for_each_pcia(pcia) {
+	for_each_pcia(spiras, pcia) {
 		const struct sppcia_core_unique *id;
 		u32 size, ve_flags;
 		bool okay;
diff --git a/hdata/spira.c b/hdata/spira.c
index 500d317..d9325a0 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -529,7 +529,7 @@
 	if (!hdr)
 		return;
 
-	for_each_pcia(hdr) {
+	for_each_pcia(spiras, hdr) {
 		const struct sppcia_core_unique *id;
 
 		id = HDIF_get_idata(hdr, SPPCIA_IDATA_CORE_UNIQUE, &size);
diff --git a/hdata/spira.h b/hdata/spira.h
index 1789de1..9db9d59 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -123,7 +123,7 @@
 			be32_to_cpu((_ntuples)->alloc_len));		\
 	     _p = (void *)_p + be32_to_cpu((_ntuples)->alloc_len))
 
-#define for_each_pcia(p) for_each_ntuple(&spiras->ntuples.pcia, p, SPPCIA_HDIF_SIG)
+#define for_each_pcia(s, p) for_each_ntuple(&(s)->ntuples.pcia, p, SPPCIA_HDIF_SIG)
 
 /* We override these for testing. */
 #ifndef ntuple_addr