Commit 43b39834 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'r8169-small-improvements'

Heiner Kallweit says:

====================
r8169: small improvements

This series includes a number of smaller improvements.

v2:
- return on WARN in patch 1
====================

Link: https://lore.kernel.org/r/938caef4-8a0b-bbbd-66aa-76f758ff877a@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 4b9c9358 bb703e57
...@@ -763,7 +763,9 @@ static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask, ...@@ -763,7 +763,9 @@ static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
{ {
u32 cmd = ERIAR_WRITE_CMD | type | mask | addr; u32 cmd = ERIAR_WRITE_CMD | type | mask | addr;
BUG_ON((addr & 3) || (mask == 0)); if (WARN(addr & 3 || !mask, "addr: 0x%x, mask: 0x%08x\n", addr, mask))
return;
RTL_W32(tp, ERIDR, val); RTL_W32(tp, ERIDR, val);
r8168fp_adjust_ocp_cmd(tp, &cmd, type); r8168fp_adjust_ocp_cmd(tp, &cmd, type);
RTL_W32(tp, ERIAR, cmd); RTL_W32(tp, ERIAR, cmd);
...@@ -810,14 +812,9 @@ static void rtl_eri_clear_bits(struct rtl8169_private *tp, int addr, u32 m) ...@@ -810,14 +812,9 @@ static void rtl_eri_clear_bits(struct rtl8169_private *tp, int addr, u32 m)
rtl_w0w1_eri(tp, addr, 0, m); rtl_w0w1_eri(tp, addr, 0, m);
} }
static bool rtl_ocp_reg_failure(struct rtl8169_private *tp, u32 reg) static bool rtl_ocp_reg_failure(u32 reg)
{ {
if (reg & 0xffff0001) { return WARN_ONCE(reg & 0xffff0001, "Invalid ocp reg %x!\n", reg);
if (net_ratelimit())
netdev_err(tp->dev, "Invalid ocp reg %x!\n", reg);
return true;
}
return false;
} }
DECLARE_RTL_COND(rtl_ocp_gphy_cond) DECLARE_RTL_COND(rtl_ocp_gphy_cond)
...@@ -827,7 +824,7 @@ DECLARE_RTL_COND(rtl_ocp_gphy_cond) ...@@ -827,7 +824,7 @@ DECLARE_RTL_COND(rtl_ocp_gphy_cond)
static void r8168_phy_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data) static void r8168_phy_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
{ {
if (rtl_ocp_reg_failure(tp, reg)) if (rtl_ocp_reg_failure(reg))
return; return;
RTL_W32(tp, GPHY_OCP, OCPAR_FLAG | (reg << 15) | data); RTL_W32(tp, GPHY_OCP, OCPAR_FLAG | (reg << 15) | data);
...@@ -837,7 +834,7 @@ static void r8168_phy_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data) ...@@ -837,7 +834,7 @@ static void r8168_phy_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
static int r8168_phy_ocp_read(struct rtl8169_private *tp, u32 reg) static int r8168_phy_ocp_read(struct rtl8169_private *tp, u32 reg)
{ {
if (rtl_ocp_reg_failure(tp, reg)) if (rtl_ocp_reg_failure(reg))
return 0; return 0;
RTL_W32(tp, GPHY_OCP, reg << 15); RTL_W32(tp, GPHY_OCP, reg << 15);
...@@ -848,7 +845,7 @@ static int r8168_phy_ocp_read(struct rtl8169_private *tp, u32 reg) ...@@ -848,7 +845,7 @@ static int r8168_phy_ocp_read(struct rtl8169_private *tp, u32 reg)
static void r8168_mac_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data) static void r8168_mac_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
{ {
if (rtl_ocp_reg_failure(tp, reg)) if (rtl_ocp_reg_failure(reg))
return; return;
RTL_W32(tp, OCPDR, OCPAR_FLAG | (reg << 15) | data); RTL_W32(tp, OCPDR, OCPAR_FLAG | (reg << 15) | data);
...@@ -856,7 +853,7 @@ static void r8168_mac_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data) ...@@ -856,7 +853,7 @@ static void r8168_mac_ocp_write(struct rtl8169_private *tp, u32 reg, u32 data)
static u16 r8168_mac_ocp_read(struct rtl8169_private *tp, u32 reg) static u16 r8168_mac_ocp_read(struct rtl8169_private *tp, u32 reg)
{ {
if (rtl_ocp_reg_failure(tp, reg)) if (rtl_ocp_reg_failure(reg))
return 0; return 0;
RTL_W32(tp, OCPDR, reg << 15); RTL_W32(tp, OCPDR, reg << 15);
...@@ -4895,7 +4892,7 @@ static void rtl_shutdown(struct pci_dev *pdev) ...@@ -4895,7 +4892,7 @@ static void rtl_shutdown(struct pci_dev *pdev)
rtl_wol_shutdown_quirk(tp); rtl_wol_shutdown_quirk(tp);
} }
pci_wake_from_d3(pdev, true); pci_wake_from_d3(pdev, tp->saved_wolopts);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
} }
} }
......
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