[Intel-gfx] [PATCH 1/2] drm/i915: Reduce trickery in DEV_INFO_FOR_EACH_FLAG

Chris Wilson chris at chris-wilson.co.uk
Tue Oct 4 13:23:30 UTC 2016


On Tue, Oct 04, 2016 at 03:42:57PM +0300, Joonas Lahtinen wrote:
>  #define PRINT_S(name) "%s"
> -#define SEP_EMPTY
> -#define PRINT_FLAG(name) info->name ? #name "," : ""
> -#define SEP_COMMA ,
> +#define PRINT_FLAG(name) info->name ? #name "," : "",
>  	DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x rev=0x%02x flags="
> -			 DEV_INFO_FOR_EACH_FLAG(PRINT_S, SEP_EMPTY),
> +			 DEV_INFO_FOR_EACH_FLAG(PRINT_S) "%s",
>  			 info->gen,
>  			 dev_priv->drm.pdev->device,
>  			 dev_priv->drm.pdev->revision,
> -			 DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG, SEP_COMMA));
> +			 DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG)
> +			 "");

Why did we need the trailing fmt + arg? Oh. PRINT_FLAG has the trailing
'.' so needs a sentinel.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list