linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Vladimir Oltean <vladimir.oltean@nxp.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 07/29] net: mdio: introduce a shutdown method to mdio device drivers
Date: Fri,  8 Oct 2021 13:27:54 +0200	[thread overview]
Message-ID: <20211008112717.178523331@linuxfoundation.org> (raw)
In-Reply-To: <20211008112716.914501436@linuxfoundation.org>

From: Vladimir Oltean <vladimir.oltean@nxp.com>

[ Upstream commit cf9579976f724ad517cc15b7caadea728c7e245c ]

MDIO-attached devices might have interrupts and other things that might
need quiesced when we kexec into a new kernel. Things are even more
creepy when those interrupt lines are shared, and in that case it is
absolutely mandatory to disable all interrupt sources.

Moreover, MDIO devices might be DSA switches, and DSA needs its own
shutdown method to unlink from the DSA master, which is a new
requirement that appeared after commit 2f1e8ea726e9 ("net: dsa: link
interfaces with the DSA master to get rid of lockdep warnings").

So introduce a ->shutdown method in the MDIO device driver structure.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/phy/mdio_device.c | 11 +++++++++++
 include/linux/mdio.h          |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
index 0837319a52d7..797c41f5590e 100644
--- a/drivers/net/phy/mdio_device.c
+++ b/drivers/net/phy/mdio_device.c
@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev)
 	return 0;
 }
 
+static void mdio_shutdown(struct device *dev)
+{
+	struct mdio_device *mdiodev = to_mdio_device(dev);
+	struct device_driver *drv = mdiodev->dev.driver;
+	struct mdio_driver *mdiodrv = to_mdio_driver(drv);
+
+	if (mdiodrv->shutdown)
+		mdiodrv->shutdown(mdiodev);
+}
+
 /**
  * mdio_driver_register - register an mdio_driver with the MDIO layer
  * @drv: new mdio_driver to register
@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv)
 	mdiodrv->driver.bus = &mdio_bus_type;
 	mdiodrv->driver.probe = mdio_probe;
 	mdiodrv->driver.remove = mdio_remove;
+	mdiodrv->driver.shutdown = mdio_shutdown;
 
 	retval = driver_register(&mdiodrv->driver);
 	if (retval) {
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index dbd69b3d170b..de5fb4b333ce 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -72,6 +72,9 @@ struct mdio_driver {
 
 	/* Clears up any memory if needed */
 	void (*remove)(struct mdio_device *mdiodev);
+
+	/* Quiesces the device on system shutdown, turns off interrupts etc */
+	void (*shutdown)(struct mdio_device *mdiodev);
 };
 #define to_mdio_driver(d)						\
 	container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv)
-- 
2.33.0




  parent reply	other threads:[~2021-10-08 11:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 11:27 [PATCH 5.10 00/29] 5.10.72-rc1 review Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 01/29] spi: rockchip: handle zero length transfers without timing out Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 02/29] platform/x86: touchscreen_dmi: Add info for the Chuwi HiBook (CWI514) tablet Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 03/29] platform/x86: touchscreen_dmi: Update info for the Chuwi Hi10 Plus (CWI527) tablet Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 04/29] nfsd: back channel stuck in SEQ4_STATUS_CB_PATH_DOWN Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 05/29] btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 06/29] btrfs: fix mount failure due to past and transient device flush error Greg Kroah-Hartman
2021-10-08 11:27 ` Greg Kroah-Hartman [this message]
2021-10-08 11:27 ` [PATCH 5.10 08/29] xen-netback: correct success/error reporting for the SKB-with-fraglist case Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 09/29] sparc64: fix pci_iounmap() when CONFIG_PCI is not set Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 10/29] ext2: fix sleeping in atomic bugs on error Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 11/29] scsi: sd: Free scsi_disk device via put_device() Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.10 12/29] usb: testusb: Fix for showing the connection speed Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 13/29] usb: dwc2: check return value after calling platform_get_resource() Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 14/29] habanalabs/gaudi: fix LBW RR configuration Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 15/29] selftests: be sure to make khdr before other targets Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 16/29] selftests:kvm: fix get_warnings_count() ignoring fscanf() return warn Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 17/29] nvme-fc: update hardware queues before using them Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 18/29] nvme-fc: avoid race between time out and tear down Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 19/29] thermal/drivers/tsens: Fix wrong check for tzd in irq handlers Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 20/29] scsi: ses: Retry failed Send/Receive Diagnostic commands Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 21/29] irqchip/gic: Work around broken Renesas integration Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 22/29] smb3: correct smb3 ACL security descriptor Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 23/29] tools/vm/page-types: remove dependency on opt_file for idle page tracking Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 24/29] selftests: KVM: Align SMCCC call with the spec in steal_time Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 25/29] KVM: do not shrink halt_poll_ns below grow_start Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 26/29] kvm: x86: Add AMD PMU MSRs to msrs_to_save_all[] Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 27/29] KVM: x86: nSVM: restore int_vector in svm_clear_vintr Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 28/29] perf/x86: Reset destroy callback on event init failure Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.10 29/29] libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD Greg Kroah-Hartman
2021-10-08 14:28 ` [PATCH 5.10 00/29] 5.10.72-rc1 review Fox Chen
2021-10-08 19:40 ` Florian Fainelli
2021-10-08 20:46 ` Shuah Khan
2021-10-08 20:47 ` Pavel Machek
2021-10-08 21:04 ` Guenter Roeck
2021-10-09  4:24 ` Naresh Kamboju

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=20211008112717.178523331@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vladimir.oltean@nxp.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;
as well as URLs for NNTP newsgroup(s).