Hi, On Wed, Jul 06, 2011 at 11:31:36AM +0200, Nicolas Ferre wrote: > Take care of slots while going to suspend state. > > Signed-off-by: Nicolas Ferre FWIW: Reviewed-by: Felipe Balbi > @@ -1878,10 +1879,72 @@ static int __exit atmci_remove(struct platform_device *pdev) > return 0; > } > > +#ifdef CONFIG_PM > +static int atmci_suspend(struct device *dev) > +{ > + struct atmel_mci *host = dev_get_drvdata(dev); > + int i; > + > + for (i = 0; i < ATMEL_MCI_MAX_NR_SLOTS; i++) { > + struct atmel_mci_slot *slot = host->slot[i]; > + int ret; > + > + if (!slot) > + continue; > + ret = mmc_suspend_host(slot->mmc); > + if (ret < 0) { > + while (--i >= 0) { > + slot = host->slot[i]; > + if (slot > + && test_bit(ATMCI_SUSPENDED, &slot->flags)) { > + mmc_resume_host(host->slot[i]->mmc); > + clear_bit(ATMCI_SUSPENDED, &slot->flags); > + } > + } > + return ret; > + } else { > + set_bit(ATMCI_SUSPENDED, &slot->flags); > + } just one small nitpicking which you can ignore if you like, but you don't really need the else branch here. If you fall into if (ret < 0) you will return early anyway, so you can save two lines and an indentation level :-p -- balbi