> -----Original Message-----
> From: Hein_Tibosch [mailto:[email protected]]
> Sent: Tuesday, December 06, 2011 8:11 PM
> To: Huang Changming-R66093
> Cc: [email protected]; Huang Changming-R66093; Chris Ball
> Subject: Re: [PATCH 4/5 v2] SDHCI: add sdhci_get_cd callback to detect
> the card
> 
> Hi Jerry,
> 
> On 12/6/2011 5:15 PM, [email protected] wrote:
> > From: Jerry Huang <[email protected]>
> >
> > Add callback function sdhci_get_cd to detect the card.
> > And one new callback added to implement the card detect in sdhci
> struncture.
> > If special platform has the card detect callback, it will return the
> > card state, the value zero is for absent cardi and one is for present
> card.
> > If the controller don't support card detect, sdhci_get_cd will return -
> ENOSYS.
> >
> > Signed-off-by: Jerry Huang <[email protected]>
> > CC: Chris Ball <[email protected]>
> > ---
> > changes for v2:
> >     - when controller don't support get_cd, return -ENOSYS
> >     - add new callback for sdhci to detect the card
> >     - add the CC
> >
> >  drivers/mmc/host/sdhci.c |   21 +++++++++++++++++++++
> >  drivers/mmc/host/sdhci.h |    2 ++
> >  2 files changed, 23 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
> > 6d8eea3..2196c5e 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -2,6 +2,7 @@
> >   *  linux/drivers/mmc/host/sdhci.c - Secure Digital Host Controller
> Interface driver
> >   *
> >   *  Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
> > + *  Copyright (C) 2011 Freescale Semiconductor Inc.
> >   *
> >   * This program is free software; you can redistribute it and/or
> modify
> >   * it under the terms of the GNU General Public License as published
> > by @@ -1518,6 +1519,25 @@ static int sdhci_get_ro(struct mmc_host *mmc)
> >     return ret;
> >  }
> >
> > +/* Return values for the sdjco_get_cd callback:
> > + *   0 for a absent card
> > + *   1 for a present card
> > + *   -ENOSYS when not supported (equal to NULL callback)
> > + */
> > +static int sdhci_get_cd(struct mmc_host *mmc) {
> > +   struct sdhci_host *host = mmc_priv(mmc);
> > +   unsigned long flags;
> > +   int present = -ENOSYS;
> > +
> > +   spin_lock_irqsave(&host->lock, flags);
> > +   if (host->ops->get_cd)
> > +           present = host->ops->get_cd(host);
> > +   spin_unlock_irqrestore(&host->lock, flags);
> 
> Maybe only use spin-lock if get_cd is defined?
> 
Yes, I will move it.

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to