On Wed, 02 Oct 2024, Thomas Hellström <thomas.hellst...@linux.intel.com> wrote:
> The ttm_device_init funcition uses multiple bool arguments. That means
> readability in the caller becomes poor, and all callers need to change if
> yet another bool is added.
>
> Instead use a struct with multiple single-bit flags. This addresses both
> problems. Prefer it over using defines or enums with explicit bit shifts,
> since converting to and from these bit values uses logical operations or
> tests which are implicit with the struct usage, and ofc type-checking.
>
> This is in preparation of adding yet another bool flag parameter to the
> function.

Funny, the other day Ville and I were throwing ideas around, and we
talked about something like this to implement keyword arguments in C. :)

Cheers,
Jani.


-- 
Jani Nikula, Intel

Reply via email to