summaryrefslogtreecommitdiff
path: root/include/linux/mdio.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-22 13:21:47 +0200
committerJakub Kicinski <kuba@kernel.org>2025-05-27 17:35:25 -0700
commite9cb929670a1e98b592b30f03f06e9e20110f318 (patch)
tree4035bade65f568139fa8d238f9ecbc5e4321f177 /include/linux/mdio.h
parentcb575e5e9fd1cba99f1514c36375e74609f92e70 (diff)
downloadlwn-e9cb929670a1e98b592b30f03f06e9e20110f318.tar.gz
lwn-e9cb929670a1e98b592b30f03f06e9e20110f318.zip
net: phy: fix up const issues in to_mdio_device() and to_phy_device()
Both to_mdio_device() and to_phy_device() "throw away" the const pointer attribute passed to them and return a non-const pointer, which generally is not a good thing overall. Fix this up by using container_of_const() which was designed for this very problem. Cc: Alexander Lobakin <alobakin@pm.me> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Heiner Kallweit <hkallweit1@gmail.com> Cc: Russell King <linux@armlinux.org.uk> Fixes: 7eab14de73a8 ("mdio, phy: fix -Wshadow warnings triggered by nested container_of()") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/2025052246-conduit-glory-8fc9@gregkh Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/mdio.h')
-rw-r--r--include/linux/mdio.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 3c3deac57894..e43ff9f980a4 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -45,10 +45,7 @@ struct mdio_device {
unsigned int reset_deassert_delay;
};
-static inline struct mdio_device *to_mdio_device(const struct device *dev)
-{
- return container_of(dev, struct mdio_device, dev);
-}
+#define to_mdio_device(__dev) container_of_const(__dev, struct mdio_device, dev)
/* struct mdio_driver_common: Common to all MDIO drivers */
struct mdio_driver_common {