Skip to content

Commit db0d69c

Browse files
committed
x86/boot/e820: Remove inverted boolean logic from the e820_nomerge() function name, rename it to e820_type_mergeable()
It's a bad practice to put inverted logic into function names, flip it back and rename it to e820_type_mergeable(). Add/update a few comments about this function while at it. Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: https://patch.msgid.link/20250515120549.2820541-2-mingo@kernel.org
1 parent adbf61c commit db0d69c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

arch/x86/kernel/e820.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,22 @@ static int __init cpcompare(const void *a, const void *b)
305305
return (ap->addr != ap->entry->addr) - (bp->addr != bp->entry->addr);
306306
}
307307

308-
static bool e820_nomerge(enum e820_type type)
308+
/*
309+
* Can two consecutive E820 entries of this same E820 type be merged?
310+
*/
311+
static bool e820_type_mergeable(enum e820_type type)
309312
{
310313
/*
311314
* These types may indicate distinct platform ranges aligned to
312-
* numa node, protection domain, performance domain, or other
315+
* NUMA node, protection domain, performance domain, or other
313316
* boundaries. Do not merge them.
314317
*/
315318
if (type == E820_TYPE_PRAM)
316-
return true;
319+
return false;
317320
if (type == E820_TYPE_SOFT_RESERVED)
318-
return true;
319-
return false;
321+
return false;
322+
323+
return true;
320324
}
321325

322326
int __init e820__update_table(struct e820_table *table)
@@ -394,7 +398,7 @@ int __init e820__update_table(struct e820_table *table)
394398
}
395399

396400
/* Continue building up new map based on this information: */
397-
if (current_type != last_type || e820_nomerge(current_type)) {
401+
if (current_type != last_type || !e820_type_mergeable(current_type)) {
398402
if (last_type) {
399403
new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr;
400404
/* Move forward only if the new size was non-zero: */

0 commit comments

Comments
 (0)