[PATCH V4] MMC: PM: add suspend/resume in atmel-mci

Felipe Balbi balbi at ti.com
Wed Jul 6 04:28:09 EDT 2011


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 <nicolas.ferre at atmel.com>

FWIW:

Reviewed-by: Felipe Balbi <balbi at ti.com>

> @@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110706/74a3c1a9/attachment-0001.sig>


More information about the linux-arm-kernel mailing list