Skip to content

Commit a46604d

Browse files
hkallweitkuba-moo
authored andcommitted
r8169: improve rtl_ocp_reg_failure
Use WARN_ONCE here to get a call trace in case of a problem. This facilitates finding the offending code part. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5f1e122 commit a46604d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -812,14 +812,9 @@ static void rtl_eri_clear_bits(struct rtl8169_private *tp, int addr, u32 m)
812812
rtl_w0w1_eri(tp, addr, 0, m);
813813
}
814814

815-
static bool rtl_ocp_reg_failure(struct rtl8169_private *tp, u32 reg)
815+
static bool rtl_ocp_reg_failure(u32 reg)
816816
{
817-
if (reg & 0xffff0001) {
818-
if (net_ratelimit())
819-
netdev_err(tp->dev, "Invalid ocp reg %x!\n", reg);
820-
return true;
821-
}
822-
return false;
817+
return WARN_ONCE(reg & 0xffff0001, "Invalid ocp reg %x!\n", reg);
823818
}
824819

825820
DECLARE_RTL_COND(rtl_ocp_gphy_cond)
@@ -829,7 +824,7 @@ DECLARE_RTL_COND(rtl_ocp_gphy_cond)
829824

830825
static void r8168_phy_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
831826
{
832-
if (rtl_ocp_reg_failure(tp, reg))
827+
if (rtl_ocp_reg_failure(reg))
833828
return;
834829

835830
RTL_W32(tp, GPHY_OCP, OCPAR_FLAG | (reg << 15) | data);
@@ -839,7 +834,7 @@ static void r8168_phy_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
839834

840835
static int r8168_phy_ocp_read(struct rtl8169_private *tp, u32 reg)
841836
{
842-
if (rtl_ocp_reg_failure(tp, reg))
837+
if (rtl_ocp_reg_failure(reg))
843838
return 0;
844839

845840
RTL_W32(tp, GPHY_OCP, reg << 15);
@@ -850,15 +845,15 @@ static int r8168_phy_ocp_read(struct rtl8169_private *tp, u32 reg)
850845

851846
static void r8168_mac_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
852847
{
853-
if (rtl_ocp_reg_failure(tp, reg))
848+
if (rtl_ocp_reg_failure(reg))
854849
return;
855850

856851
RTL_W32(tp, OCPDR, OCPAR_FLAG | (reg << 15) | data);
857852
}
858853

859854
static u16 r8168_mac_ocp_read(struct rtl8169_private *tp, u32 reg)
860855
{
861-
if (rtl_ocp_reg_failure(tp, reg))
856+
if (rtl_ocp_reg_failure(reg))
862857
return 0;
863858

864859
RTL_W32(tp, OCPDR, reg << 15);

0 commit comments

Comments
 (0)