Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

NeilBrown and committed by
Greg Kroah-Hartman
b7e938d0 7b5362a6

+6 -9
+6 -9
drivers/w1/masters/omap_hdq.c
··· 354 354 { 355 355 int ret = 0; 356 356 u8 status; 357 - unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT; 358 357 359 358 ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); 360 359 if (ret < 0) { ··· 371 372 OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO, 372 373 OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO); 373 374 /* 374 - * The RX comes immediately after TX. It 375 - * triggers another interrupt before we 376 - * sleep. So we have to wait for RXCOMPLETE bit. 375 + * The RX comes immediately after TX. 377 376 */ 378 - while (!(hdq_data->hdq_irqstatus 379 - & OMAP_HDQ_INT_STATUS_RXCOMPLETE) 380 - && time_before(jiffies, timeout)) { 381 - schedule_timeout_uninterruptible(1); 382 - } 377 + wait_event_timeout(hdq_wait_queue, 378 + (hdq_data->hdq_irqstatus 379 + & OMAP_HDQ_INT_STATUS_RXCOMPLETE), 380 + OMAP_HDQ_TIMEOUT); 381 + 383 382 hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, 384 383 OMAP_HDQ_CTRL_STATUS_DIR); 385 384 status = hdq_data->hdq_irqstatus;