mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: use system.h's get_cr() for cpuinfo
@ 2019-10-07 10:28 Ahmad Fatoum
  2019-10-14 10:11 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2019-10-07 10:28 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Instead of open-coding the get_cr(), use the already available helper
in <asm/system.h> same as we do for 64-bit ARMv8.
The only difference is that the "memory" clobber is replaced by "cc".
This is ok as we don't expect get_cr() to affect memory and because
we do it elsewhere in barebox without a "memory" clobber already.

While at it, move it out the #if/#else clause as the helper changes
behavior depending on the same CONFIG option anyway.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/cpuinfo.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
index 1ba3b4379c30..ff6e1eb87b9f 100644
--- a/arch/arm/cpu/cpuinfo.c
+++ b/arch/arm/cpu/cpuinfo.c
@@ -76,8 +76,6 @@ static int do_cpuinfo(int argc, char *argv[])
 		: "=r" (cache)
 		:
 		: "memory");
-
-	cr = get_cr();
 #else
 	__asm__ __volatile__(
 		"mrc    p15, 0, %0, c0, c0, 0   @ read control reg\n"
@@ -90,13 +88,8 @@ static int do_cpuinfo(int argc, char *argv[])
 		: "=r" (cache)
 		:
 		: "memory");
-
-	__asm__ __volatile__(
-		"mrc    p15, 0, %0, c1, c0, 0   @ read control reg\n"
-		: "=r" (cr)
-		:
-		: "memory");
 #endif
+	cr = get_cr();
 
 	switch (mainid >> 24) {
 	case 0x41:
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: use system.h's get_cr() for cpuinfo
  2019-10-07 10:28 [PATCH] ARM: use system.h's get_cr() for cpuinfo Ahmad Fatoum
@ 2019-10-14 10:11 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-10-14 10:11 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Oct 07, 2019 at 12:28:59PM +0200, Ahmad Fatoum wrote:
> Instead of open-coding the get_cr(), use the already available helper
> in <asm/system.h> same as we do for 64-bit ARMv8.
> The only difference is that the "memory" clobber is replaced by "cc".
> This is ok as we don't expect get_cr() to affect memory and because
> we do it elsewhere in barebox without a "memory" clobber already.
> 
> While at it, move it out the #if/#else clause as the helper changes
> behavior depending on the same CONFIG option anyway.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/cpu/cpuinfo.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-14 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 10:28 [PATCH] ARM: use system.h's get_cr() for cpuinfo Ahmad Fatoum
2019-10-14 10:11 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox