mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
move mt76_wcid_alloc to core
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -79,4 +79,26 @@ bool __mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__mt76_poll_msec);
|
||||
|
||||
int mt76_wcid_alloc(unsigned long *mask, int size)
|
||||
{
|
||||
int i, idx = 0, cur;
|
||||
|
||||
for (i = 0; i < size / BITS_PER_LONG; i++) {
|
||||
idx = ffs(~mask[i]);
|
||||
if (!idx)
|
||||
continue;
|
||||
|
||||
idx--;
|
||||
cur = i * BITS_PER_LONG + idx;
|
||||
if (cur >= size)
|
||||
break;
|
||||
|
||||
mask[i] |= BIT(idx);
|
||||
return cur;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_wcid_alloc);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
Reference in New Issue
Block a user