Commit b7e938d0 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

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: default avatarNeilBrown <neilb@suse.de>
Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b5362a6
...@@ -354,7 +354,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) ...@@ -354,7 +354,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
{ {
int ret = 0; int ret = 0;
u8 status; u8 status;
unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;
ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0) { if (ret < 0) {
...@@ -372,15 +371,13 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) ...@@ -372,15 +371,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,
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 * The RX comes immediately after TX.
* triggers another interrupt before we
* sleep. So we have to wait for RXCOMPLETE bit.
*/ */
while (!(hdq_data->hdq_irqstatus wait_event_timeout(hdq_wait_queue,
& OMAP_HDQ_INT_STATUS_RXCOMPLETE) (hdq_data->hdq_irqstatus
&& time_before(jiffies, timeout)) { & OMAP_HDQ_INT_STATUS_RXCOMPLETE),
schedule_timeout_uninterruptible(1); OMAP_HDQ_TIMEOUT);
}
hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0,
OMAP_HDQ_CTRL_STATUS_DIR); OMAP_HDQ_CTRL_STATUS_DIR);
status = hdq_data->hdq_irqstatus; status = hdq_data->hdq_irqstatus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment