aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/mdio_device.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2020-06-26 17:53:25 +0200
committerDavid S. Miller <davem@davemloft.net>2020-06-26 13:40:09 -0700
commit96e263592bf12476b100a48ebdeb4b637bf48f9f (patch)
tree8b3d047cc2dffd7f0622dc79031c453211c466ad /drivers/net/phy/mdio_device.c
parentnet: phy: reset the PHY even if probe() is not implemented (diff)
downloadlinux-dev-96e263592bf12476b100a48ebdeb4b637bf48f9f.tar.xz
linux-dev-96e263592bf12476b100a48ebdeb4b637bf48f9f.zip
net: phy: mdio: reset MDIO devices even if probe() is not implemented
Similarily to PHY drivers - there's no reason to require probe() to be implemented in order to call mdio_device_reset(). MDIO devices can have resets defined without needing to do anything in probe(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.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>
Diffstat (limited to 'drivers/net/phy/mdio_device.c')
-rw-r--r--drivers/net/phy/mdio_device.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
index f60443e48622..be615504b829 100644
--- a/drivers/net/phy/mdio_device.c
+++ b/drivers/net/phy/mdio_device.c
@@ -150,10 +150,10 @@ static int mdio_probe(struct device *dev)
struct mdio_driver *mdiodrv = to_mdio_driver(drv);
int err = 0;
- if (mdiodrv->probe) {
- /* Deassert the reset signal */
- mdio_device_reset(mdiodev, 0);
+ /* Deassert the reset signal */
+ mdio_device_reset(mdiodev, 0);
+ if (mdiodrv->probe) {
err = mdiodrv->probe(mdiodev);
if (err) {
/* Assert the reset signal */
@@ -170,12 +170,11 @@ static int mdio_remove(struct device *dev)
struct device_driver *drv = mdiodev->dev.driver;
struct mdio_driver *mdiodrv = to_mdio_driver(drv);
- if (mdiodrv->remove) {
+ if (mdiodrv->remove)
mdiodrv->remove(mdiodev);
- /* Assert the reset signal */
- mdio_device_reset(mdiodev, 1);
- }
+ /* Assert the reset signal */
+ mdio_device_reset(mdiodev, 1);
return 0;
}