public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Mark Rutland <mark.rutland@arm.com>,
	Ilkka Koskinen <ilkka@os.amperecomputing.com>
Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, jeremy.linton@arm.com,
	renyu.zj@linux.alibaba.com
Subject: Re: [PATCH 2/3] perf/arm-cmn: Rework DTC counters (again)
Date: Mon, 23 Oct 2023 15:14:09 +0100	[thread overview]
Message-ID: <37b9a97e-4142-4f6f-85c9-7d90abb8f334@arm.com> (raw)
In-Reply-To: <ZTY3ieLQaRQ4dHYP@FVFF77S0Q05N>

On 2023-10-23 10:06, Mark Rutland wrote:
> On Fri, Oct 20, 2023 at 03:50:30PM -0700, Ilkka Koskinen wrote:
>> Hi Robin,
>>
>> I have one comment, otherwise the patch looks good to me.
> 
>>> +/* @i is the DTC number, @idx is the counter index on that DTC */
>>> +#define for_each_hw_dtc_idx(hw, i, idx) \
>>> +	for (int i = 0, idx; i < CMN_MAX_DTCS; i++) if ((idx = hw->dtc_idx[i]) >= 0)
>>
>> Isn't that "idx" unnecessary in the initialization?
> 
> That creates the 'idx' variable that's assigned to by `idx = hw->dtc_idx[i]`,
> so that is necessary.

Right, the intent is to take advantage of locally-scoped iterator 
variables since they're a nice thing, but completely-implicit 
definitions aren't so nice (at best they'd be surprising, at worst they 
could confusingly shadow existing variables in the outer scope), so the 
macro invoker still provides their names to at least give some visible 
context to their use within the loop body.

I guess this is still a fairly new paradigm since the C11 switch, and 
I'm not aware of any "standard" style for such iterator macros yet, so I 
just did what seemed most logical.

Thanks,
Robin.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-10-23 14:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 17:51 [PATCH 0/3] perf/arm-cmn: Multi-DTC improvements Robin Murphy
2023-10-20 17:51 ` [PATCH 1/3] perf/arm-cmn: Fix DTC domain detection Robin Murphy
2023-10-20 22:45   ` Ilkka Koskinen
2023-10-20 17:51 ` [PATCH 2/3] perf/arm-cmn: Rework DTC counters (again) Robin Murphy
2023-10-20 22:50   ` Ilkka Koskinen
2023-10-23  9:06     ` Mark Rutland
2023-10-23 14:14       ` Robin Murphy [this message]
2023-10-25  3:18       ` Ilkka Koskinen
2023-10-20 22:53   ` Ilkka Koskinen
2023-10-23 10:26   ` Will Deacon
2023-10-20 17:51 ` [PATCH 3/3] perf/arm-cmn: Enable per-DTC counter allocation Robin Murphy
2023-10-20 23:00   ` Ilkka Koskinen
2023-10-23 14:39 ` [PATCH 0/3] perf/arm-cmn: Multi-DTC improvements Will Deacon

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=37b9a97e-4142-4f6f-85c9-7d90abb8f334@arm.com \
    --to=robin.murphy@arm.com \
    --cc=ilkka@os.amperecomputing.com \
    --cc=jeremy.linton@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=renyu.zj@linux.alibaba.com \
    --cc=will@kernel.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