瀏覽代碼

[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>
tags/v1.20.1
Michael Brown 13 年之前
父節點
當前提交
3915b660fd
共有 1 個檔案被更改,包括 2 行新增1 行删除
  1. 2
    1
      src/core/hw.c

+ 2
- 1
src/core/hw.c 查看文件

@@ -36,6 +36,7 @@ static void hw_step ( struct hw *hw ) {
36 36
 }
37 37
 
38 38
 static struct interface_operation hw_xfer_operations[] = {
39
+	INTF_OP ( xfer_window_changed, struct hw *, hw_step ),
39 40
 	INTF_OP ( intf_close, struct hw *, hw_finished ),
40 41
 };
41 42
 
@@ -43,7 +44,7 @@ static struct interface_descriptor hw_xfer_desc =
43 44
 	INTF_DESC ( struct hw, xfer, hw_xfer_operations );
44 45
 
45 46
 static struct process_descriptor hw_process_desc =
46
-	PROC_DESC ( struct hw, process, hw_step );
47
+	PROC_DESC_ONCE ( struct hw, process, hw_step );
47 48
 
48 49
 static int hw_open ( struct interface *xfer, struct uri *uri __unused ) {
49 50
 	struct hw *hw;

Loading…
取消
儲存