From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Yu Kuai <yukuai3@huawei.com>,
yi.zhang@huawei.com, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] powerpc: make 'boot_text_mapped' static
Date: Fri, 9 Apr 2021 07:02:20 -0500 [thread overview]
Message-ID: <20210409120220.GE26583@gate.crashing.org> (raw)
In-Reply-To: <5b91cd3f-d171-f510-7dae-8cbabb13b23c@csgroup.eu>
Hi!
On Thu, Apr 08, 2021 at 07:04:35AM +0200, Christophe Leroy wrote:
> Le 08/04/2021 à 03:18, Yu Kuai a écrit :
> >-int boot_text_mapped __force_data = 0;
> >+static int boot_text_mapped __force_data;
>
> Are you sure the initialisation to 0 can be removed ? Usually
> initialisation to 0 is not needed because not initialised variables go in
> the BSS section which is zeroed at startup. But here the variable is
> flagged with __force_data so it is not going in the BSS section.
Any non-automatic (i.e. function-scope, not static) variable is
initialised to 0. See e.g. C11 6.7.9/10 (this has been like that since
times immemorial, C90 anyway).
Segher
WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Yu Kuai <yukuai3@huawei.com>,
mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com
Subject: Re: [PATCH 2/2] powerpc: make 'boot_text_mapped' static
Date: Fri, 9 Apr 2021 07:02:20 -0500 [thread overview]
Message-ID: <20210409120220.GE26583@gate.crashing.org> (raw)
In-Reply-To: <5b91cd3f-d171-f510-7dae-8cbabb13b23c@csgroup.eu>
Hi!
On Thu, Apr 08, 2021 at 07:04:35AM +0200, Christophe Leroy wrote:
> Le 08/04/2021 à 03:18, Yu Kuai a écrit :
> >-int boot_text_mapped __force_data = 0;
> >+static int boot_text_mapped __force_data;
>
> Are you sure the initialisation to 0 can be removed ? Usually
> initialisation to 0 is not needed because not initialised variables go in
> the BSS section which is zeroed at startup. But here the variable is
> flagged with __force_data so it is not going in the BSS section.
Any non-automatic (i.e. function-scope, not static) variable is
initialised to 0. See e.g. C11 6.7.9/10 (this has been like that since
times immemorial, C90 anyway).
Segher
next prev parent reply other threads:[~2021-04-09 12:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 1:17 [PATCH 0/2] code optimizations for btext.c Yu Kuai
2021-04-08 1:17 ` Yu Kuai
2021-04-08 1:18 ` [PATCH 1/2] powerpc: remove set but not used variable 'force_printk_to_btext' Yu Kuai
2021-04-08 1:18 ` Yu Kuai
2021-04-08 5:01 ` Christophe Leroy
2021-04-08 9:30 ` yukuai (C)
2021-04-08 9:30 ` yukuai (C)
2021-04-08 1:18 ` [PATCH 2/2] powerpc: make 'boot_text_mapped' static Yu Kuai
2021-04-08 1:18 ` Yu Kuai
2021-04-08 5:04 ` Christophe Leroy
2021-04-08 9:34 ` yukuai (C)
2021-04-08 9:34 ` yukuai (C)
2021-04-09 12:02 ` Segher Boessenkool [this message]
2021-04-09 12:02 ` Segher Boessenkool
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=20210409120220.GE26583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.