Chunhao Lin <h...@realtek.com> :
[...]
> @@ -5878,6 +5881,20 @@ static void rtl_pcie_state_l2l3_enable(struct 
> rtl8169_private *tp, bool enable)
>       RTL_W8(Config3, data);
>  }
>  
> +static void rtl_hw_internal_aspm_clkreq_enable(struct rtl8169_private *tp,
> +                             bool enable)
> +{
> +     void __iomem *ioaddr = tp->mmio_addr;
> +
> +     if (enable) {
> +             RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
> +             RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
> +     } else {
> +             RTL_W8(Config2, RTL_R8(Config2) & ~ClkReqEn);
> +             RTL_W8(Config5, RTL_R8(Config5) & ~ASPM_en);
> +     }
> +}

s/enable(..., false)/disable()/

static void rtl_hw_internal_aspm_clkreq_enable(truct rtl8169_private *tp)
{
        void __iomem *ioaddr = tp->mmio_addr;

        RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
        RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
}

static void rtl_hw_internal_aspm_clkreq_disable(truct rtl8169_private *tp)
{
        void __iomem *ioaddr = tp->mmio_addr;

        RTL_W8(Config2, RTL_R8(Config2) & ~ClkReqEn);
        RTL_W8(Config5, RTL_R8(Config5) & ~ASPM_en);
}

If you really want to factor something out, you may use helpers that set
or clear bits according to the 3-uple (tp, register, bits) but
foo_enable(..., false) is pointlessly convoluted.

-- 
Ueimor

Reply via email to