hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/net/phy/xilinx_gmii2rgmii.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /* Xilinx GMII2RGMII Converter driver
23 *
34 * Copyright (C) 2016 Xilinx, Inc.
....@@ -8,16 +9,6 @@
89 *
910 * Description:
1011 * This driver is developed for Xilinx GMII2RGMII Converter
11
- *
12
- * This program is free software: you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation, either version 2 of the License, or
15
- * (at your option) any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
2112 */
2213 #include <linux/module.h>
2314 #include <linux/kernel.h>
....@@ -38,7 +29,7 @@
3829
3930 static int xgmiitorgmii_read_status(struct phy_device *phydev)
4031 {
41
- struct gmii2rgmii *priv = phydev->priv;
32
+ struct gmii2rgmii *priv = mdiodev_get_drvdata(&phydev->mdio);
4233 struct mii_bus *bus = priv->mdio->bus;
4334 int addr = priv->mdio->addr;
4435 u16 val = 0;
....@@ -91,6 +82,7 @@
9182
9283 if (!priv->phy_dev->drv) {
9384 dev_info(dev, "Attached phy not ready\n");
85
+ put_device(&priv->phy_dev->mdio.dev);
9486 return -EPROBE_DEFER;
9587 }
9688
....@@ -99,7 +91,7 @@
9991 memcpy(&priv->conv_phy_drv, priv->phy_dev->drv,
10092 sizeof(struct phy_driver));
10193 priv->conv_phy_drv.read_status = xgmiitorgmii_read_status;
102
- priv->phy_dev->priv = priv;
94
+ mdiodev_set_drvdata(&priv->phy_dev->mdio, priv);
10395 priv->phy_dev->drv = &priv->conv_phy_drv;
10496
10597 return 0;