All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Switch <kyle.switch@motor-comm.com>
To: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	mmyangfl@gmail.com, horms@kernel.org, linux@armlinux.org.uk,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ming.xu@motor-comm.com, xiaolin.xu@motor-comm.com,
	jianmin.wang@motor-comm.com, wei.zhang@gl-inet.com,
	sijia.huang@gl-inet.com
Subject: [PATCH net-next v5 4/6] net: dsa: motorcomm: introduce mib_init to control MIB polling initialization
Date: Fri,  4 Sep 2026 17:54:14 +0800	[thread overview]
Message-ID: <20260904095416.1692962-4-kyle.switch@motor-comm.com> (raw)
In-Reply-To: <20260904095416.1692962-1-kyle.switch@motor-comm.com>

Add a mib_init flag to indicate whether MIB polling has been
successfully initialized. This prevents the driver from attempting
to clean up MIB-related resources on removal for switch families
that do not support MIB polling, which would otherwise trigger
errors or crashes.

Signed-off-by: Kyle Switch <kyle.switch@motor-comm.com>
---
 drivers/net/dsa/motorcomm/chip.c | 2 ++
 drivers/net/dsa/motorcomm/chip.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index f74a44048fb1..df5c0b995fde 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -4559,6 +4559,7 @@ static int yt921x_dsa_setup(struct dsa_switch *ds)
 
 		pp->index = i;
 		INIT_DELAYED_WORK(&pp->mib_read, yt921x_poll_mib);
+		pp->mib_init = true;
 	}
 
 	mutex_lock(&priv->reg_lock);
@@ -4771,6 +4772,7 @@ static void yt921x_mdio_remove(struct mdio_device *mdiodev)
 	for (size_t i = ARRAY_SIZE(priv->ports); i-- > 0; ) {
 		struct yt921x_port *pp = &priv->ports[i];
 
+		if (pp->mib_init)
 			disable_delayed_work_sync(&pp->mib_read);
 	}
 
diff --git a/drivers/net/dsa/motorcomm/chip.h b/drivers/net/dsa/motorcomm/chip.h
index 65f9e6234678..6c89e3d304fa 100644
--- a/drivers/net/dsa/motorcomm/chip.h
+++ b/drivers/net/dsa/motorcomm/chip.h
@@ -943,6 +943,7 @@ struct yt921x_port {
 	struct yt921x_mib mib;
 	u64 rx_frames;
 	u64 tx_frames;
+	bool mib_init;
 
 #if IS_ENABLED(CONFIG_NET_DSA_YT921X_LEDS)
 	unsigned char led_duty;
-- 
2.25.1


  parent reply	other threads:[~2026-09-04  9:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  9:54 [PATCH net-next v5 1/6] net: dsa: motorcomm: refactor registration path for upcoming switch families Kyle Switch
2026-09-04  9:54 ` [PATCH net-next v5 2/6] net: dsa: motorcomm: use max_ports from series_info for port bounds checking Kyle Switch
2026-09-04 13:32   ` Andrew Lunn
2026-09-06  1:47     ` Kyle Switch
2026-09-04  9:54 ` [PATCH net-next v5 3/6] net: dsa: motorcomm: relocate MIB polling initialization to dsa_setup() Kyle Switch
2026-09-04 13:37   ` Andrew Lunn
2026-09-06  1:56     ` Kyle Switch
2026-09-04 13:48   ` Andrew Lunn
2026-09-06  1:54     ` Kyle Switch
2026-09-04 17:13   ` David Yang
2026-09-06  2:12     ` Kyle Switch
2026-09-04  9:54 ` Kyle Switch [this message]
2026-09-04 13:45   ` [PATCH net-next v5 4/6] net: dsa: motorcomm: introduce mib_init to control MIB polling initialization Andrew Lunn
2026-09-06  2:00     ` Kyle Switch
2026-09-04  9:54 ` [PATCH net-next v5 5/6] net: dsa: tag_922x: add support for Motorcomm YT922x tags Kyle Switch
2026-09-04 17:22   ` David Yang
2026-09-04 13:14 ` [PATCH net-next v5 1/6] net: dsa: motorcomm: refactor registration path for upcoming switch families Andrew Lunn
2026-09-04 17:03 ` David Yang
2026-09-06  2:08   ` Kyle Switch
2026-09-06 18:31     ` David Yang
2026-09-07  3:00     ` Andrew Lunn
2026-09-07  6:44       ` Kyle Switch

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=20260904095416.1692962-4-kyle.switch@motor-comm.com \
    --to=kyle.switch@motor-comm.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jianmin.wang@motor-comm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ming.xu@motor-comm.com \
    --cc=mmyangfl@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sijia.huang@gl-inet.com \
    --cc=wei.zhang@gl-inet.com \
    --cc=xiaolin.xu@motor-comm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.