From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
To: linux-sh@vger.kernel.org
Subject: Re: [RFC/PATCH] sh: Remove cast of atomic_t in ATOMIC_INIT macro
Date: Wed, 25 Apr 2012 03:11:14 +0000 [thread overview]
Message-ID: <CABMQnVJ3_HzGcW0o_D=rnDM1vEmPRp6eoPQzNvZvHdE2YoXQwQ@mail.gmail.com> (raw)
In-Reply-To: <1335149312-1564-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com>
2012/4/23 Paul Mundt <lethal@linux-sh.org>:
> On Mon, Apr 23, 2012 at 11:48:32AM +0900, Nobuhiro Iwamatsu wrote:
>> Hi,
>>
>> By the update of the trace system (enable CONFIG_TRACING), trace build is not made in SH.
>> This is macro of trace, and ATOMIC_INIT is used, but becomes the build error with an initialization code.
>>
>> ----
>> include/trace/events/oom.h:8:13: error: initializer element is not constant
>> include/trace/events/oom.h:8:13: error: (near initialization for '__tracepoint_oom_score_adj_update')
>> include/trace/events/oom.h:8:13: error: initializer element is not constant
>> include/trace/events/oom.h:8:13: error: (near initialization for '__tracepoint_oom_score_adj_update.key')
>> ----
>>
>> This is caused by that the cast to atomic_t is performed by ATOMIC_INIT of SH.
>> However, at almost all the architecture, the cast to atomic_t is not performed by ATOMIC_INIT.
>
> And on other architectures it is. We don't specifically have any need for
> using the cast, so dropping it is probably fine, but there are other
> architectures that will either have to do the same or the tracing change
> that introduced the build failure has to be rethought.
Thanks for your comments.
The architecture casting in ATOMIC_INIT has IA64 and Alpha, Parisc
other than SH.
The others do not cast. And these architectures have same problem.
And this problem occurs by STATIC_KEY_INIT_TRUE and
STATIC_KEY_INIT_FALSE of include/linux/jump_label.h.
The architecture by which jumplabel is defined following,
> #define STATIC_KEY_INIT_TRUE ((struct static_key) \
> { .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
> #define STATIC_KEY_INIT_FALSE ((struct static_key) \
> { .enabled = ATOMIC_INIT(0), .entries = (void *)0 })
and does not define following.
> #define STATIC_KEY_INIT_TRUE ((struct static_key) \
> { .enabled = ATOMIC_INIT(1) })
> #define STATIC_KEY_INIT_FALSE ((struct static_key) \
> { .enabled = ATOMIC_INIT(0) })
Although a problem is solved by considering it following.
> #define STATIC_KEY_INIT_TRUE {ATOMIC_INIT(1)}
> #define STATIC_KEY_INIT_FALSE {ATOMIC_INIT(0)}
However, since definitions differ by the same macro name,
extendibility is lost.
I think that it is better to remove the cast from ATOMIC_INIT.
Best regards,
Nobuhiro
--
Nobuhiro Iwamatsu
next prev parent reply other threads:[~2012-04-25 3:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 2:48 [RFC/PATCH] sh: Remove cast of atomic_t in ATOMIC_INIT macro Nobuhiro Iwamatsu
2012-04-23 6:52 ` Paul Mundt
2012-04-25 3:11 ` Nobuhiro Iwamatsu [this message]
2012-04-27 0:35 ` Paul Mundt
2012-04-27 2:11 ` Simon Horman
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='CABMQnVJ3_HzGcW0o_D=rnDM1vEmPRp6eoPQzNvZvHdE2YoXQwQ@mail.gmail.com' \
--to=nobuhiro.iwamatsu.yj@renesas.com \
--cc=linux-sh@vger.kernel.org \
/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).