From: Florian Fainelli <f.fainelli@gmail.com>
To: Shawn Guo <shawn.guo@freescale.com>, Fabio Estevam <festevam@gmail.com>
Cc: "Ezequiel Garcia" <ezequiel.garcia@free-electrons.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"David Miller" <davem@davemloft.net>,
"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
"Gregory Clement" <gregory.clement@free-electrons.com>,
"Marek Vašut" <marex@denx.de>,
"Sascha Hauer" <kernel@pengutronix.de>,
"Russell King" <linux@arm.linux.org.uk>
Subject: Re: [PATCH v2 1/2] net: phy: Set the driver when registering an MDIO bus device
Date: Mon, 04 Aug 2014 21:01:06 -0700 [thread overview]
Message-ID: <53E05702.9000007@gmail.com> (raw)
In-Reply-To: <20140805032257.GD2167@dragon>
On 08/04/14 20:22, Shawn Guo wrote:
> On Mon, Aug 04, 2014 at 11:55:22PM -0300, Fabio Estevam wrote:
>> Hi Ezequiel,
>>
>> On Wed, Jul 23, 2014 at 4:47 PM, Ezequiel Garcia
>> <ezequiel.garcia@free-electrons.com> wrote:
>>> mdiobus_register() registers a device which is already bound to a driver.
>>> Hence, the driver pointer should be set properly in order to track down
>>> the driver associated to the MDIO bus.
>>>
>>> This will be used to allow ethernet driver to pin down a MDIO bus driver,
>>> preventing it from being unloaded while the PHY device is running.
>>>
>>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>>> Tested-by: Florian Fainelli <f.fainelli@gmail.com>
>>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>>> ---
>>> drivers/net/phy/mdio_bus.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
>>> index 4eaadcf..203651e 100644
>>> --- a/drivers/net/phy/mdio_bus.c
>>> +++ b/drivers/net/phy/mdio_bus.c
>>> @@ -255,6 +255,7 @@ int mdiobus_register(struct mii_bus *bus)
>>>
>>> bus->dev.parent = bus->parent;
>>> bus->dev.class = &mdio_bus_class;
>>> + bus->dev.driver = bus->parent->driver;
>>> bus->dev.groups = NULL;
>>> dev_set_name(&bus->dev, "%s", bus->id);
>>
>> This patches causes the following regression in 3.16 (tested on mx5/mx6):
>
> The change will trigger a device_suspend() call on mii_bus device with
> the pm suspend/resume callbacks being fec driver ones, since
> bus->parent->driver points to fec driver.
>
> So net result is fec_suspend() will be called twice during suspend, once
> in mii_bus device context and the other in fec device context. In fec
> context, it works just fine. And the issue we're seeing is from mii_bus
> device context, where the driver_data of the device is invalid.
>
> I do not think fec_suspend() should be called in mii_bus device context.
Right, that does not sound like a good thing to do. Does it work if you
call pm_suspend_ignore_children() either in the FEC driver or in
mdiobus_register()?
I am not exactly sure what the best solution looks like at this point
>
> Shawn
>
next prev parent reply other threads:[~2014-08-05 4:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 19:47 [PATCH v2 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use Ezequiel Garcia
2014-07-23 19:47 ` [PATCH v2 1/2] net: phy: Set the driver when registering an MDIO bus device Ezequiel Garcia
2014-08-05 2:55 ` Fabio Estevam
2014-08-05 3:22 ` Shawn Guo
2014-08-05 4:01 ` Florian Fainelli [this message]
2014-08-05 4:41 ` Shawn Guo
2014-08-05 10:43 ` Ezequiel Garcia
2014-08-05 11:02 ` Fabio Estevam
2014-07-23 19:47 ` [PATCH v2 2/2] net: phy: Ensure the MDIO bus module is held Ezequiel Garcia
2014-07-23 21:46 ` Florian Fainelli
2014-07-25 1:10 ` [PATCH v2 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use David Miller
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=53E05702.9000007@gmail.com \
--to=f.fainelli@gmail.com \
--cc=davem@davemloft.net \
--cc=ezequiel.garcia@free-electrons.com \
--cc=festevam@gmail.com \
--cc=gregory.clement@free-electrons.com \
--cc=kernel@pengutronix.de \
--cc=linux@arm.linux.org.uk \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
--cc=shawn.guo@freescale.com \
--cc=thomas.petazzoni@free-electrons.com \
/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).