All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, davem@davemloft.net, andrew@lunn.ch,
	thomas.petazzoni@free-electrons.com
Subject: Re: [PATCH net] net: phy: Decrement phy_fixed_addr during unregister
Date: Fri, 24 Jun 2016 15:58:39 -0700	[thread overview]
Message-ID: <576DBB1F.1030208@gmail.com> (raw)
In-Reply-To: <20160624225527.GA1041@n2100.armlinux.org.uk>

On 06/24/2016 03:55 PM, Russell King - ARM Linux wrote:
> On Fri, Jun 24, 2016 at 03:44:11PM -0700, Florian Fainelli wrote:
>> If we have a system which uses fixed PHY devices and calls
>> fixed_phy_register() then fixed_phy_unregister() we can exhaust the
>> number of fixed PHYs available after a while, since we keep incrementing
>> the variable phy_fixed_addr, but we never decrement it.
>>
>> This patch fixes that by decrementing phy_fixed_addr during
>> fixed_phy_del(), and in order to do that, we need to move the
>> phy_fixed_addr integer and its spinlock above that function.
> 
> Is this really a good idea?

In the sense that it is symetrical to the register code, probably.

> 
> What if we have two fixed phys register, and the first one is
> unregistered and a new one subsequently registered?
> 
> First phy registered, gets address 0, phy_fixed_addr becomes 1.
> Second phy registered, gets address 1, phy_fixed_addr becomes 2.
> First phy is unregistered, phy_fixed_addr becomes 1.
> Third phy registered, gets address 1, conflicts with the second phy.
> 
> Obviously not a good outcome.
>

What would you suggest we do instead? Would switching to IDA/IDR give us
better results for instance (I have not looked too closely yet)?
-- 
Florian

  reply	other threads:[~2016-06-24 22:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 22:44 [PATCH net] net: phy: Decrement phy_fixed_addr during unregister Florian Fainelli
2016-06-24 22:55 ` Russell King - ARM Linux
2016-06-24 22:58   ` Florian Fainelli [this message]
2016-06-24 23:06     ` Russell King - ARM Linux
2016-06-24 23:18       ` Florian Fainelli

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=576DBB1F.1030208@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --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 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.