Commit a277f383 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jason Gunthorpe

IB/mthca: Use bitmap_set() when applicable

The 'alloc->table' bitmap has just been allocated, so this is safe to use
the faster and non-atomic 'bitmap_set()' function. There is no need to
hand-write it.

Link: https://lore.kernel.org/r/f1bd33f6ea6c8ad519a222db6e9aa17c55610557.1637785902.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 12d1e2f3
...@@ -79,8 +79,6 @@ void mthca_free(struct mthca_alloc *alloc, u32 obj) ...@@ -79,8 +79,6 @@ void mthca_free(struct mthca_alloc *alloc, u32 obj)
int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask, int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask,
u32 reserved) u32 reserved)
{ {
int i;
/* num must be a power of 2 */ /* num must be a power of 2 */
if (num != 1 << (ffs(num) - 1)) if (num != 1 << (ffs(num) - 1))
return -EINVAL; return -EINVAL;
...@@ -94,8 +92,7 @@ int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask, ...@@ -94,8 +92,7 @@ int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask,
if (!alloc->table) if (!alloc->table)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < reserved; ++i) bitmap_set(alloc->table, 0, reserved);
set_bit(i, alloc->table);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment