From: Linus Walleij <linusw@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Woojung Huh <woojung.huh@microchip.com>
Cc: UNGLinuxDriver@microchip.com, netdev@vger.kernel.org,
Linus Walleij <linusw@kernel.org>
Subject: [PATCH net v3 1/5] net: dsa: ks8995: Add shutdown callback
Date: Thu, 19 Feb 2026 15:24:17 +0100 [thread overview]
Message-ID: <20260219-ks8995-fixups-v3-1-a7fc63fe1916@kernel.org> (raw)
In-Reply-To: <20260219-ks8995-fixups-v3-0-a7fc63fe1916@kernel.org>
The DSA framework requires that dsa_switch_shutdown() be
called when the driver is shut down.
Make sure to also implement the mutual exclusion required
by checking the platform data pointer to be NULL in
.remove() and .shutdown().
Fixes: a7fe8b266f65 ("net: dsa: ks8995: Add basic switch set-up")
Reported-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
drivers/net/dsa/ks8995.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/dsa/ks8995.c b/drivers/net/dsa/ks8995.c
index 77d8b842693c..2522c9057382 100644
--- a/drivers/net/dsa/ks8995.c
+++ b/drivers/net/dsa/ks8995.c
@@ -833,11 +833,26 @@ static void ks8995_remove(struct spi_device *spi)
{
struct ks8995_switch *ks = spi_get_drvdata(spi);
+ if (!ks)
+ return;
+
dsa_unregister_switch(ks->ds);
/* assert reset */
gpiod_set_value_cansleep(ks->reset_gpio, 1);
}
+static void ks8995_shutdown(struct spi_device *spi)
+{
+ struct ks8995_switch *ks = spi_get_drvdata(spi);
+
+ if (!ks)
+ return;
+
+ dsa_switch_shutdown(ks->ds);
+
+ spi_set_drvdata(spi, NULL);
+}
+
/* ------------------------------------------------------------------------ */
static struct spi_driver ks8995_driver = {
.driver = {
@@ -846,6 +861,7 @@ static struct spi_driver ks8995_driver = {
},
.probe = ks8995_probe,
.remove = ks8995_remove,
+ .shutdown = ks8995_shutdown,
.id_table = ks8995_id,
};
--
2.53.0
next prev parent reply other threads:[~2026-02-19 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 14:24 [PATCH net v3 0/5] net: dsa: ks8995: Post-move fixes Linus Walleij
2026-02-19 14:24 ` Linus Walleij [this message]
2026-02-19 14:24 ` [PATCH net v3 2/5] net: dsa: microchip: Add fallback Micrel compatibles Linus Walleij
2026-02-19 14:24 ` [PATCH net v3 3/5] net: dsa: ks8955: Delete KSZ8864 and KSZ8795 support Linus Walleij
2026-02-19 14:24 ` [PATCH net v3 4/5] net: dsa: ks8995: Add stub bridge join/leave Linus Walleij
2026-02-19 14:24 ` [PATCH net v3 5/5] net: dsa: ks8995: Implement port isolation Linus Walleij
2026-02-20 18:45 ` Vladimir Oltean
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=20260219-ks8995-fixups-v3-1-a7fc63fe1916@kernel.org \
--to=linusw@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=woojung.huh@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox