From: Artem Bityutskiy <dedekind@infradead.org>
To: Richard Purdie <rpurdie@openedhand.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/RFC] oops and panic message logging to MTD
Date: Tue, 19 Jun 2007 11:07:35 +0300 [thread overview]
Message-ID: <1182240455.4403.52.camel@sauron> (raw)
In-Reply-To: <1182184301.6074.62.camel@localhost.localdomain>
On Mon, 2007-06-18 at 17:31 +0100, Richard Purdie wrote:
> +static int mtdoops_erase_block(struct mtd_info *mtd, int offset)
> +{
> + struct erase_info erase;
> + DECLARE_WAITQUEUE(wait, current);
> + wait_queue_head_t wait_q;
> + int ret;
> +
> + init_waitqueue_head(&wait_q);
> + erase.mtd = mtd;
> + erase.callback = mtdoops_erase_callback;
> + erase.addr = offset;
> + if (mtd->erasesize < OOPS_PAGE_SIZE)
> + erase.len = OOPS_PAGE_SIZE;
> + else
> + erase.len = mtd->erasesize;
> + erase.priv = (u_long)&wait_q;
> +
> + set_current_state(TASK_INTERRUPTIBLE);
> + add_wait_queue(&wait_q, &wait);
> +
> + ret = mtd->erase(mtd, &erase);
> + if (ret) {
> + set_current_state(TASK_RUNNING);
> + remove_wait_queue(&wait_q, &wait);
> + printk(KERN_WARNING "mtdoops: erase of region [0x%x, 0x%x] "
> + "on \"%s\" failed\n",
> + erase.addr, erase.len, mtd->name);
> + return ret;
> + }
> +
> + schedule(); /* Wait for erase to finish. */
> + remove_wait_queue(&wait_q, &wait);
> +
> + return 0;
> +}
Also, could you please use wait_event_interruptible() instead of
set_current_state() which looks better (indeed, you have wait queue, so
use wq calls).
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2007-06-19 8:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-18 16:31 [PATCH/RFC] oops and panic message logging to MTD Richard Purdie
2007-06-19 7:55 ` Artem Bityutskiy
2007-06-19 10:00 ` Richard Purdie
2007-06-19 10:29 ` Artem Bityutskiy
2007-06-19 10:52 ` Richard Purdie
2007-06-19 11:05 ` Artem Bityutskiy
2007-07-03 9:47 ` Jarkko Lavinen
2007-07-03 9:47 ` Jarkko Lavinen
2007-07-04 8:54 ` Richard Purdie
2007-07-04 8:54 ` Richard Purdie
2007-06-19 8:07 ` Artem Bityutskiy [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-05-29 12:31 Richard Purdie
2007-05-29 12:35 ` Richard Purdie
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=1182240455.4403.52.camel@sauron \
--to=dedekind@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=rpurdie@openedhand.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.