From: Marcel Holtmann <marcel@holtmann.org>
To: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Max Krasnyansky <maxk@qualcomm.com>,
BlueZ Mailing List <bluez-devel@lists.sourceforge.net>,
kernel-janitors@lists.osdl.org
Subject: [KJ] Re: [UPDATE PATCH 18/39] net/core: use wait_event_timeout()
Date: Sat, 22 Jan 2005 17:57:28 +0000 [thread overview]
Message-ID: <1106416648.8118.3.camel@pegasus> (raw)
In-Reply-To: <20050121190909.GD3340@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1789 bytes --]
Hi Nishanth,
> Description: Use wait_event_timeout() instead of custom wait-queue code.
> The current code uses TASK_INTERRUPTIBLE but only cares about timing out and the
> wq event taking place (does not actively do anything in response to signals), so
> wait_event_timeout() should be ok.
>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
>
>
> --- 2.6.11-rc1-kj-v/net/bluetooth/hidp/core.c 2005-01-15 16:55:44.000000000 -0800
> +++ 2.6.11-rc1-kj/net/bluetooth/hidp/core.c 2005-01-21 11:07:11.000000000 -0800
> @@ -36,6 +36,7 @@
> #include <linux/ioctl.h>
> #include <linux/file.h>
> #include <linux/init.h>
> +#include <linux/wait.h>
> #include <net/sock.h>
>
> #include <linux/input.h>
> @@ -325,7 +326,6 @@ static int hidp_session(void *arg)
> struct sk_buff *skb;
> int vendor = 0x0000, product = 0x0000;
> wait_queue_t ctrl_wait, intr_wait;
> - unsigned long timeo = HZ;
>
> BT_DBG("session %p", session);
>
> @@ -370,28 +370,14 @@ static int hidp_session(void *arg)
>
> hidp_del_timer(session);
>
> - if (intr_sk->sk_state != BT_CONNECTED) {
> - init_waitqueue_entry(&ctrl_wait, current);
> - add_wait_queue(ctrl_sk->sk_sleep, &ctrl_wait);
> - while (timeo && ctrl_sk->sk_state != BT_CLOSED) {
> - set_current_state(TASK_INTERRUPTIBLE);
> - timeo = schedule_timeout(timeo);
> - }
> - set_current_state(TASK_RUNNING);
> - remove_wait_queue(ctrl_sk->sk_sleep, &ctrl_wait);
> - timeo = HZ;
> - }
> + if (intr_sk->sk_state != BT_CONNECTED)
> + wait_event_timeout(*(ctrl_sk->sk_sleep),
> + (ctrl_sk->sk_state == BT_CLOSED), HZ);
and this does not make it look better. For me this is too much pointer
stuff here. I think the interface of wait_event_timeout() is wrong. It
should take a pointer to wait_queue_head_t.
Regards
Marcel
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
WARNING: multiple messages have this Message-ID (diff)
From: Marcel Holtmann <marcel@holtmann.org>
To: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Max Krasnyansky <maxk@qualcomm.com>,
BlueZ Mailing List <bluez-devel@lists.sourceforge.net>,
kernel-janitors@lists.osdl.org
Subject: [Bluez-devel] Re: [UPDATE PATCH 18/39] net/core: use wait_event_timeout()
Date: Sat, 22 Jan 2005 18:57:28 +0100 [thread overview]
Message-ID: <1106416648.8118.3.camel@pegasus> (raw)
In-Reply-To: <20050121190909.GD3340@us.ibm.com>
Hi Nishanth,
> Description: Use wait_event_timeout() instead of custom wait-queue code.
> The current code uses TASK_INTERRUPTIBLE but only cares about timing out and the
> wq event taking place (does not actively do anything in response to signals), so
> wait_event_timeout() should be ok.
>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
>
>
> --- 2.6.11-rc1-kj-v/net/bluetooth/hidp/core.c 2005-01-15 16:55:44.000000000 -0800
> +++ 2.6.11-rc1-kj/net/bluetooth/hidp/core.c 2005-01-21 11:07:11.000000000 -0800
> @@ -36,6 +36,7 @@
> #include <linux/ioctl.h>
> #include <linux/file.h>
> #include <linux/init.h>
> +#include <linux/wait.h>
> #include <net/sock.h>
>
> #include <linux/input.h>
> @@ -325,7 +326,6 @@ static int hidp_session(void *arg)
> struct sk_buff *skb;
> int vendor = 0x0000, product = 0x0000;
> wait_queue_t ctrl_wait, intr_wait;
> - unsigned long timeo = HZ;
>
> BT_DBG("session %p", session);
>
> @@ -370,28 +370,14 @@ static int hidp_session(void *arg)
>
> hidp_del_timer(session);
>
> - if (intr_sk->sk_state != BT_CONNECTED) {
> - init_waitqueue_entry(&ctrl_wait, current);
> - add_wait_queue(ctrl_sk->sk_sleep, &ctrl_wait);
> - while (timeo && ctrl_sk->sk_state != BT_CLOSED) {
> - set_current_state(TASK_INTERRUPTIBLE);
> - timeo = schedule_timeout(timeo);
> - }
> - set_current_state(TASK_RUNNING);
> - remove_wait_queue(ctrl_sk->sk_sleep, &ctrl_wait);
> - timeo = HZ;
> - }
> + if (intr_sk->sk_state != BT_CONNECTED)
> + wait_event_timeout(*(ctrl_sk->sk_sleep),
> + (ctrl_sk->sk_state == BT_CLOSED), HZ);
and this does not make it look better. For me this is too much pointer
stuff here. I think the interface of wait_event_timeout() is wrong. It
should take a pointer to wait_queue_head_t.
Regards
Marcel
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2005-01-22 17:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-20 23:51 [KJ] [PATCH 18/39] net/core: use wait_event_timeout() Nishanth Aravamudan
2005-01-21 0:32 ` [KJ] " Marcel Holtmann
2005-01-21 0:32 ` [Bluez-devel] " Marcel Holtmann
2005-01-21 19:09 ` [KJ] [UPDATE PATCH " Nishanth Aravamudan
2005-01-21 19:09 ` Nishanth Aravamudan
2005-01-22 17:57 ` Marcel Holtmann [this message]
2005-01-22 17:57 ` [Bluez-devel] " Marcel Holtmann
2005-01-22 18:44 ` [KJ] " Nish Aravamudan
2005-01-22 18:44 ` Nish Aravamudan
2005-01-23 9:21 ` Marcel Holtmann
2005-01-23 9:21 ` [Bluez-devel] " Marcel Holtmann
2005-01-26 5:56 ` [KJ] " David S. Miller
2005-01-26 5:56 ` David S. Miller
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=1106416648.8118.3.camel@pegasus \
--to=marcel@holtmann.org \
--cc=bluez-devel@lists.sourceforge.net \
--cc=kernel-janitors@lists.osdl.org \
--cc=maxk@qualcomm.com \
--cc=nacc@us.ibm.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.