From: Davide Libenzi <davidel@xmailserver.org>
To: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: linux-usb@vger.kernel.org, Greg KH <greg@kroah.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-fsdevel@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/8] fs/timerfd.c: make use of wait_event_interruptible_locked_irq()
Date: Fri, 16 Apr 2010 09:10:20 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.00.1004160908510.16177@makko.or.mcafeemobile.com> (raw)
In-Reply-To: <7fbfe9c15eae523b73b704a3b5399319152fd505.1271406290.git.mina86@mina86.com>
On Fri, 16 Apr 2010, Michal Nazarewicz wrote:
> This patch modifies the fs/timerfd.c to use the newly created
> wait_event_interruptible_locked_irq() macro. This replaces an open
> code implementation with a single macro call.
>
> Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> fs/timerfd.c | 25 ++++---------------------
> 1 files changed, 4 insertions(+), 21 deletions(-)
>
> diff --git a/fs/timerfd.c b/fs/timerfd.c
> index 98158de..b86ab8e 100644
> --- a/fs/timerfd.c
> +++ b/fs/timerfd.c
> @@ -110,31 +110,14 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
> struct timerfd_ctx *ctx = file->private_data;
> ssize_t res;
> u64 ticks = 0;
> - DECLARE_WAITQUEUE(wait, current);
>
> if (count < sizeof(ticks))
> return -EINVAL;
> spin_lock_irq(&ctx->wqh.lock);
> - res = -EAGAIN;
> - if (!ctx->ticks && !(file->f_flags & O_NONBLOCK)) {
> - __add_wait_queue(&ctx->wqh, &wait);
> - for (res = 0;;) {
> - set_current_state(TASK_INTERRUPTIBLE);
> - if (ctx->ticks) {
> - res = 0;
> - break;
> - }
> - if (signal_pending(current)) {
> - res = -ERESTARTSYS;
> - break;
> - }
> - spin_unlock_irq(&ctx->wqh.lock);
> - schedule();
> - spin_lock_irq(&ctx->wqh.lock);
> - }
> - __remove_wait_queue(&ctx->wqh, &wait);
> - __set_current_state(TASK_RUNNING);
> - }
> + if (file->f_flags & O_NONBLOCK)
> + res = -EAGAIN;
> + else
> + res = wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks);
> if (ctx->ticks) {
> ticks = ctx->ticks;
> if (ctx->expired && ctx->tintv.tv64) {
Looks clean to me.
Acked-By: Davide Libenzi <davidel@xmailserver.org>
- Davide
next prev parent reply other threads:[~2010-04-16 16:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 9:49 [PATCHv3 0/7] The FunctionFS composite function Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 1/8] wait_event_interruptible_locked() interface Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 2/8] fs/timerfd.c: make use of wait_event_interruptible_locked_irq() Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 3/8] USB: gadget: __init and __exit tags removed Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 4/8] USB: f_fs: the FunctionFS driver Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 5/8] USB: g_ffs: the FunctionFS gadget driver Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 6/8] USB: ffs-test: FunctionFS testing program Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 7/8] USB: testusb: an USB testing application Michal Nazarewicz
2010-04-16 9:49 ` [PATCH 8/8] USB: testusb: testusb compatibility with FunctionFS gadget Michal Nazarewicz
2010-04-16 23:40 ` [PATCH 3/8] USB: gadget: __init and __exit tags removed Mike Frysinger
2010-04-19 7:57 ` Michał Nazarewicz
2010-04-19 8:02 ` Mike Frysinger
2010-04-19 9:04 ` Michał Nazarewicz
2010-04-16 16:10 ` Davide Libenzi [this message]
2010-05-04 17:32 ` [PATCHv3 0/7] The FunctionFS composite function Greg KH
2010-05-05 8:50 ` Michał Nazarewicz
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=alpine.DEB.2.00.1004160908510.16177@makko.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=greg@kroah.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.nazarewicz@samsung.com \
--cc=m.szyprowski@samsung.com \
--cc=tglx@linutronix.de \
/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).