include: mdio: Add driver data helpers
authorHarini Katakam <harini.katakam@xilinx.com>
Wed, 4 Sep 2019 14:00:20 +0000 (19:30 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Sep 2019 10:32:05 +0000 (12:32 +0200)
Add set/get drv_data helpers for mdio device.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.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>
include/linux/mdio.h

index e8242ad88c81ea955ea4f1d8b04297692c00592f..a7604248777b7b0c499e4ece7435e8557990eb8d 100644 (file)
@@ -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);