Thread (7 messages) 7 messages, 3 authors, 2026-01-09

Re: [PATCH net-next] net: phy: fixed_phy: replace list of fixed PHYs with static array

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2026-01-09 15:10:26

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:
quoted
+/* 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!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help