From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Andrew Lunn <andrew+netdev@lunn.ch>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net: phy: fixed_phy: replace list of fixed PHYs with static array
Date: Fri, 9 Jan 2026 15:10:18 +0000 [thread overview]
Message-ID: <aWEaWvV_0SfylwW5@shell.armlinux.org.uk> (raw)
In-Reply-To: <20260108181102.4553d618@kernel.org>
On Thu, Jan 08, 2026 at 06:11:02PM -0800, Jakub Kicinski wrote:
> On Tue, 6 Jan 2026 17:56:26 +0100 Heiner Kallweit wrote:
> > +/* The DSA loop driver may allocate 4 fixed PHY's, and 4 additional
> > + * fixed PHY's for a system should be sufficient.
> > + */
> > +#define NUM_FP 8
> > +
> > struct fixed_phy {
> > - int addr;
> > struct phy_device *phydev;
> > struct fixed_phy_status status;
> > int (*link_update)(struct net_device *, struct fixed_phy_status *);
> > - struct list_head node;
> > };
> >
> > +static struct fixed_phy fmb_fixed_phys[NUM_FP];
> > static struct mii_bus *fmb_mii_bus;
> > -static LIST_HEAD(fmb_phys);
> > +static DEFINE_IDA(phy_fixed_ida);
>
> Isn't IDA an overkill for a range this tiny?
> IDA is useful if the ID range is large and may be sparse.
> Here a bitmap would suffice.
>
> DECLARE_BITMAP(phy_fixed_ids, NUM_FP);
>
> id = find_first_zero_bit(phy_fixed_ids, NUM_FP);
> if (id >= NUM_FP)
> return -ENOSPC;
>
> set_bit(id, phy_fixed_ids);
Racy without locking.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2026-01-09 15:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 16:56 [PATCH net-next] net: phy: fixed_phy: replace list of fixed PHYs with static array Heiner Kallweit
2026-01-06 17:51 ` Russell King (Oracle)
2026-01-09 2:11 ` Jakub Kicinski
2026-01-09 11:00 ` Heiner Kallweit
2026-01-09 14:43 ` Jakub Kicinski
2026-01-09 15:10 ` Russell King (Oracle) [this message]
2026-01-09 16:31 ` Jakub Kicinski
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=aWEaWvV_0SfylwW5@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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