From: "Christian König" <christian.koenig@amd.com>
To: Philipp Stanner <phasta@kernel.org>,
Lyude Paul <lyude@redhat.com>, Danilo Krummrich <dakr@kernel.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Sabrina Dubroca <sd@queasysnail.net>,
Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v2 2/2] drm/nouveau: nouveau_fence: Standardize list iterations
Date: Tue, 15 Apr 2025 14:28:58 +0200 [thread overview]
Message-ID: <d7ed5f0c-0511-4833-86c1-3e1bae579ef3@amd.com> (raw)
In-Reply-To: <20250415121900.55719-4-phasta@kernel.org>
Am 15.04.25 um 14:19 schrieb Philipp Stanner:
> nouveau_fence.c iterates over lists in a non-canonical way. Since the
> operations done are just basic for-each-loops, they should be written in
> the standard form.
>
> Use for_each_safe() instead of the custom loop iterations.
>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_fence.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
> index 6ded8c2b6d3b..60d961b43488 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_fence.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
> @@ -84,11 +84,12 @@ void
> nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
> {
> struct nouveau_fence *fence;
> + struct list_head *pos, *tmp;
> unsigned long flags;
>
> spin_lock_irqsave(&fctx->lock, flags);
> - while (!list_empty(&fctx->pending)) {
> - fence = list_entry(fctx->pending.next, typeof(*fence), head);
> + list_for_each_safe(pos, tmp, &fctx->pending) {
> + fence = list_entry(pos, struct nouveau_fence, head);
>
> if (error && !dma_fence_is_signaled_locked(&fence->base))
> dma_fence_set_error(&fence->base, error);
> @@ -131,11 +132,12 @@ static int
> nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
> {
> struct nouveau_fence *fence;
> + struct list_head *pos, *tmp;
> int drop = 0;
> u32 seq = fctx->read(chan);
>
> - while (!list_empty(&fctx->pending)) {
> - fence = list_entry(fctx->pending.next, typeof(*fence), head);
> + list_for_each_safe(pos, tmp, &fctx->pending) {
> + fence = list_entry(pos, struct nouveau_fence, head);
>
> if ((int)(seq - fence->base.seqno) < 0)
> break;
next prev parent reply other threads:[~2025-04-15 12:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 12:18 [PATCH v2 0/2] drm/nouveau: Don't set signaled fences' error codes Philipp Stanner
2025-04-15 12:19 ` [PATCH v2 1/2] drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill() Philipp Stanner
2025-04-23 15:54 ` Danilo Krummrich
2025-04-15 12:19 ` [PATCH v2 2/2] drm/nouveau: nouveau_fence: Standardize list iterations Philipp Stanner
2025-04-15 12:28 ` Christian König [this message]
2025-04-23 15:26 ` Danilo Krummrich
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=d7ed5f0c-0511-4833-86c1-3e1bae579ef3@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=phasta@kernel.org \
--cc=sd@queasysnail.net \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
/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
all inboxes | Powered by JetHome®