Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269883

using IS_ENABLED(CONFIG_xyz) effectively

From Vineet Gupta <Vineet.Gupta1@synopsys.com>
Newsgroups linux.kernel
Subject using IS_ENABLED(CONFIG_xyz) effectively
Date 2015-11-16 09:10 +0100
Message-ID <qvn1n-4Na-13@gated-at.bofh.it> (permalink)
References <qgD87-2O1-69@gated-at.bofh.it> <qgHEK-11w-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

I've been using IS_ENABLED for some time and once in a while run into an issue
which prevents seamless use. Hence posing this question to experts in the area.

C macro processor evaluates the ensuing control block even if IS_ENABLED evaluates
to false. This requires dummy #defines or worse still removing usage of IS_ENABLED
altogether.

e.g. In example below even for ARCOMPACT builds, we need the ARCV2 specific define
ARCV2_IRQ_DEF_PRIO.

void arch_cpu_idle(void)
{
        if (is_isa_arcompact()) {    <---- IS_ENABLED(CONFIG_ISA_ARCOMPACT)
                __asm__("sleep 0x3");
        } else {
		const int arg = 0x10 | ARCV2_IRQ_DEF_PRIO;
               __asm__("sleep 0x10");
	}
}

One could argue that the interface needs to be cleanly defined to not have such
specific #defines in common code in first place. However sometime that becomes
just too tedious.

Is there a way to get around by this ?

Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

using IS_ENABLED(CONFIG_xyz) effectively Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-11-16 09:10 +0100
  Re: using IS_ENABLED(CONFIG_xyz) effectively Geert Uytterhoeven <geert@linux-m68k.org> - 2015-11-16 09:30 +0100
    Re: using IS_ENABLED(CONFIG_xyz) effectively Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-11-16 09:40 +0100
      Re: using IS_ENABLED(CONFIG_xyz) effectively Arnd Bergmann <arnd@arndb.de> - 2015-11-16 10:00 +0100
        Re: using IS_ENABLED(CONFIG_xyz) effectively Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-11-16 11:10 +0100

csiph-web