From: Andrew Lunn <andrew@lunn.ch>
To: Gerhard Engleder <gerhard@engleder-embedded.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 1/2] net: phy: Support set_loopback override
Date: Wed, 18 Aug 2021 23:20:18 +0200 [thread overview]
Message-ID: <YR15ku/FsZN55/Pi@lunn.ch> (raw)
In-Reply-To: <CANr-f5xL_H0GOQ7u6xsVxS--mKpM5zve6k-jcMKnqHBf+Bm9rg@mail.gmail.com>
> I saw only 4 references for to_phy_driver():
> - phy_loopback() of course
> - phy_probe() which uses it to initialize phydev->drv 3 lines later
This is correct. The driver core will set dev.driver to what it thinks
is the correct driver to use, before calling probe.
> - mdio_bus_phy_may_suspend() which checks only for valid suspend function
> pointer, but later phy_suspend() uses phydev->drv, so this is at
> least inconsistent
I guess the real question here is, can a device be suspended before it
is probed? It would seem rather odd. So i expect phydev->drv is safe
to use.
> - phy_bus_match() which casts from struct device_driver to struct phy_driver
This is used by the driver core when trying to find a matching
driver. So it is used before phy_probe(). So this is correct.
>
> phydev->drv is used much more often and seems to be the right way. I suggest to
> also fix mdio_bus_phy_may_suspend(). phy_probe() and phy_bus_match() are
> valid uses, because phydev->drv is not available for them.
>
> Do you agree?
Agreed. Thanks for spending the time to look at this. I was expecting
there to be more problems than just loopback.
Andrew
next prev parent reply other threads:[~2021-08-18 21:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 12:27 [PATCH net-next 0/2] Add Xilinx GMII2RGMII loopback support Gerhard Engleder
2021-08-18 12:27 ` [PATCH net-next 1/2] net: phy: Support set_loopback override Gerhard Engleder
2021-08-18 15:03 ` Andrew Lunn
2021-08-18 20:11 ` Gerhard Engleder
2021-08-18 21:20 ` Andrew Lunn [this message]
2021-08-18 12:27 ` [PATCH net-next 2/2] net: phy: gmii2rgmii: Support PHY loopback Gerhard Engleder
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=YR15ku/FsZN55/Pi@lunn.ch \
--to=andrew@lunn.ch \
--cc=gerhard@engleder-embedded.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).