Re: [PATCH v7 5/8] x86/e820: Refactor e820__range_remove

From: Dave Hansen
Date: Tue Apr 26 2022 - 11:13:45 EST


On 4/25/22 10:15, Martin Fernandez wrote:
> +/**
> + * e820__range_remove() - Remove an address range from e820_table.
> + * @start: Start of the address range.
> + * @size: Size of the address range.
> + * @old_type: Type of the entries that we want to remove.
> + * @check_type: Bool to decide if ignore @old_type or not.
> + *
> + * Remove [@start, @start + @size) from e820_table. If @check_type is
> + * true remove only entries with type @old_type.
> + *
> + * Return: The size removed.
> + */

The refactoring looks promising. But, there's a *LOT* of kerneldoc
noise, like:

> + * @table: Target e820_table.
> + * @start: Start of the range.
> + * @size: Size of the range.

and this:

> + * struct e820_type_updater_data - Helper type for
> + * __e820__range_update().
> + * @old_type: old_type parameter of __e820__range_update().
> + * @new_type: new_type parameter of __e820__range_update().

Those are just a pure waste of bytes. I suspect some more judicious
function comments would also make the diffstat look more palatable.

Also, in general, the naming is a bit verbose. You might want to trim
some of those names down, like:

> +static bool __init crypto_updater__should_update(const struct e820_entry *entry,
> + const void *data)
> +{
> + const struct e820_crypto_updater_data *crypto_updater_data =
> + (const struct e820_crypto_updater_data *)data;

Those are just some high-level comments. This also needs some really
careful review of the refactoring to make sure that it doesn't break any
of the existing e820 users.