From: Kees Cook <keescook@chromium.org>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
linux-ia64@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Julia Lawall <julia.lawall@lip6.fr>,
Michael Leibowitz <michael.leibowitz@intel.com>
Subject: Re: [PATCH] [ACPI] Change structure initialisation to C99 style
Date: Thu, 16 Jun 2016 10:39:43 -0700 [thread overview]
Message-ID: <CAGXu5jJBoxY8LRko3Nmar0CzFFwOJJx4Qj70FpAJCwGC0Dbc7Q@mail.gmail.com> (raw)
In-Reply-To: <20160614084244.GA28854@amitoj-Inspiron-3542>
On Tue, Jun 14, 2016 at 1:42 AM, Amitoj Kaur Chawla
<amitoj1606@gmail.com> wrote:
> Replace the in order struct initialisation style with explicit field
> style.
>
> The Coccinelle semantic patch used to make this change is as follows:
>
> @decl@
> identifier i1,fld;
> type T;
> field list[n] fs;
> @@
>
> struct i1 {
> fs
> T fld;
> ...};
>
> @@
> identifier decl.i1,i2,decl.fld;
> expression e;
> position bad.p, bad.fix;
> @@
>
> struct i1 i2@p = { ...,
> + .fld = e
> - e@fix
> ,...};
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> arch/ia64/kernel/acpi-ext.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c
> index bd09bf7..31e331a 100644
> --- a/arch/ia64/kernel/acpi-ext.c
> +++ b/arch/ia64/kernel/acpi-ext.c
> @@ -80,7 +80,7 @@ static acpi_status find_csr_space(struct acpi_resource *resource, void *data)
>
> static acpi_status hp_crs_locate(acpi_handle obj, u64 *base, u64 *length)
> {
> - struct csr_space space = { 0, 0 };
> + struct csr_space space = { .base = 0, .length = 0 };
Since these are all initialized to zero, won't "= { };" be easier here?
-Kees
>
> acpi_walk_resources(obj, METHOD_NAME__CRS, find_csr_space, &space);
> if (!space.length)
> --
> 1.9.1
>
--
Kees Cook
Chrome OS & Brillo Security
prev parent reply other threads:[~2016-06-16 17:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 8:42 [PATCH] [ACPI] Change structure initialisation to C99 style Amitoj Kaur Chawla
2016-06-16 17:39 ` Kees Cook [this message]
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=CAGXu5jJBoxY8LRko3Nmar0CzFFwOJJx4Qj70FpAJCwGC0Dbc7Q@mail.gmail.com \
--to=keescook@chromium.org \
--cc=amitoj1606@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=julia.lawall@lip6.fr \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.leibowitz@intel.com \
--cc=tony.luck@intel.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).