* [PATCH 2/2] ARM: omap_hdq: use wait_event_timeout to wait for read to complete.
@ 2012-04-25 2:41 NeilBrown
2012-05-01 21:42 ` Evgeniy Polyakov
0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2012-04-25 2:41 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: linux-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]
There is no gain in having a loop - there is no risk of missing the
interrupt with wait_event_timeout.
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/w1/masters/omap_hdq.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 3356d75..eb01c7f 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -357,7 +357,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
{
int ret = 0;
u8 status;
- unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;
ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0) {
@@ -375,15 +374,13 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO,
OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO);
/*
- * The RX comes immediately after TX. It
- * triggers another interrupt before we
- * sleep. So we have to wait for RXCOMPLETE bit.
+ * The RX comes immediately after TX.
*/
- while (!(hdq_data->hdq_irqstatus
- & OMAP_HDQ_INT_STATUS_RXCOMPLETE)
- && time_before(jiffies, timeout)) {
- schedule_timeout_uninterruptible(1);
- }
+ wait_event_timeout(hdq_wait_queue,
+ (hdq_data->hdq_irqstatus
+ & OMAP_HDQ_INT_STATUS_RXCOMPLETE),
+ OMAP_HDQ_TIMEOUT);
+
hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0,
OMAP_HDQ_CTRL_STATUS_DIR);
status = hdq_data->hdq_irqstatus;
--
1.7.10
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] ARM: omap_hdq: use wait_event_timeout to wait for read to complete.
2012-04-25 2:41 [PATCH 2/2] ARM: omap_hdq: use wait_event_timeout to wait for read to complete NeilBrown
@ 2012-05-01 21:42 ` Evgeniy Polyakov
2012-05-02 6:27 ` NeilBrown
0 siblings, 1 reply; 3+ messages in thread
From: Evgeniy Polyakov @ 2012-05-01 21:42 UTC (permalink / raw)
To: NeilBrown; +Cc: linux-kernel, linux-omap
On Wed, Apr 25, 2012 at 12:41:53PM +1000, NeilBrown (neilb@suse.de) wrote:
> There is no gain in having a loop - there is no risk of missing the
> interrupt with wait_event_timeout.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
Both patches look good, thank you
Feel free to add my ack if needed
--
Evgeniy Polyakov
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] ARM: omap_hdq: use wait_event_timeout to wait for read to complete.
2012-05-01 21:42 ` Evgeniy Polyakov
@ 2012-05-02 6:27 ` NeilBrown
0 siblings, 0 replies; 3+ messages in thread
From: NeilBrown @ 2012-05-02 6:27 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: linux-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
On Wed, 2 May 2012 01:42:19 +0400 Evgeniy Polyakov <zbr@ioremap.net> wrote:
> On Wed, Apr 25, 2012 at 12:41:53PM +1000, NeilBrown (neilb@suse.de) wrote:
> > There is no gain in having a loop - there is no risk of missing the
> > interrupt with wait_event_timeout.
> >
> > Signed-off-by: NeilBrown <neilb@suse.de>
>
> Both patches look good, thank you
> Feel free to add my ack if needed
>
Thanks. I'll add that and resent to GregKH.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-02 6:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 2:41 [PATCH 2/2] ARM: omap_hdq: use wait_event_timeout to wait for read to complete NeilBrown
2012-05-01 21:42 ` Evgeniy Polyakov
2012-05-02 6:27 ` NeilBrown
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.