diff options
author | NeilBrown <neilb@suse.de> | 2012-05-21 19:43:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:37:04 -0400 |
commit | b7e938d06d0de43bdbee8844a8736c81480c1031 (patch) | |
tree | 6574fe98a3c82f21b13a96cf313435b4553ed3e9 /drivers/w1/masters/omap_hdq.c | |
parent | 7b5362a603a1ecc9a25b97dafd702b8098090f41 (diff) |
w1: omap_hdq: use wait_event_timeout to wait for read to complete.
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>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1/masters/omap_hdq.c')
-rw-r--r-- | drivers/w1/masters/omap_hdq.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index 3036b6113ffd..848399bfb9b4 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
@@ -354,7 +354,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) | |||
354 | { | 354 | { |
355 | int ret = 0; | 355 | int ret = 0; |
356 | u8 status; | 356 | u8 status; |
357 | unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT; | ||
358 | 357 | ||
359 | ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); | 358 | ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); |
360 | if (ret < 0) { | 359 | if (ret < 0) { |
@@ -372,15 +371,13 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) | |||
372 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO, | 371 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO, |
373 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO); | 372 | OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO); |
374 | /* | 373 | /* |
375 | * The RX comes immediately after TX. It | 374 | * The RX comes immediately after TX. |
376 | * triggers another interrupt before we | ||
377 | * sleep. So we have to wait for RXCOMPLETE bit. | ||
378 | */ | 375 | */ |
379 | while (!(hdq_data->hdq_irqstatus | 376 | wait_event_timeout(hdq_wait_queue, |
380 | & OMAP_HDQ_INT_STATUS_RXCOMPLETE) | 377 | (hdq_data->hdq_irqstatus |
381 | && time_before(jiffies, timeout)) { | 378 | & OMAP_HDQ_INT_STATUS_RXCOMPLETE), |
382 | schedule_timeout_uninterruptible(1); | 379 | OMAP_HDQ_TIMEOUT); |
383 | } | 380 | |
384 | hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, | 381 | hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, |
385 | OMAP_HDQ_CTRL_STATUS_DIR); | 382 | OMAP_HDQ_CTRL_STATUS_DIR); |
386 | status = hdq_data->hdq_irqstatus; | 383 | status = hdq_data->hdq_irqstatus; |