drm/i915: Wrap the buf trans tables into a struct
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 8 Jun 2021 07:35:51 +0000 (10:35 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 23 Jun 2021 12:28:36 +0000 (15:28 +0300)
commit13cee3c123987aa27371b10c89409d7b26e2838a
tree25a19b433c4490205f32ed5bb9f19116632729eb
parent4542c6cff69e9229039e580862f8f33d163d9bea
drm/i915: Wrap the buf trans tables into a struct

Put a wrapper struct around the buf trans tables so that
we can declare the number of entries and default HDMI entry
alongside the table.

@wrap@
identifier old =~ "^.*translations.*";
fresh identifier new = "_" ## old;
type T;
@@
<...
static const T
- old
+ new
[] = {
       ...
};
+
+ static const struct intel_ddi_buf_trans old = {
+  .entries = new,
+  .num_entries = ARRAY_SIZE(new),
+ };
...>

@@
identifier wrap.old;
@@
(
- ARRAY_SIZE(old)
+ old.num_entries
|
- old
+ old.entries
)

@@
@@
union intel_ddi_buf_trans_entry {
...
};
+
+struct intel_ddi_buf_trans {
+       const union intel_ddi_buf_trans_entry *entries;
+       u8 num_entries;
+};

v2: Handle adl-p

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210608073603.2408-6-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h