Linux EDAC development
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [v2,3/6] EDAC/amd64: Use a macro for iterating over Unified Memory Controllers
Date: Tue, 26 Feb 2019 22:53:27 +0100	[thread overview]
Message-ID: <20190226215327.GH14836@zn.tnic> (raw)

On Tue, Feb 26, 2019 at 05:25:46PM +0000, Ghannam, Yazen wrote:
> From: Yazen Ghannam <yazen.ghannam@amd.com>
> 
> Define and use a macro for looping over the number of Unified Memory
> Controllers.
> 
> No functional change.
> 
> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> ---
> Link:
> https://lkml.kernel.org/r/20190219202536.15462-2-Yazen.Ghannam@amd.com
> 
> v1->v2:
> * New in V2. Please see comment on Patch 2 V1 at link above.
> 
>  drivers/edac/amd64_edac.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 0038fcb0b010..c82aafb7246a 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -449,6 +449,9 @@ static void get_cs_base_and_mask(struct amd64_pvt *pvt, int csrow, u8 dct,
>  #define for_each_chip_select_mask(i, dct, pvt) \
>  	for (i = 0; i < pvt->csels[dct].m_cnt; i++)
>  
> +#define for_each_umc(i) \
> +	for (i = 0; i < num_umcs; i++)
> +
>  /*
>   * @input_addr is an InputAddr associated with the node given by mci. Return the
>   * csrow that input_addr maps to, or -1 on failure (no csrow claims input_addr).
> @@ -722,7 +725,7 @@ static unsigned long determine_edac_cap(struct amd64_pvt *pvt)
>  	if (pvt->umc) {
>  		u8 i, umc_en_mask = 0, dimm_ecc_en_mask = 0;
>  
> -		for (i = 0; i < num_umcs; i++) {
> +		for_each_umc(i) {

Hmm, maybe I didn't express myself as clearly as I should have, before.
Sorry about that.

But if you sort the patches this way:

1. Add for_each_umc() and convert code to use it
2. add num_umcs and convert for_each_umc() to use it

You won't have to touch the loops twice in patches 2 and 3 and your
diffstat will be a lot smaller.

Makes sense?

Thx.

             reply	other threads:[~2019-02-26 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 21:53 Borislav Petkov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-02-27 14:50 [v2,3/6] EDAC/amd64: Use a macro for iterating over Unified Memory Controllers Yazen Ghannam
2019-02-26 17:25 Yazen Ghannam

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=20190226215327.GH14836@zn.tnic \
    --to=bp@alien8.de \
    --cc=Yazen.Ghannam@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.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