Re: [PATCH] drm/i915: Reduce duplicated switch cases in hpd code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 4, 2020 at 10:23 AM Ville Syrjala
<ville.syrjala@xxxxxxxxxxxxxxx> wrote:
>
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>
> With GEN11_HOTPLUG_CTL_LONG_DETECT(), SHOTPLUG_CTL_DDI_HPD_LONG_DETECT()
> and ICP_TC_HPD_LONG_DETECT() taking the hpd_pin as their argument
> we can remove some duplication in the long_detect() switch statements.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 19 +++----------------
>  1 file changed, 3 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index b245109f73e3..491f82500d68 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1044,17 +1044,12 @@ static bool gen11_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
>  {
>         switch (pin) {
>         case HPD_PORT_TC1:

case HPD_PORT_TC1 ... HPD_PORT_TC6
?

in any case,

Reviewed-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>

Lucas De Marchi

> -               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC1);
>         case HPD_PORT_TC2:
> -               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC2);
>         case HPD_PORT_TC3:
> -               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC3);
>         case HPD_PORT_TC4:
> -               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC4);
>         case HPD_PORT_TC5:
> -               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC5);
>         case HPD_PORT_TC6:
> -               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC6);
> +               return val & GEN11_HOTPLUG_CTL_LONG_DETECT(pin);
>         default:
>                 return false;
>         }
> @@ -1078,13 +1073,10 @@ static bool icp_ddi_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
>  {
>         switch (pin) {
>         case HPD_PORT_A:
> -               return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_A);
>         case HPD_PORT_B:
> -               return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_B);
>         case HPD_PORT_C:
> -               return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_C);
>         case HPD_PORT_D:
> -               return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_D);
> +               return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(pin);
>         default:
>                 return false;
>         }
> @@ -1094,17 +1086,12 @@ static bool icp_tc_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
>  {
>         switch (pin) {
>         case HPD_PORT_TC1:
> -               return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC1);
>         case HPD_PORT_TC2:
> -               return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC2);
>         case HPD_PORT_TC3:
> -               return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC3);
>         case HPD_PORT_TC4:
> -               return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC4);
>         case HPD_PORT_TC5:
> -               return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC5);
>         case HPD_PORT_TC6:
> -               return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC6);
> +               return val & ICP_TC_HPD_LONG_DETECT(pin);
>         default:
>                 return false;
>         }
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux