RE: [PATCH 2/4 v4] MMC/SD: Add callback function to detect card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Anton Vorontsov [mailto:cbouatmailru@xxxxxxxxx]
> Sent: Monday, November 19, 2012 11:06 AM
> To: Huang Changming-R66093
> Cc: linux-mmc@xxxxxxxxxxxxxxx; Huang Changming-R66093; Chris Ball
> Subject: Re: [PATCH 2/4 v4] MMC/SD: Add callback function to detect card
> 
> On Tue, Oct 30, 2012 at 04:12:47PM +0800, r66093@xxxxxxxxxxxxx wrote:
> [..]
> > If the card is present, 1 will return, if the card is absent, 0 will
> return.
> > If the controller will not support this feature, -ENOSYS will return.
> >
> > Signed-off-by: Jerry Huang <Chang-Ming.Huang@xxxxxxxxxxxxx>
> > CC: Anton Vorontsov <cbouatmailru@xxxxxxxxx>
> > CC: Chris Ball <cjb@xxxxxxxxxx>
> > ---
> [...]
> >  int _mmc_detect_card_removed(struct mmc_host *host)
> >  {
> > -	int ret;
> > +	int ret = -ENOSYS;
> >
> >  	if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
> >  		return 0;
> > @@ -2081,7 +2081,13 @@ int _mmc_detect_card_removed(struct mmc_host
> *host)
> >  	if (!host->card || mmc_card_removed(host->card))
> >  		return 1;
> >
> > -	ret = host->bus_ops->alive(host);
> > +	if (host->ops->get_cd) {
> > +		ret = host->ops->get_cd(host);
> > +		if (ret >= 0)
> > +			ret = !ret;
> 
> o_O
> 
> Oh, I see...
> 
> Reviewed-by: Anton Vorontsov <cbouatmailru@xxxxxxxxx>
> 
> (But I must confess I didn't follow the whole discussion about
> get_cd()-via-gpio being unreliable. I'm assuming you fixed this?)
> 
If the GPIO is unreliable, the related driver may not implement the callback function get_cd.
For eSDHC, the GPIO is reliable, so I do it.
��.n��������+%������w��{.n�����{��i��)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux