Commit 79fc46df authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

drm/i915: Turn DEV_INFO_FLAGS into a foreach style macro

DEV_INFO_FOR_FLAG() now takes 2 parameters:
  • A function to apply to the flag
  • A separator

This will allow us to use the macro twice in the DRM_DEBUG_DRIVER() call
of i915_dump_device_info().

v2: Fix a typo in the subject (Jani Nikula)
v3: Undef the helper macros (Jani Nikula, Daniel vetter)
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 321a1b30
...@@ -61,11 +61,11 @@ static int i915_capabilities(struct seq_file *m, void *data) ...@@ -61,11 +61,11 @@ static int i915_capabilities(struct seq_file *m, void *data)
seq_printf(m, "gen: %d\n", info->gen); seq_printf(m, "gen: %d\n", info->gen);
seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev)); seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev));
#define DEV_INFO_FLAG(x) seq_printf(m, #x ": %s\n", yesno(info->x)) #define PRINT_FLAG(x) seq_printf(m, #x ": %s\n", yesno(info->x))
#define DEV_INFO_SEP ; #define SEP_SEMICOLON ;
DEV_INFO_FLAGS; DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG, SEP_SEMICOLON);
#undef DEV_INFO_FLAG #undef PRINT_FLAG
#undef DEV_INFO_SEP #undef SEP_SEMICOLON
return 0; return 0;
} }
......
...@@ -1445,15 +1445,15 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) ...@@ -1445,15 +1445,15 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
{ {
const struct intel_device_info *info = dev_priv->info; const struct intel_device_info *info = dev_priv->info;
#define DEV_INFO_FLAG(name) info->name ? #name "," : "" #define PRINT_FLAG(name) info->name ? #name "," : ""
#define DEV_INFO_SEP , #define SEP_COMMA ,
DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x flags=" DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x flags="
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
info->gen, info->gen,
dev_priv->dev->pdev->device, dev_priv->dev->pdev->device,
DEV_INFO_FLAGS); DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG, SEP_COMMA));
#undef DEV_INFO_FLAG #undef PRINT_FLAG
#undef DEV_INFO_SEP #undef SEP_COMMA
} }
/** /**
......
...@@ -333,31 +333,31 @@ struct drm_i915_gt_funcs { ...@@ -333,31 +333,31 @@ struct drm_i915_gt_funcs {
void (*force_wake_put)(struct drm_i915_private *dev_priv); void (*force_wake_put)(struct drm_i915_private *dev_priv);
}; };
#define DEV_INFO_FLAGS \ #define DEV_INFO_FOR_EACH_FLAG(func, sep) \
DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \ func(is_mobile) sep \
DEV_INFO_FLAG(is_i85x) DEV_INFO_SEP \ func(is_i85x) sep \
DEV_INFO_FLAG(is_i915g) DEV_INFO_SEP \ func(is_i915g) sep \
DEV_INFO_FLAG(is_i945gm) DEV_INFO_SEP \ func(is_i945gm) sep \
DEV_INFO_FLAG(is_g33) DEV_INFO_SEP \ func(is_g33) sep \
DEV_INFO_FLAG(need_gfx_hws) DEV_INFO_SEP \ func(need_gfx_hws) sep \
DEV_INFO_FLAG(is_g4x) DEV_INFO_SEP \ func(is_g4x) sep \
DEV_INFO_FLAG(is_pineview) DEV_INFO_SEP \ func(is_pineview) sep \
DEV_INFO_FLAG(is_broadwater) DEV_INFO_SEP \ func(is_broadwater) sep \
DEV_INFO_FLAG(is_crestline) DEV_INFO_SEP \ func(is_crestline) sep \
DEV_INFO_FLAG(is_ivybridge) DEV_INFO_SEP \ func(is_ivybridge) sep \
DEV_INFO_FLAG(is_valleyview) DEV_INFO_SEP \ func(is_valleyview) sep \
DEV_INFO_FLAG(is_haswell) DEV_INFO_SEP \ func(is_haswell) sep \
DEV_INFO_FLAG(has_force_wake) DEV_INFO_SEP \ func(has_force_wake) sep \
DEV_INFO_FLAG(has_fbc) DEV_INFO_SEP \ func(has_fbc) sep \
DEV_INFO_FLAG(has_pipe_cxsr) DEV_INFO_SEP \ func(has_pipe_cxsr) sep \
DEV_INFO_FLAG(has_hotplug) DEV_INFO_SEP \ func(has_hotplug) sep \
DEV_INFO_FLAG(cursor_needs_physical) DEV_INFO_SEP \ func(cursor_needs_physical) sep \
DEV_INFO_FLAG(has_overlay) DEV_INFO_SEP \ func(has_overlay) sep \
DEV_INFO_FLAG(overlay_needs_physical) DEV_INFO_SEP \ func(overlay_needs_physical) sep \
DEV_INFO_FLAG(supports_tv) DEV_INFO_SEP \ func(supports_tv) sep \
DEV_INFO_FLAG(has_bsd_ring) DEV_INFO_SEP \ func(has_bsd_ring) sep \
DEV_INFO_FLAG(has_blt_ring) DEV_INFO_SEP \ func(has_blt_ring) sep \
DEV_INFO_FLAG(has_llc) func(has_llc)
struct intel_device_info { struct intel_device_info {
u32 display_mmio_offset; u32 display_mmio_offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment