From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Christian König" <christian.koenig@amd.com>,
amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
nouveau@lists.freedesktop.org, spice-devel@lists.freedesktop.org,
dri-devel@lists.freedesktop.org,
"Zack Rusin" <zack.rusin@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com,
"Sui Jingfeng" <suijingfeng@loongson.cn>,
"Matthew Brost" <matthew.brost@intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>
Subject: Re: [PATCH v2 1/2] drm/ttm: Change ttm_device_init to use a struct instead of multiple bools
Date: Wed, 02 Oct 2024 15:56:44 +0300 [thread overview]
Message-ID: <874j5uu0hf.fsf@intel.com> (raw)
In-Reply-To: <20241002122422.287276-2-thomas.hellstrom@linux.intel.com>
On Wed, 02 Oct 2024, Thomas Hellström <thomas.hellstrom@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
next prev parent reply other threads:[~2024-10-02 12:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 12:24 [PATCH v2 0/2] drm/ttm: Add an option to report graphics memory OOM Thomas Hellström
2024-10-02 12:24 ` [PATCH v2 1/2] drm/ttm: Change ttm_device_init to use a struct instead of multiple bools Thomas Hellström
2024-10-02 12:45 ` Christian König
2024-10-02 12:54 ` Thomas Hellström
2024-10-04 14:28 ` Thomas Hellström
2024-10-05 4:14 ` Matthew Brost
2024-10-09 5:56 ` Thomas Hellström
2024-10-02 12:56 ` Jani Nikula [this message]
2024-10-03 4:28 ` Zack Rusin
2024-10-04 14:22 ` Thomas Hellström
2024-10-02 12:24 ` [PATCH v2 2/2] drm/ttm: Add a device flag to propagate -ENOSPC on OOM Thomas Hellström
2024-10-02 13:46 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874j5uu0hf.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=nouveau@lists.freedesktop.org \
--cc=spice-devel@lists.freedesktop.org \
--cc=suijingfeng@loongson.cn \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=zack.rusin@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).