Skip to content

Commit f01dbd7

Browse files
committed
powerpc/fsl: Modernise mt/mfpmr
With the addition of the machine directives, these are no longer simple 1-2 liner macros. So modernise them to be static inlines and use named asm parameters. Acked-by: Segher Boessenkool <segher@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240229122521.762431-4-mpe@ellerman.id.au
1 parent 5f49135 commit f01dbd7

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

arch/powerpc/include/asm/reg_fsl_emb.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,27 @@
1111

1212
#ifndef __ASSEMBLY__
1313
/* Performance Monitor Registers */
14-
#define mfpmr(rn) ({unsigned int rval; \
15-
asm volatile(".machine push; " \
16-
".machine e300; " \
17-
"mfpmr %0," __stringify(rn) ";" \
18-
".machine pop; " \
19-
: "=r" (rval)); rval;})
20-
#define mtpmr(rn, v) asm volatile(".machine push; " \
21-
".machine e300; " \
22-
"mtpmr " __stringify(rn) ",%0; " \
23-
".machine pop; " \
24-
: : "r" (v))
14+
static inline unsigned int mfpmr(unsigned int rn)
15+
{
16+
unsigned int rval;
17+
18+
asm (".machine push; "
19+
".machine e300; "
20+
"mfpmr %[rval], %[rn];"
21+
".machine pop;"
22+
: [rval] "=r" (rval) : [rn] "i" (rn));
23+
24+
return rval;
25+
}
26+
27+
static inline void mtpmr(unsigned int rn, unsigned int val)
28+
{
29+
asm (".machine push; "
30+
".machine e300; "
31+
"mtpmr %[rn], %[val];"
32+
".machine pop;"
33+
: [val] "=r" (val) : [rn] "i" (rn));
34+
}
2535
#endif /* __ASSEMBLY__ */
2636

2737
/* Freescale Book E Performance Monitor APU Registers */

0 commit comments

Comments
 (0)