[PATCH 03/13] sdhci: Split card-detection IRQs management from sdhci_init()

Pierre Ossman drzeus at drzeus.cx
Sun Feb 22 02:58:07 EST 2009


On Fri, 13 Feb 2009 17:47:15 +0300
Anton Vorontsov <avorontsov at ru.mvista.com> wrote:

> Card detection interrupts should be handled separately as they should
> not be enabled before mmc_add_host() returns and should be disabled
> before calling mmc_remove_host(). The same is for suspend and resume
> routines.
> 
> sdhci_init() no longer enables card-detection irqs. Instead, two new
> functions implemented: sdhci_enable_card_detection() and
> sdhci_disable_card_detection().
> 
> New sdhci_reinit() call implemented to behave the same way as the old
> sdhci_init().
> 
> Also, this patch implements and uses few new helpers to manage IRQs in
> a more conveinient way, that is:
> 
> - sdhci_clear_set_irqs()
> - sdhci_unmask_irqs()
> - sdhci_mask_irqs()
> - SDHCI_INT_ALL_MASK constant
> 
> sdhci_enable_sdio_irq() converted to these new helpers, plus the
> helpers will be used by the subsequent patches.
> 
> Signed-off-by: Anton Vorontsov <avorontsov at ru.mvista.com>
> ---

That's a lot of indirection, but fair enough. :)

> @@ -1792,6 +1832,8 @@ int sdhci_add_host(struct sdhci_host *host)
>  
>  	mmc_add_host(mmc);
>  
> +	sdhci_enable_card_detection(host);
> +
>  	printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n",
>  		mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)),
>  		(host->flags & SDHCI_USE_ADMA)?"A":"",

There is a small race here, but I'm not sure it's worth dealing with.

> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index e907441..45c8309 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -124,6 +124,10 @@
>  		SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \
>  		SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \
>  		SDHCI_INT_DATA_END_BIT)
> +#define SDHCI_INT_ALL_MASK	(SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | \
> +		SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE | \
> +		SDHCI_INT_CARD_INT | SDHCI_INT_ERROR | SDHCI_INT_BUS_POWER | \
> +		SDHCI_INT_ACMD12ERR | SDHCI_INT_ADMA_ERROR)
>  

In the context this is used, why not just use (unsigned)-1?

Rgds
-- 
     -- Pierre Ossman

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090221/3f6ecabe/attachment.pgp>


More information about the Linuxppc-dev mailing list