From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: <shiju.jose@huawei.com>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>,
<tanxiaofei@huawei.com>, <prime.zeng@hisilicon.com>,
<linuxarm@huawei.com>
Subject: Re: [PATCH v2 5/7] hw/cxl/cxl-mailbox-utils: Move declaration of scrub and ECS feature attributes in cmd_features_set_feature()
Date: Fri, 20 Jun 2025 15:16:55 +0100 [thread overview]
Message-ID: <20250620151655.00001cea@huawei.com> (raw)
In-Reply-To: <20250619151619.1695-6-shiju.jose@huawei.com>
On Thu, 19 Jun 2025 16:16:17 +0100
<shiju.jose@huawei.com> wrote:
> From: Shiju Jose <shiju.jose@huawei.com>
>
> Move the declaration of scrub and ECS feature attributes in cmd_features_set_feature()
> to the local scope where they are used.
>
> Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Local scope is fine, but I'm fairly sure that style wise these
files always use variable declarations at start of scope (except
for when g_auto_free is in use where it gets more complex).
> ---
> hw/cxl/cxl-mailbox-utils.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index 4d0c0b3edc..83668d7d93 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -1459,10 +1459,6 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
> CXLCCI *cci)
> {
> CXLSetFeatureInHeader *hdr = (void *)payload_in;
> - CXLMemPatrolScrubWriteAttrs *ps_write_attrs;
> - CXLMemPatrolScrubSetFeature *ps_set_feature;
> - CXLMemECSWriteAttrs *ecs_write_attrs;
> - CXLMemECSSetFeature *ecs_set_feature;
> CXLSetFeatureInfo *set_feat_info;
> uint16_t bytes_to_copy = 0;
> uint8_t data_transfer_flag;
> @@ -1508,8 +1504,9 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
> return CXL_MBOX_UNSUPPORTED;
> }
>
> - ps_set_feature = (void *)payload_in;
> - ps_write_attrs = &ps_set_feature->feat_data;
> + CXLMemPatrolScrubSetFeature *ps_set_feature = (void *)payload_in;
Move the declaration to start of scope.
You can do assignment there as well as I don't think we care if we cast them
to the wrong type as header version isn't what we think it should be.
> + CXLMemPatrolScrubWriteAttrs *ps_write_attrs =
> + &ps_set_feature->feat_data;
>
> if ((uint32_t)hdr->offset + bytes_to_copy >
> sizeof(ct3d->patrol_scrub_wr_attrs)) {
> @@ -1535,8 +1532,8 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
> return CXL_MBOX_UNSUPPORTED;
> }
>
> - ecs_set_feature = (void *)payload_in;
> - ecs_write_attrs = ecs_set_feature->feat_data;
> + CXLMemECSSetFeature *ecs_set_feature = (void *)payload_in;
> + CXLMemECSWriteAttrs *ecs_write_attrs = ecs_set_feature->feat_data;
>
> if ((uint32_t)hdr->offset + bytes_to_copy >
> sizeof(ct3d->ecs_wr_attrs)) {
next prev parent reply other threads:[~2025-06-20 14:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 15:16 [PATCH v2 0/7] hw/cxl: Update CXL events to rev3.2 and add maintenance support for memory repair features shiju.jose--- via
2025-06-19 15:16 ` [PATCH v2 1/7] hw/cxl/events: Update for rev3.2 common event record format shiju.jose--- via
2025-06-20 14:03 ` Jonathan Cameron via
2025-06-24 9:10 ` Shiju Jose via
2025-06-19 15:16 ` [PATCH v2 2/7] hw/cxl/events: Updates for rev3.2 general media event record shiju.jose--- via
2025-06-20 14:13 ` Jonathan Cameron via
2025-06-19 15:16 ` [PATCH v2 3/7] hw/cxl/events: Updates for rev3.2 DRAM " shiju.jose--- via
2025-06-19 15:16 ` [PATCH v2 4/7] hw/cxl/events: Updates for rev3.2 memory module " shiju.jose--- via
2025-06-19 15:16 ` [PATCH v2 5/7] hw/cxl/cxl-mailbox-utils: Move declaration of scrub and ECS feature attributes in cmd_features_set_feature() shiju.jose--- via
2025-06-20 14:16 ` Jonathan Cameron via [this message]
2025-06-19 15:16 ` [PATCH v2 6/7] hw/cxl: Add Maintenance support shiju.jose--- via
2025-06-20 14:40 ` Jonathan Cameron via
2025-06-19 15:16 ` [PATCH v2 7/7] hw/cxl: Add emulation for memory sparing control feature shiju.jose--- via
2025-06-20 14:48 ` Jonathan Cameron via
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=20250620151655.00001cea@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=prime.zeng@hisilicon.com \
--cc=shiju.jose@huawei.com \
--cc=tanxiaofei@huawei.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;
as well as URLs for NNTP newsgroup(s).