• Ville Syrjälä's avatar
    drm/i915: Nuke intel_digital_port->port · 8f4f2797
    Ville Syrjälä authored
    Remove intel_digital_port->port and replace its users with
    intel_encoder->port. intel_encoder->port is a superset of
    intel_digital_port->port, and it works correctly even for
    MST encoders.
    
    v2: Eliminate a few dp_to_dig_port()->base.port cases too (DK)
    
    Performed with cocci:
    @@
    @@
    struct intel_digital_port {
           ...
    -       enum port port;
           ...
    }
    
    @@
    struct intel_digital_port *D;
    expression E;
    @@
    - D->port = E;
    
    @@
    struct intel_digital_port *D;
    @@
    - D->port
    + D->base.port
    
    @
    expression E;
    @@
    (
    - dp_to_dig_port(E)->port
    + dp_to_dig_port(E)->base.port
    |
    - enc_to_dig_port(E)->port
    + to_intel_encoder(E)->port
    )
    
    @@
    expression E;
    @@
    - to_intel_encoder(&E->base)
    + E
    
    @@
    struct intel_digital_port *D;
    identifier I, M;
    @@
      I = &D->base
    <...
    (
    - D->base.M
    + I->M
    |
    - &D->base
    + I
    )
    ...>
    
    @@
    identifier D;
    expression E;
    identifier M;
    @@
     D = enc_to_dig_port(&E->base)
    <...
    (
    - D->base.M
    + E->M
    |
    - &D->base
    + E
    )
    ...>
    
    @@
    identifier D, DP;
    expression E;
    identifier M;
    @@
     DP = enc_to_intel_dp(&E->base)
    <...
    (
    - dp_to_dig_port(DP)->base.M
    + E->M
    |
    - &dp_to_dig_port(DP)->base
    + E
    )
    ...>
    
    @@
    expression E;
    identifier M;
    @@
    (
    - enc_to_dig_port(&E->base)->base.M
    + E->M
    |
    - enc_to_dig_port(&E->base)->base
    + E
    |
    - enc_to_mst(&E->base)->primary->base.port
    + E->port
    )
    
    @@
    expression E;
    identifier D;
    @@
    - struct intel_digital_port *D = E;
    ... when != D
    
    Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
    Reviewed-by: default avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
    Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20171109152434.32074-1-ville.syrjala@linux.intel.com
    8f4f2797
intel_dp_mst.c 19.3 KB