From: Linus Walleij <linus.walleij@linaro.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH] of: mdio: Support fixed links in of_phy_get_and_connect()
Date: Sun, 12 Aug 2018 13:54:08 +0200 [thread overview]
Message-ID: <CACRpkdb_moz2076y2Wcu88BqEOuKkKvj4seZt+-1v0+LYbaW8w@mail.gmail.com> (raw)
In-Reply-To: <20180711200452.GD21430@lunn.ch>
On Wed, Jul 11, 2018 at 10:04 PM Andrew Lunn <andrew@lunn.ch> wrote:
> What probably make sense as a followup is add a
> of_phy_disconnect_and_put(). When the module is unloaded, you leak a
> fixed link, because of_phy_deregister_fixed_link() is not being
> called.
I looked at this but I get a bit confused. How to handle
cleanup of the fixed link is pretty straight forward, I'm more
concerned with the proper (today non-existing) way to clean
up after of_phy_connect() that is called for all instances.
This calls phy_connect_direct() that then does this:
/* refcount is held by phy_connect_direct() on success */
put_device(&phy->mdio.dev);
Which seems like wrong - it should keep holding that until
we do of_phy_disconnect_and_put() in that case.
The above seems like some hack, i.e. we are using the
MDIO without holding a reference or something, so it
can go away cleanly later.
Or do I have it wrong?
It's confusing, I guess these PHY's don't come and go
very much so the plug/play part isn't really exercised.
> You also hold a reference to np which does not appear to be
> released.
That seems to be covered as there is a of_node_put(phy_np);
at the end of this function already.
Balancing of_node_get()/put() is another area where there
is not (AFAICT) much stringency in the kernel. I loosely
believe this is mostly for dynamic device trees (so you do not
delete a node that is in use e.g.) and people don't use that
very much (or at all). I think most systems shut down with
a bunch of OF nodes held. :/
(Yeah another universe of cleanups the day we need it
to work.)
Yours,
Linus Walleij
next prev parent reply other threads:[~2018-08-12 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 17:45 [PATCH] of: mdio: Support fixed links in of_phy_get_and_connect() Linus Walleij
2018-07-11 20:04 ` Andrew Lunn
2018-08-12 11:54 ` Linus Walleij [this message]
2018-08-12 17:24 ` Andrew Lunn
2018-07-14 1:25 ` 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=CACRpkdb_moz2076y2Wcu88BqEOuKkKvj4seZt+-1v0+LYbaW8w@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.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).