From: Markus Elfring <Markus.Elfring@web.de>
To: Yazen Ghannam <yazen.ghannam@amd.com>,
Borislav Petkov <bp@alien8.de>,
linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
Avadhut Naik <avadhut.naik@amd.com>,
Christophe Jaillet <christophe.jaillet@wanadoo.fr>,
John Allen <john.allen@amd.com>,
Muralidhara M K <muralidhara.mk@amd.com>,
Tony Luck <tony.luck@intel.com>,
William Roche <william.roche@oracle.com>
Subject: Re: [PATCH v4 1/3] RAS: Introduce AMD Address Translation Library
Date: Wed, 20 Dec 2023 18:28:07 +0100 [thread overview]
Message-ID: <b472d62b-47f9-428b-b5a9-9b3c526f487c@web.de> (raw)
In-Reply-To: <20231218190406.27479-2-yazen.ghannam@amd.com>
…
> +++ b/drivers/ras/amd/atl/map.c
> @@ -0,0 +1,667 @@
…
> +static int get_coh_st_fabric_id(struct addr_ctx *ctx)
> +{
…
> + if (df_cfg.rev < DF4p5)
> + ctx->coh_st_fabric_id = FIELD_GET(DF2_COH_ST_FABRIC_ID, reg);
> + else
> + ctx->coh_st_fabric_id = FIELD_GET(DF4p5_COH_ST_FABRIC_ID, reg);
…
> +}
…
Is the following statement variant a bit nicer?
ctx->coh_st_fabric_id = FIELD_GET((df_cfg.rev < DF4p5)
? DF2_COH_ST_FABRIC_ID
: DF4p5_COH_ST_FABRIC_ID,
reg);
> +static bool valid_map(struct addr_ctx *ctx)
> +{
> + if (df_cfg.rev >= DF4)
> + return FIELD_GET(DF_ADDR_RANGE_VAL, ctx->map.ctl);
> + else
> + return FIELD_GET(DF_ADDR_RANGE_VAL, ctx->map.base);
> +}
…
Can the following statement variant be integrated instead?
return FIELD_GET(DF_ADDR_RANGE_VAL, (df_cfg.rev >= DF4) ? ctx->map.ctl : ctx->map.base);
> +int get_address_map(struct addr_ctx *ctx)
> +{
> + int ret = 0;
> +
> + ret = get_address_map_common(ctx);
> + if (ret)
> + goto out;
> +
> + ret = get_global_map_data(ctx);
> + if (ret)
> + goto out;
> +
> + dump_address_map(&ctx->map);
> +
> +out:
> + return ret;
> +}
…
Would you like to use a function implementation like the following instead?
int get_address_map(struct addr_ctx *ctx)
{
int ret = get_address_map_common(ctx);
if (ret)
return ret;
ret = get_global_map_data(ctx);
if (ret)
return ret;
dump_address_map(&ctx->map);
return 0;
}
See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.7-rc6#n532
Regards,
Markus
next prev parent reply other threads:[~2023-12-20 17:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 19:04 [PATCH v4 0/3] AMD Address Translation Library Yazen Ghannam
2023-12-18 19:04 ` [PATCH v4 1/3] RAS: Introduce " Yazen Ghannam
2023-12-18 19:21 ` Christophe JAILLET
2023-12-18 21:53 ` Yazen Ghannam
2023-12-19 16:07 ` Borislav Petkov
2023-12-19 16:39 ` Borislav Petkov
2023-12-19 16:57 ` Borislav Petkov
2023-12-20 15:45 ` Markus Elfring
2023-12-20 16:15 ` Markus Elfring
2023-12-20 17:28 ` Markus Elfring [this message]
2023-12-28 17:16 ` Borislav Petkov
2023-12-18 19:04 ` [PATCH v4 2/3] EDAC/amd64: Use new " Yazen Ghannam
2023-12-18 19:04 ` [PATCH v4 3/3] Documentation: RAS: Add index and address translation section Yazen Ghannam
2024-01-03 10:59 ` [PATCH v4 0/3] AMD Address Translation Library Borislav Petkov
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=b472d62b-47f9-428b-b5a9-9b3c526f487c@web.de \
--to=markus.elfring@web.de \
--cc=avadhut.naik@amd.com \
--cc=bp@alien8.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=john.allen@amd.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=tony.luck@intel.com \
--cc=william.roche@oracle.com \
--cc=yazen.ghannam@amd.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