From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: netdev@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Simon Horman <simon.horman@corigine.com>,
Florian Fainelli <f.fainelli@gmail.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>,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH net v3 1/2] smsc911x: only update stats when interface is up
Date: Wed, 22 Mar 2023 08:19:58 +0100 [thread overview]
Message-ID: <20230322071959.9101-2-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20230322071959.9101-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")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes since v2:
* added tags
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-22 7:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 7:19 [PATCH net v3 0/2] smsc911x: fix issues when interface is not up yet Wolfram Sang
2023-03-22 7:19 ` Wolfram Sang [this message]
2023-03-23 18:39 ` [PATCH net v3 1/2] smsc911x: only update stats when interface is up Jakub Kicinski
2023-03-24 7:33 ` Wolfram Sang
2023-03-22 7:19 ` [PATCH net v3 2/2] smsc911x: avoid PHY being resumed when interface is not up Wolfram Sang
2023-03-22 20:20 ` Simon Horman
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=20230322071959.9101-2-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.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=simon.horman@corigine.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
all inboxes | Powered by JetHome®