linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd/chips: add missing set_current_state() to cfi_{amdstd,staa}_sync()
Date: Mon, 7 Apr 2008 16:15:55 -0700	[thread overview]
Message-ID: <20080407161555.3dd540f9.akpm@linux-foundation.org> (raw)
In-Reply-To: <1207251503.6300.9.camel@earth>

On Thu, 03 Apr 2008 21:38:23 +0200
Dmitry Adamushko <dmitry.adamushko@gmail.com> wrote:

> From: Dmitry Adamushko <dmitry.adamushko@gmail.com>
> Subject: [mtd/chips] add missing set_current_state() to cfi_{amdstd,staa}_sync()
> 
> cfi_amdstd_sync() and cfi_staa_sync() call schedule() without changing
> task's state appropriately.
> 
> In case of e.g. chip->state == FL_ERASING, cfi_*_sync() will be busy-looping
> either redundantly for a fixed interval of time (for SCHED_NORMAL tasks) or
> possibly endlessly (for RT tasks and UP).
> 
> Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
> 
> ---
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index d072e87..458d477 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -1763,6 +1763,7 @@ static void cfi_amdstd_sync (struct mtd_info *mtd)
>  
>  		default:
>  			/* Not an idle state */
> +			set_current_state(TASK_UNINTERRUPTIBLE);
>  			add_wait_queue(&chip->wq, &wait);
>  
>  			spin_unlock(chip->mutex);
> diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
> index b344ff8..492e2ab 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0020.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0020.c
> @@ -1015,6 +1015,7 @@ static void cfi_staa_sync (struct mtd_info *mtd)
>  
>  		default:
>  			/* Not an idle state */
> +			set_current_state(TASK_UNINTERRUPTIBLE);
>  			add_wait_queue(&chip->wq, &wait);
>  
>  			spin_unlock_bh(chip->mutex);

The change certainly looks correct.  Has it been runtime tested?

Thanks.

  reply	other threads:[~2008-04-07 23:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03 19:38 [PATCH] mtd/chips: add missing set_current_state() to cfi_{amdstd,staa}_sync() Dmitry Adamushko
2008-04-07 23:15 ` Andrew Morton [this message]
2008-04-08  8:21   ` [PATCH] mtd/chips: add missing set_current_state() to cfi_{amdstd, staa}_sync() Dmitry Adamushko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080407161555.3dd540f9.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dmitry.adamushko@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).