linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH v1 1/1] drm/i915/selftests: Replace too verbose for-loop with simpler while
Date: Wed, 16 Feb 2022 10:55:11 +0200	[thread overview]
Message-ID: <87leyb5gy8.fsf@intel.com> (raw)
In-Reply-To: <Ygv32CptVknidyP3@smile.fi.intel.com>

On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Feb 15, 2022 at 07:14:49PM +0200, Jani Nikula wrote:
>> On Tue, 15 Feb 2022, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>> > It's hard to parse for-loop which has some magic calculations inside.
>> > Much cleaner to use while-loop directly.
>> 
>> I assume you're trying to prove a point following our recent
>> for-vs-while loop discussion. I really can't think of any other reason
>> you'd end up looking at this file or this loop.
>> 
>> With the change, the loop indeed becomes simpler, but it also runs one
>> iteration further than the original. Whoops.
>
> Yeah, sorry for that, the initial condition should be d = depth - 1,
> of course.

Well, no, the condition should be while (--i) instead to also match the
values the original loop takes. ;D

Cheers,
Jani.


>
>> It's a selftest. The loop's been there for five years. What are we
>> trying to achieve here? So we disagree on loops, fine. Perhaps this is
>> not the best use of either of our time? Please just let the for loops in
>> i915 be.
>
> Yes, I'm pretty much was sure that no-one will go and apply this anyway
> (so I haven't paid too much attention), but to prove my point in the
> certain discussion.
>
> And yes, the point is for the new code, I'm not going to change existing
> suboptimal and too hard to read for-loops, it will consume my time later
> when I will try to understand the code.

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-02-16  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 16:32 [PATCH v1 1/1] drm/i915/selftests: Replace too verbose for-loop with simpler while Andy Shevchenko
2022-02-15 17:14 ` Jani Nikula
2022-02-15 18:58   ` Andy Shevchenko
2022-02-16  8:55     ` Jani Nikula [this message]
2022-02-16  9:02       ` Geert Uytterhoeven

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=87leyb5gy8.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /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).