public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature.
Date: Mon, 5 Dec 2011 13:53:37 +0100	[thread overview]
Message-ID: <20111205125337.GB10147@avionic-0098.adnet.avionic-design.de> (raw)
In-Reply-To: <4EDC9F87.8050104@denx.de>

* Stefano Babic wrote:
> On 05/12/2011 09:23, Thierry Reding wrote:
[...]
> > diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c
> > index b78bf6c..451d709 100644
> > --- a/board/efikamx/efikamx.c
> > +++ b/board/efikamx/efikamx.c
> > @@ -309,17 +309,15 @@ static inline uint32_t efika_mmc_cd(void)
> >  		return MX51_PIN_EIM_CS2;
> >  }
> >  
> > -int board_mmc_getcd(u8 *absent, struct mmc *mmc)
> > +int board_mmc_getcd(struct mmc *mmc)
> >  {
> >  	struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> >  	uint32_t cd = efika_mmc_cd();
> >  
> >  	if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
> > -		*absent = gpio_get_value(IOMUX_TO_GPIO(cd));
> > -	else
> > -		*absent = gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_8));
> > +		return !gpio_get_value(IOMUX_TO_GPIO(cd));
> 
> It seems to me you are inverting the logic. In you commit message, "1"
> means that a card is detected, exactly as it is done now. Am I wrong ?

The reason is that the fsl_esdhc driver actually calls the "cd" parameter
"absent", so the logic is inverted in that driver. This change merely brings
the board implementation in line with the new API. Perhaps it would help if
the meaning of the return value should be documented explicitly in mmc.h?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111205/507f6776/attachment.pgp>

      reply	other threads:[~2011-12-05 12:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05  8:23 [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature Thierry Reding
2011-12-05  8:23 ` [U-Boot] [PATCH 2/4] mmc: Implement card detection Thierry Reding
2011-12-05  8:23 ` [U-Boot] [PATCH 3/4] mmc: fsl_esdhc: Implement card-detect hook Thierry Reding
2011-12-05 10:47   ` Stefano Babic
2011-12-05 12:49     ` Thierry Reding
2011-12-05  8:23 ` [U-Boot] [PATCH 4/4] mmc: tegra2: " Thierry Reding
2011-12-05  9:53 ` [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature Marek Vasut
2011-12-05 10:00   ` Thierry Reding
2011-12-05 10:54     ` Stefano Babic
2011-12-05 11:02       ` Marek Vasut
2011-12-05 10:40 ` Stefano Babic
2011-12-05 12:53   ` Thierry Reding [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=20111205125337.GB10147@avionic-0098.adnet.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=u-boot@lists.denx.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