From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: netdev@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Steve Glendinning <steve.glendinning@shawell.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH net v2 1/2] smsc911x: only update stats when interface is up
Date: Mon, 20 Mar 2023 10:20:40 +0100 [thread overview]
Message-ID: <20230320092041.1656-2-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20230320092041.1656-1-wsa+renesas@sang-engineering.com>
Otherwise the clocks are not enabled and reading registers will BUG.
Fixes: 1e30b8d755b8 ("net: smsc911x: Make Runtime PM handling more fine-grained")
Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Changes since v1:
* patch is not a revert but a proper fix this time
drivers/net/ethernet/smsc/smsc911x.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index a2e511912e6a..67cb5eb9c716 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1838,8 +1838,12 @@ smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
static struct net_device_stats *smsc911x_get_stats(struct net_device *dev)
{
struct smsc911x_data *pdata = netdev_priv(dev);
- smsc911x_tx_update_txcounters(dev);
- dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP);
+
+ if (netif_running(dev)) {
+ smsc911x_tx_update_txcounters(dev);
+ dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP);
+ }
+
return &dev->stats;
}
--
2.30.2
next prev parent reply other threads:[~2023-03-20 9:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 9:20 [PATCH net v2 0/2] smsc911x: fix issues when interface is not up yet Wolfram Sang
2023-03-20 9:20 ` Wolfram Sang [this message]
2023-03-20 16:32 ` [PATCH net v2 1/2] smsc911x: only update stats when interface is up Simon Horman
2023-03-21 16:59 ` Florian Fainelli
2023-03-20 9:20 ` [PATCH net v2 2/2] smsc911x: avoid PHY being resumed when interface is not up Wolfram Sang
2023-03-20 16:33 ` Simon Horman
2023-03-21 14:39 ` Paolo Abeni
2023-03-21 17:56 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230320092041.1656-2-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steve.glendinning@shawell.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).