All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: andrew@lunn.ch
Cc: netdev@vger.kernel.org, Gerhard Engleder <gerhard@engleder-embedded.com>
Subject: [PATCH net-next v2 2/3] net: phy: Uniform PHY driver access
Date: Thu, 19 Aug 2021 15:11:53 +0200	[thread overview]
Message-ID: <20210819131154.6586-3-gerhard@engleder-embedded.com> (raw)
In-Reply-To: <20210819131154.6586-1-gerhard@engleder-embedded.com>

struct phy_device contains a pointer to the PHY driver and nearly
everywhere this pointer is used to access the PHY driver. Only
mdio_bus_phy_may_suspend() is still using to_phy_driver() instead of the
PHY driver pointer. Uniform PHY driver access by eliminating
to_phy_driver() use in mdio_bus_phy_may_suspend().

Only phy_bus_match() and phy_probe() are still using to_phy_driver(),
because PHY driver pointer is not available there.

Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
---
 drivers/net/phy/phy_device.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ba5ad86ec826..9e2891d8e8dd 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -233,11 +233,9 @@ static DEFINE_MUTEX(phy_fixup_lock);
 
 static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
 {
-	struct device_driver *drv = phydev->mdio.dev.driver;
-	struct phy_driver *phydrv = to_phy_driver(drv);
 	struct net_device *netdev = phydev->attached_dev;
 
-	if (!drv || !phydrv->suspend)
+	if (!phydev->drv->suspend)
 		return false;
 
 	/* PHY not attached? May suspend if the PHY has not already been
-- 
2.20.1


  parent reply	other threads:[~2021-08-19 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 13:11 [PATCH net-next v2 0/3] Add Xilinx GMII2RGMII loopback support Gerhard Engleder
2021-08-19 13:11 ` [PATCH net-next v2 1/3] net: phy: Support set_loopback override Gerhard Engleder
2021-08-19 13:11 ` Gerhard Engleder [this message]
2021-08-19 13:11 ` [PATCH net-next v2 3/3] net: phy: gmii2rgmii: Support PHY loopback Gerhard Engleder
2021-08-20 13:40 ` [PATCH net-next v2 0/3] Add Xilinx GMII2RGMII loopback support patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210819131154.6586-3-gerhard@engleder-embedded.com \
    --to=gerhard@engleder-embedded.com \
    --cc=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.