Re: [RFC PATCH 1/5] entry: Pass pt_regs to irqentry_exit_cond_resched()

From: Dave Hansen
Date: Mon Aug 08 2022 - 13:44:13 EST


On 8/8/22 10:38, Borislav Petkov wrote:
> On Mon, Aug 08, 2022 at 10:34:19AM -0700, Ira Weiny wrote:
>> I thought about that but generally have been steered away from using bool
>> arguments like this.
> The reason being?

Might have been me. Function calls that look like this:

foo(&ptr, false, true, false, true, 1, 0);

are incomprehensible. A true/false is effectively a magic number here
and you have to go looking at the code implementing 'foo()' or at least
the declaration hoping that the variable names help (if the declaration
has variable names).

I think I've encouraged Ira to do something like this instead:

enum foo_mode {
MODE_BAR,
MODE_BAZ
}

where the call ends up looking like:

foo(&ptr, MODE_BAR);

which is much more self-documenting.