mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Juergen Beisert <jbe@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 6/6] MCI/Core: move an ugly ifdef to the header file
Date: Sat, 27 Apr 2013 00:04:03 +0200	[thread overview]
Message-ID: <20130426220403.GB32299@pengutronix.de> (raw)
In-Reply-To: <1366968712-17851-7-git-send-email-jbe@pengutronix.de>

On Fri, Apr 26, 2013 at 11:31:52AM +0200, Juergen Beisert wrote:
> To avoid the compiler complains about an unused variable when no SPI host is
> enabled, use an inline function instead of a macro.
> 
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> ---
>  drivers/mci/mci-core.c |  3 +--
>  include/mci.h          | 15 +++++++++------
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 42e3d4b..ba7ef55 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -482,9 +482,8 @@ static int sd_change_freq(struct mci *mci)
>  {
>  	struct mci_cmd cmd;
>  	struct mci_data data;
> -#ifdef CONFIG_MCI_SPI
>  	struct mci_host *host = mci->host;
> -#endif
> +
>  	uint32_t *switch_status = sector_buf;
>  	uint32_t *scr = sector_buf;
>  	int timeout;
> diff --git a/include/mci.h b/include/mci.h
> index cf9582d..7f514be 100644
> --- a/include/mci.h
> +++ b/include/mci.h
> @@ -54,12 +54,6 @@
>  
>  #define IS_SD(x) (x->version & SD_VERSION_SD)
>  
> -#ifdef CONFIG_MCI_SPI
> -#define mmc_host_is_spi(host)	((host)->host_caps & MMC_CAP_SPI)
> -#else
> -#define mmc_host_is_spi(host)	0
> -#endif
> -
>  #define MMC_DATA_READ		1
>  #define MMC_DATA_WRITE		2
>  
> @@ -330,6 +324,15 @@ struct mci {
>  	char *ext_csd;
>  };
>  
> +static inline bool mmc_host_is_spi(const struct mci_host *host)
> +{
> +#ifdef CONFIG_MCI_SPI
> +	return !!host->host_caps & MMC_CAP_SPI;

negation comes before bitwise and. This always returns 0.

Also you could use IS_ENABLED().

Sascha

> +#else
> +	return false;
> +#endif
> +}
> +
>  int mci_register(struct mci_host*);
>  
>  #endif /* _MCI_H_ */
> -- 
> 1.8.2.rc2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-04-26 22:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26  9:31 Some fixes and improvements while working with the Chumby Juergen Beisert
2013-04-26  9:31 ` [PATCH 1/6] MXS/MCI: add forgotten header file Juergen Beisert
2013-04-26  9:31 ` [PATCH 2/6] MXS/MCI: don't touch variables in the host structure Juergen Beisert
2013-04-26  9:31 ` [PATCH 3/6] MCI/Core: increase the transmission frequency while card detection Juergen Beisert
2013-04-26  9:31 ` [PATCH 4/6] MCI/Core: honor transmission limits at the card's side Juergen Beisert
2013-04-26  9:31 ` [PATCH 5/6] MCI/MXS: report a better matching error code when the transfer fails Juergen Beisert
2013-04-26  9:31 ` [PATCH 6/6] MCI/Core: move an ugly ifdef to the header file Juergen Beisert
2013-04-26 22:04   ` Sascha Hauer [this message]
2013-04-26 22:08 ` Some fixes and improvements while working with the Chumby Sascha Hauer

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=20130426220403.GB32299@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@pengutronix.de \
    /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