Re: [PATCH v2 6/6] bitmap: move bitmap_*_region functions to bitmap.h

From: Andy Shevchenko
Date: Fri Aug 11 2023 - 05:28:02 EST


On Thu, Aug 10, 2023 at 05:57:32PM -0700, Yury Norov wrote:
> Now that bitmap_*_region() functions are implemented as thin wrappers
> around others, it's worth to move them to the header, as it opens room
> for compile-time optimizations.

...

> + * Return 0 on success, or %-EBUSY if specified region wasn't
> + * free (not all bits were zero).

Run

scripts/kernel-doc -v -none -Wall

against this

...

> + * Return the bit offset in bitmap of the allocated region,
> + * or -errno on failure.

Ditto.

...

> +static inline int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)
> +{
> + unsigned int pos, end; /* scans bitmap by regions of size order */
> +
> + for (pos = 0 ; (end = pos + BIT(order)) <= bits; pos = end)

Extra space.

> + if (!bitmap_allocate_region(bitmap, pos, order))
> + return pos;
> +
> + return -ENOMEM;
> +}

...

> +/**
> + * bitmap_release_region - release allocated bitmap region
> + * @bitmap: array of unsigned longs corresponding to the bitmap
> + * @pos: beginning of bit region to release
> + * @order: region size (log base 2 of number of bits) to release
> + *
> + * This is the complement to __bitmap_find_free_region() and releases
> + * the found region (by clearing it in the bitmap).

> + * No return value.

Useless line.

> + */

...

Seems like the original code has all these, perhaps update in a separate patch?

--
With Best Regards,
Andy Shevchenko