Commit c4a774c4 authored by Jani Nikula's avatar Jani Nikula

drm/i915: add for_each_port() and use it

Add another for_each style macro to the pile of custom looping macros.
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191101134333.11612-1-jani.nikula@intel.com
parent 7d148635
...@@ -1246,7 +1246,7 @@ static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin) ...@@ -1246,7 +1246,7 @@ static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin)
const struct ddi_vbt_port_info *info; const struct ddi_vbt_port_info *info;
enum port port; enum port port;
for (port = PORT_A; port < I915_MAX_PORTS; port++) { for_each_port(port) {
info = &i915->vbt.ddi_port_info[port]; info = &i915->vbt.ddi_port_info[port];
if (info->child && ddc_pin == info->alternate_ddc_pin) if (info->child && ddc_pin == info->alternate_ddc_pin)
...@@ -1297,7 +1297,7 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch) ...@@ -1297,7 +1297,7 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
const struct ddi_vbt_port_info *info; const struct ddi_vbt_port_info *info;
enum port port; enum port port;
for (port = PORT_A; port < I915_MAX_PORTS; port++) { for_each_port(port) {
info = &i915->vbt.ddi_port_info[port]; info = &i915->vbt.ddi_port_info[port];
if (info->child && aux_ch == info->alternate_aux_channel) if (info->child && aux_ch == info->alternate_aux_channel)
...@@ -1722,7 +1722,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) ...@@ -1722,7 +1722,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
!HAS_PCH_SPLIT(dev_priv)); !HAS_PCH_SPLIT(dev_priv));
DRM_DEBUG_KMS("Set default to SSC at %d kHz\n", dev_priv->vbt.lvds_ssc_freq); DRM_DEBUG_KMS("Set default to SSC at %d kHz\n", dev_priv->vbt.lvds_ssc_freq);
for (port = PORT_A; port < I915_MAX_PORTS; port++) { for_each_port(port) {
struct ddi_vbt_port_info *info = struct ddi_vbt_port_info *info =
&dev_priv->vbt.ddi_port_info[port]; &dev_priv->vbt.ddi_port_info[port];
...@@ -1736,7 +1736,7 @@ init_vbt_missing_defaults(struct drm_i915_private *dev_priv) ...@@ -1736,7 +1736,7 @@ init_vbt_missing_defaults(struct drm_i915_private *dev_priv)
{ {
enum port port; enum port port;
for (port = PORT_A; port < I915_MAX_PORTS; port++) { for_each_port(port) {
struct ddi_vbt_port_info *info = struct ddi_vbt_port_info *info =
&dev_priv->vbt.ddi_port_info[port]; &dev_priv->vbt.ddi_port_info[port];
enum phy phy = intel_port_to_phy(dev_priv, port); enum phy phy = intel_port_to_phy(dev_priv, port);
......
...@@ -333,8 +333,11 @@ enum phy_fia { ...@@ -333,8 +333,11 @@ enum phy_fia {
(__s) < RUNTIME_INFO(__dev_priv)->num_sprites[(__p)]; \ (__s) < RUNTIME_INFO(__dev_priv)->num_sprites[(__p)]; \
(__s)++) (__s)++)
#define for_each_port_masked(__port, __ports_mask) \ #define for_each_port(__port) \
for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++) \ for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++)
#define for_each_port_masked(__port, __ports_mask) \
for_each_port(__port) \
for_each_if((__ports_mask) & BIT(__port)) for_each_if((__ports_mask) & BIT(__port))
#define for_each_phy_masked(__phy, __phys_mask) \ #define for_each_phy_masked(__phy, __phys_mask) \
......
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