All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] phylib: mdio: handle register/unregister/register sequence
Date: Thu, 22 Aug 2013 08:27:57 -0700	[thread overview]
Message-ID: <20130822152757.GA23163@kroah.com> (raw)
In-Reply-To: <1377174836-10569-1-git-send-email-b.brezillon@overkiz.com>

On Thu, Aug 22, 2013 at 02:33:56PM +0200, Boris BREZILLON wrote:
> Hello,
> 
> This patch is a proposal to support the register/unregister/register
> sequence on a given mdio bus.
> 
> I use the register/unregister/register sequence to add a fallback when the
> of_mdiobus_register (this function calls mdiobus_register with phy_mask
> set to ~0) does not register any phy device (because the device tree does
> not define any phy).
> In this case I call mdiobus_unregister and then call mdiobus_register with
> a phy_mask set to 0 to trigger a full mdio bus scan.
> 
> I'm not sure this is the right way to do it (this is why I added RFC in the
> subject).
> 
> Could someone help me figuring out what I should use to implement my fallback ?
> 
> 1) use the register/unregister/register sequence

That will not work.  Well, you might think it would work, but then
things randomly start breaking later on.  Try it with the
KOBJECT_DELAYED_DESTROY build option in linux-next, and watch things go
"boom" :)

The rule is, you should never register a kobject/struct device that you
have previously unregistered before, as you really don't know if
unregistering has finished or not.

sorry,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Boris BREZILLON <b.brezillon@overkiz.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Mark Brown <broonie@kernel.org>,
	Nick Bowler <nbowler@elliptictech.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH] phylib: mdio: handle register/unregister/register sequence
Date: Thu, 22 Aug 2013 08:27:57 -0700	[thread overview]
Message-ID: <20130822152757.GA23163@kroah.com> (raw)
In-Reply-To: <1377174836-10569-1-git-send-email-b.brezillon@overkiz.com>

On Thu, Aug 22, 2013 at 02:33:56PM +0200, Boris BREZILLON wrote:
> Hello,
> 
> This patch is a proposal to support the register/unregister/register
> sequence on a given mdio bus.
> 
> I use the register/unregister/register sequence to add a fallback when the
> of_mdiobus_register (this function calls mdiobus_register with phy_mask
> set to ~0) does not register any phy device (because the device tree does
> not define any phy).
> In this case I call mdiobus_unregister and then call mdiobus_register with
> a phy_mask set to 0 to trigger a full mdio bus scan.
> 
> I'm not sure this is the right way to do it (this is why I added RFC in the
> subject).
> 
> Could someone help me figuring out what I should use to implement my fallback ?
> 
> 1) use the register/unregister/register sequence

That will not work.  Well, you might think it would work, but then
things randomly start breaking later on.  Try it with the
KOBJECT_DELAYED_DESTROY build option in linux-next, and watch things go
"boom" :)

The rule is, you should never register a kobject/struct device that you
have previously unregistered before, as you really don't know if
unregistering has finished or not.

sorry,

greg k-h

  parent reply	other threads:[~2013-08-22 15:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22 12:33 [RFC PATCH] phylib: mdio: handle register/unregister/register sequence Boris BREZILLON
2013-08-22 12:33 ` Boris BREZILLON
2013-08-22 12:34 ` Boris BREZILLON
2013-08-22 12:34   ` Boris BREZILLON
2013-08-22 12:43 ` Florian Fainelli
2013-08-22 12:43   ` Florian Fainelli
2013-08-22 13:05   ` boris brezillon
2013-08-22 13:05     ` boris brezillon
2013-08-22 13:05     ` boris brezillon
2013-08-22 13:15     ` Florian Fainelli
2013-08-22 13:15       ` Florian Fainelli
2013-08-22 13:24       ` boris brezillon
2013-08-22 13:24         ` boris brezillon
2013-08-22 13:14 ` boris brezillon
2013-08-22 13:14   ` boris brezillon
2013-08-22 13:14   ` boris brezillon
2013-08-22 15:27 ` Greg Kroah-Hartman [this message]
2013-08-22 15:27   ` Greg Kroah-Hartman
2013-08-22 15:38   ` boris brezillon
2013-08-22 15:38     ` boris brezillon

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=20130822152757.GA23163@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.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.