Thread (3 messages) flat view 3 messages, 3 authors, 2018-06-04

Re: [PATCH] powerpc/xive: Remove (almost) unused macros

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-05-14 03:30:31

Russell Currey [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index b48454be5b98..3b471c0193ca 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -341,7 +341,7 @@ static void xive_native_update_pending(struct xive_cpu *xc)
 	 * of the hypervisor interrupt (if any)
 	 */
 	cppr = ack & 0xff;
-	he = GETFIELD(TM_QW3_NSR_HE, (ack >> 8));
+	he = ((ack >> 8) & TM_QW3_NSR_HE) >> (ffs(TM_QW3_NSR_HE) - 1);
Using the #defines and ffs() here doesn't make the code any more
readable or maintainable.

We can just write:

	he = ack >> 14;

Or if we want to be more explicit about it being the top two bits of the
2nd byte:

	he = (ack >> 8) >> 6;


cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help