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: Jakub Kicinski <kuba@kernel.org>
Date: 2026-01-09 16:31:31

On Fri, 9 Jan 2026 15:10:18 +0000 Russell King (Oracle) wrote:
quoted
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.
True, if there's no existing locking wrap it in a do {} while and use
test_and_set_bit() as the condition for repeat.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help