lkml.org 
[lkml]   [2011]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V4] MMC: PM: add suspend/resume in atmel-mci
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@atmel.com>

FWIW:

Reviewed-by: Felipe Balbi <balbi@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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-07-06 10:31    [W:0.562 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site