git: 7844e5a4fc0a - main - powerpc: change mfpvr return type to uint32_t

Leandro Lupori luporl at FreeBSD.org
Wed Jul 28 17:10:54 UTC 2021


The branch main has been updated by luporl:

URL: https://cgit.FreeBSD.org/src/commit/?id=7844e5a4fc0a925a53a7e1969d12a84d1baa970f

commit 7844e5a4fc0a925a53a7e1969d12a84d1baa970f
Author:     Leandro Lupori <luporl at FreeBSD.org>
AuthorDate: 2021-07-28 17:03:53 +0000
Commit:     Leandro Lupori <luporl at FreeBSD.org>
CommitDate: 2021-07-28 17:08:19 +0000

    powerpc: change mfpvr return type to uint32_t
    
    As the Processor Version Register (PVR) is a 32-bit PowerPC
    register, change mfpvr() return type to match it and avoid
    type casts on its callers.
    
    Suggested by:           jhibbits
    Reviewed by:            jhibbits, imp
    Sponsored by:           Instituto de Pesquisas Eldorado (eldorado.org.br)
    Differential Revision:  https://reviews.freebsd.org/D31332
---
 sys/dev/hwpmc/hwpmc_powerpc.c | 2 +-
 sys/powerpc/include/cpufunc.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c
index 407af94a07e1..0f14f93e6415 100644
--- a/sys/dev/hwpmc/hwpmc_powerpc.c
+++ b/sys/dev/hwpmc/hwpmc_powerpc.c
@@ -604,7 +604,7 @@ pmc_md_initialize()
 	}
 
 	/* Set the value for kern.hwpmc.cpuid */
-	snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08jx", (uintmax_t)mfpvr());
+	snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08x", mfpvr());
 
 	return (pmc_mdep);
 }
diff --git a/sys/powerpc/include/cpufunc.h b/sys/powerpc/include/cpufunc.h
index 7b0039166436..5ae2345bd717 100644
--- a/sys/powerpc/include/cpufunc.h
+++ b/sys/powerpc/include/cpufunc.h
@@ -125,10 +125,10 @@ mfdec(void)
 	return (value);
 }
 
-static __inline register_t
+static __inline uint32_t
 mfpvr(void)
 {
-	register_t value;
+	uint32_t value;
 
 	__asm __volatile ("mfpvr %0" : "=r"(value));
 


More information about the dev-commits-src-main mailing list