[PATCH v2 1/2] include: mdio: Add driver data helpers
From: Harini Katakam
Date: Wed Sep 04 2019 - 10:01:59 EST
Add set/get drv_data helpers for mdio device.
Signed-off-by: Harini Katakam <harini.katakam@xxxxxxxxxx>
---
v2:
Added this patch driver data helpers in mdio instead of priv field.
include/linux/mdio.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index e8242ad8..a760424 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -68,6 +68,17 @@ struct mdio_driver {
#define to_mdio_driver(d) \
container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv)
+/* device driver data */
+static inline void mdiodev_set_drvdata(struct mdio_device *mdio, void *data)
+{
+ dev_set_drvdata(&mdio->dev, data);
+}
+
+static inline void *mdiodev_get_drvdata(struct mdio_device *mdio)
+{
+ return dev_get_drvdata(&mdio->dev);
+}
+
void mdio_device_free(struct mdio_device *mdiodev);
struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);
int mdio_device_register(struct mdio_device *mdiodev);
--
2.7.4