From: Fabio Porcedda <fabio.porcedda@gmail.com>
To: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] at91sam9260/9g20ek: use IS_ENABLED instead of #if/#ifdef
Date: Fri, 15 Feb 2013 11:47:47 +0100 [thread overview]
Message-ID: <CAHkwnC_QypHu_YcmSn1KaRvnuuBuRobDBC5v=fDmXjhn1j6SDg@mail.gmail.com> (raw)
In-Reply-To: <1360924870-13979-2-git-send-email-fabio.porcedda@gmail.com>
On Fri, Feb 15, 2013 at 11:41 AM, Fabio Porcedda
<fabio.porcedda@gmail.com> wrote:
> Using IS_ENABLED instead of #if/#ifdef the compiler can check
> all the code.
> Using IS_ENABLED for configuring smc->mode is an optimization,
> reduce init.o text from 905 to 877.
>
> Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> arch/arm/boards/at91sam9260ek/init.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c
> index 06a53f2..bb0025d 100644
> --- a/arch/arm/boards/at91sam9260ek/init.c
> +++ b/arch/arm/boards/at91sam9260ek/init.c
> @@ -37,9 +37,8 @@ static void ek_set_board_type(void)
> {
> if (machine_is_at91sam9g20ek()) {
> armlinux_set_architecture(MACH_TYPE_AT91SAM9G20EK);
> -#ifdef CONFIG_AT91_HAVE_2MMC
> - armlinux_set_revision(HAVE_2MMC);
> -#endif
> + if (IS_ENABLED(CONFIG_AT91_HAVE_2MMC))
> + armlinux_set_revision(HAVE_2MMC);
> } else {
> armlinux_set_architecture(MACH_TYPE_AT91SAM9260EK);
> }
> @@ -107,10 +106,12 @@ static void ek_add_device_nand(void)
> smc = &ek_9260_nand_smc_config;
>
> /* setup bus-width (8 or 16) */
> - if (nand_pdata.bus_width_16)
> + if (IS_ENABLED(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)) {
> + nand_pdata.bus_width_16 = 1;
> smc->mode |= AT91_SMC_DBW_16;
> - else
> + } else {
> smc->mode |= AT91_SMC_DBW_8;
> + }
I will push a v2 because the nand_pdata.bus_width_16 must be removed
in the struct definition.
>
> /* configure chip-select 3 (NAND) */
> sam9_smc_configure(0, 3, smc);
> @@ -209,10 +210,10 @@ static void __init ek_add_led(void)
> {
> int i;
>
> -#ifdef CONFIG_AT91_HAVE_2MMC
> - leds[0].gpio = AT91_PIN_PB8;
> - leds[1].gpio = AT91_PIN_PB9;
> -#endif
> + if (IS_ENABLED(CONFIG_AT91_HAVE_2MMC)) {
> + leds[0].gpio = AT91_PIN_PB8;
> + leds[1].gpio = AT91_PIN_PB9;
> + }
>
> for (i = 0; i < ARRAY_SIZE(leds); i++) {
> at91_set_gpio_output(leds[i].gpio, leds[i].active_low);
> --
> 1.8.1.1
>
--
Fabio Porcedda
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-02-15 10:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 10:41 [PATCH 0/2] at91sam9260/9g20ek: cleanup and optimization Fabio Porcedda
2013-02-15 10:41 ` [PATCH 1/2] at91sam9260/9g20ek: use IS_ENABLED instead of #if/#ifdef Fabio Porcedda
2013-02-15 10:47 ` Fabio Porcedda [this message]
2013-02-15 10:41 ` [PATCH 2/2] at91sam9260/9g20ek: remove #ifdef for ek_usb_add_device_mci() Fabio Porcedda
2013-02-15 10:44 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 10:52 ` Fabio Porcedda
2013-02-15 11:14 ` Fabio Porcedda
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='CAHkwnC_QypHu_YcmSn1KaRvnuuBuRobDBC5v=fDmXjhn1j6SDg@mail.gmail.com' \
--to=fabio.porcedda@gmail.com \
--cc=barebox@lists.infradead.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