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

Michael Ellerman mpe at ellerman.id.au
Mon May 14 13:30:30 AEST 2018


Russell Currey <ruscur at russell.cc> writes:
> 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


More information about the Linuxppc-dev mailing list