diff options
author | Michael Brown <mcb30@ipxe.org> | 2011-06-24 16:51:31 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2011-06-28 14:45:11 +0100 |
commit | 3915b660fda1c670bf1d5a5def4f68cd1cfb3967 (patch) | |
tree | 1d1e4abcca15d7f63cc794237f4419e7d6be8311 /src/core/hw.c | |
parent | 019d4c1c1895a672ced583b972b256cd978a6b9f (diff) | |
download | ipxe-3915b660fda1c670bf1d5a5def4f68cd1cfb3967.tar.gz |
[hw] Eliminate polling while waiting for window to open
Polling for the data-transfer window to become open is wasteful. We
can eliminate the polling loop by using hw_step() as the handler for
an xfer_window_changed() event.
If the window is already open at the time of instantiation, then
xfer_window_changed() may never be called. We can cover this case by
using hw_step() as the step() method of a one-shot process. Since the
signature for an xfer_window_changed() method is identical to the
signature for a process step() method, the same function can be used
for both.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/hw.c')
-rw-r--r-- | src/core/hw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/hw.c b/src/core/hw.c index e9c9ffc1d..91736a652 100644 --- a/src/core/hw.c +++ b/src/core/hw.c @@ -36,6 +36,7 @@ static void hw_step ( struct hw *hw ) { } static struct interface_operation hw_xfer_operations[] = { + INTF_OP ( xfer_window_changed, struct hw *, hw_step ), INTF_OP ( intf_close, struct hw *, hw_finished ), }; @@ -43,7 +44,7 @@ static struct interface_descriptor hw_xfer_desc = INTF_DESC ( struct hw, xfer, hw_xfer_operations ); static struct process_descriptor hw_process_desc = - PROC_DESC ( struct hw, process, hw_step ); + PROC_DESC_ONCE ( struct hw, process, hw_step ); static int hw_open ( struct interface *xfer, struct uri *uri __unused ) { struct hw *hw; |