Skip to contentSkip to conversation

apply some new lib functions

PATCH In review Andrew Jones 3 participants 6 messages May 22, 2017 – May 25, 2017 KVM

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 arm/powerpc: setup: apply assert_msg

In reply to Andrew Jones
---
 lib/arm/setup.c     | 7 ++-----
 lib/powerpc/setup.c | 8 ++------
 2 files changed, 4 insertions(+), 11 deletions(-)
lib/arm/setup.c +2 -5
index 689c211d3018..9974b4c131dd 100644
@@ -48,11 +48,8 @@ static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused)
 {
 	int cpu = nr_cpus++;
 
-	if (cpu >= NR_CPUS) {
-		printf("Number cpus exceeds maximum supported (%d).\n",
-			NR_CPUS);
-		assert(0);
-	}
+	assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS);
+
 	cpus[cpu] = regval;
 	set_cpu_present(cpu, true);
 }
lib/powerpc/setup.c +2 -6
index 8d44311cac3b..7157bcb70094 100644
@@ -50,15 +50,11 @@ static void cpu_set(int fdtnode, u64 regval, void *info)
 	struct cpu_set_params *params = info;
 	int cpu = nr_cpus++;
 
-	if (cpu >= NR_CPUS) {
-		printf("Number cpus exceeds maximum supported (%d).\n",
-			NR_CPUS);
-		assert(0);
-	}
+	assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS);
+
 	cpus[cpu] = regval;
 
 	/* set exception stack address for this CPU (in SPGR0) */
-
 	asm volatile ("mtsprg0 %[addr]" ::
 		      [addr] "r" (exception_stack[cpu + 1]));
 
Signature · 1 line
2.9.3
#3 lore raw

PATCH 2/2 arm/arm64: gic: apply report_prefix_pushf

In reply to Andrew Jones
---
 arm/gic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arm/gic.c +1 -3
index 82f663218b0b..e27e8a36a9f0 100644
@@ -297,7 +297,6 @@ static void run_active_clear_test(void)
 
 int main(int argc, char **argv)
 {
-	char pfx[8];
 	int cpu;
 
 	if (!gic_init()) {
@@ -305,8 +304,7 @@ int main(int argc, char **argv)
 		return report_summary();
 	}
 
-	snprintf(pfx, sizeof(pfx), "gicv%d", gic_version());
-	report_prefix_push(pfx);
+	report_prefix_pushf("gicv%d", gic_version());
 
 	switch (gic_version()) {
 	case 2:
Signature · 1 line
2.9.3
#0 lore raw

cover apply some new lib functions

Peter Feiner has provided us some nice, new lib functions. Let's put them to more use.

Andrew Jones (2):
arm/powerpc: setup: apply assert_msg
arm/arm64: gic: apply report_prefix_pushf

 arm/gic.c           | 4 +---
 lib/arm/setup.c     | 7 ++-----
 lib/powerpc/setup.c | 8 ++------
 3 files changed, 5 insertions(+), 14 deletions(-)
Signature · 1 line
2.9.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH kvm-unit-tests 1/2] arm/powerpc: setup: apply assert_msg

In reply to Andrew Jones
Quoted 35 lines · Andrew Jones
---
 lib/arm/setup.c     | 7 ++-----
 lib/powerpc/setup.c | 8 ++------
 2 files changed, 4 insertions(+), 11 deletions(-)
lib/arm/setup.c +2 -5
index 689c211d3018..9974b4c131dd 100644
@@ -48,11 +48,8 @@ static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused)
 {
 	int cpu = nr_cpus++;
 
-	if (cpu >= NR_CPUS) {
-		printf("Number cpus exceeds maximum supported (%d).\n",
-			NR_CPUS);
-		assert(0);
-	}
+	assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS);
+
 	cpus[cpu] = regval;
 	set_cpu_present(cpu, true);
 }
lib/powerpc/setup.c +0 -3
index 8d44311cac3b..7157bcb70094 100644
@@ -50,15 +50,11 @@ static void cpu_set(int fdtnode, u64 regval, void *info)
 	struct cpu_set_params *params = info;
 	int cpu = nr_cpus++;
 
-	if (cpu >= NR_CPUS) {
-		printf("Number cpus exceeds maximum supported (%d).\n",
-			NR_CPUS);

lib/powerpc/setup.c static void cpu_set(int fdtnode, u64 regval, void *info) · line 59

Quoted 10 lines
lib/powerpc/setup.c +2 -3
-		assert(0);
-	}
+	assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS);
+
 	cpus[cpu] = regval;
 
 	/* set exception stack address for this CPU (in SPGR0) */
-
 	asm volatile ("mtsprg0 %[addr]" ::
 		      [addr] "r" (exception_stack[cpu + 1]));
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH kvm-unit-tests 2/2] arm/arm64: gic: apply report_prefix_pushf

In reply to Andrew Jones
Quoted 19 lines · Andrew Jones
---
 arm/gic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arm/gic.c +0 -1
index 82f663218b0b..e27e8a36a9f0 100644
@@ -297,7 +297,6 @@ static void run_active_clear_test(void)
 
 int main(int argc, char **argv)
 {
-	char pfx[8];
 	int cpu;
 
 	if (!gic_init()) {

arm/gic.c int main(int argc, char **argv) · line 310

Quoted 9 lines
arm/gic.c +1 -2
@@ -305,8 +304,7 @@ int main(int argc, char **argv)
 		return report_summary();
 	}
 
-	snprintf(pfx, sizeof(pfx), "gicv%d", gic_version());
-	report_prefix_push(pfx);
+	report_prefix_pushf("gicv%d", gic_version());
 
 	switch (gic_version()) {
 	case 2:
maintainer
#5 lore raw
In reply to Andrew Jones
Quoted 12 lines · Andrew Jones

Peter Feiner has provided us some nice, new lib functions. Let's put them to more use.

Andrew Jones (2):
arm/powerpc: setup: apply assert_msg
arm/arm64: gic: apply report_prefix_pushf

 arm/gic.c           | 4 +---
 lib/arm/setup.c     | 7 ++-----
 lib/powerpc/setup.c | 8 ++------
 3 files changed, 5 insertions(+), 14 deletions(-)

Fixed the small conflict in patch 2 and applied, thanks.

Paolo