Re: [PATCH RFC] lib: simplify bitmap_from_u32array API

From: Yury Norov
Date: Tue Nov 21 2017 - 16:16:18 EST


Hi Matthew,

[+ Geert Uytterhoeven)

On Wed, Nov 15, 2017 at 07:24:15PM +0000, Matthew Wilcox wrote:
> I certainly approve. The name sucks too ð

Yep. I changed it, didn't resist.

> > @@ -60,7 +60,7 @@
> > * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
> > * bitmap_release_region(bitmap, pos, order) Free specified bit region
> > * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
> > - * bitmap_from_u32array(dst, nbits, buf, nwords) *dst = *buf (nwords 32b
> > words)
> > + * bitmap_from_u32array(dst, buf, nbits) *dst = *buf (nwords 32b
> > words)
>
> I think this should read:
> + * bitmap_from_u32array(dst, buf, bits) Copy 'bits' from buf to dst

Ack

> Also, on LE systems, shouldn't we just use memcpy() for the first bits/8 bytes?

Yes, but I did prefer to keep logic common for LE and BE arches. We
can switch to memcpy 32-bit LE and BE versions, see my thoughts below.