[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/7] pc-bios: s390x: Rework data initialization
From: |
Thomas Huth |
Subject: |
Re: [PATCH 4/7] pc-bios: s390x: Rework data initialization |
Date: |
Mon, 20 Jul 2020 13:56:24 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 15/07/2020 11.40, Janosch Frank wrote:
> Sometimes a memset is nicer to read than multiple struct->data = 0;
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
> pc-bios/s390-ccw/dasd-ipl.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c
> index e8f2846740..0543334ed4 100644
> --- a/pc-bios/s390-ccw/dasd-ipl.c
> +++ b/pc-bios/s390-ccw/dasd-ipl.c
> @@ -167,16 +167,13 @@ static void ipl1_fixup(void)
> ccwSeek->cda = ptr2u32(seekData);
> ccwSeek->chain = 1;
> ccwSeek->count = sizeof(*seekData);
> - seekData->reserved = 0x00;
> - seekData->cyl = 0x00;
> - seekData->head = 0x00;
> + memset(seekData, 0, sizeof(*seekData));
Sounds ok for me if the whole struct gets cleared (though I wonder
whether this is really worth the effort)...
> ccwSearchID->cmd_code = CCW_CMD_DASD_SEARCH_ID_EQ;
> ccwSearchID->cda = ptr2u32(searchData);
> ccwSearchID->chain = 1;
> ccwSearchID->count = sizeof(*searchData);
> - searchData->cyl = 0;
> - searchData->head = 0;
> + memset(searchData, 0, sizeof(*searchData));
> searchData->record = 2;
... but that looks rather worse to me, and the generated code will
likely also be slightly worse (since ->record is cleared first and then
set to 2 again).
Maybe rather drop this patch?
Thomas
- [PATCH 6/7] pc-bios: s390x: Use PSW constants in start.S, (continued)
[PATCH 5/7] pc-bios: s390x: Replace lowcore offsets with pointers in dasd-ipl.c, Janosch Frank, 2020/07/15
[PATCH 4/7] pc-bios: s390x: Rework data initialization, Janosch Frank, 2020/07/15
- Re: [PATCH 4/7] pc-bios: s390x: Rework data initialization,
Thomas Huth <=
[PATCH 2/7] pc-bios: s390x: Cleanup jump to ipl code, Janosch Frank, 2020/07/15