From 6910714c2cb8ac35e656771d4f0f06d4831d23bf Mon Sep 17 00:00:00 2001 From: Lephe Date: Thu, 16 Feb 2023 16:09:53 +0100 Subject: [PATCH] asyncio: remove unused field asyncio_op_t.flying_w --- include/gint/drivers/asyncio.h | 21 ++++++++++++--------- src/usb/asyncio.c | 8 +++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/gint/drivers/asyncio.h b/include/gint/drivers/asyncio.h index 7943d3c..fc42436 100644 --- a/include/gint/drivers/asyncio.h +++ b/include/gint/drivers/asyncio.h @@ -53,15 +53,18 @@ The invariants and meaning for each state are as follow: - State Characterization Description + State(s) Characterization Description ============================================================================ IDLE type == ASYNCIO_NONE No I/O operation - PENDING data_w && !flying_w \ Ready to write pending data - && round_size == 0 - WRITING round_size > 0 CPU/DMA write to HW in progress - FLYING-WRITE flying_w && type == WRITE HW transmission in progress + ---------------------------------------------------------------------------- + PENDING data_w && round_size == 0 Ready to write pending data + ---------------------------------------------------------------------------- + WRITING, round_size > 0 CPU/DMA write to HW in progress + FLYING-WRITE HW transmission in progress + ---------------------------------------------------------------------------- IN-PROGRESS !data_w && type == WRITE Waiting for write(2) or fsync(2) - FLYING-SYNC flying_w && type == SYNC HW commit in progress + ---------------------------------------------------------------------------- + FLYING-SYNC type == ASYNCIO_SYNC HW commit in progress ============================================================================ For a read: @@ -87,8 +90,11 @@ State Characterization Description ============================================================================ IDLE-EMPTY type == ASYNCIO_NONE No I/O operation + ---------------------------------------------------------------------------- IDLE-READY !data_r && buffer_size > 0 Hardware waiting for us to read + ---------------------------------------------------------------------------- WAITING data_r && !buffer_size Waiting for further HW data + ---------------------------------------------------------------------------- READING round_size > 0 DMA/CPU read from HW in progress ============================================================================ @@ -127,9 +133,6 @@ typedef volatile struct Usually, this is assigned for the duration of hardware transaction. This value is user-managed and not modified by asyncio_op functions. */ uint8_t controller; - /* Whether a hardware operation is in progress ("flying" write states) */ - // TODO: Do we actually set and maintain this member?! - bool flying_w; /** Internal information **/ diff --git a/src/usb/asyncio.c b/src/usb/asyncio.c index 5bf7fa3..b008848 100644 --- a/src/usb/asyncio.c +++ b/src/usb/asyncio.c @@ -11,9 +11,12 @@ bool asyncio_op_busy(asyncio_op_t const *op) /* WAITING and READING states are busy */ if(op->type == ASYNCIO_READ) return op->round_size || op->data_r != NULL; - /* WRITING, FLYING-WRITE, FLYING-COMMIT and PENDING states are busy */ + /* WRITING, FLYING-WRITE and PENDING states are busy */ if(op->type == ASYNCIO_WRITE) - return op->round_size || op->flying_w || op->data_w != NULL; + return op->data_w != NULL; + /* FLYING-COMMIT state is busy */ + if(op->type == ASYNCIO_SYNC) + return true; return false; } @@ -62,7 +65,6 @@ void asyncio_op_finish_call(asyncio_op_t *op) op->size = 0; op->callback = GINT_CALL_NULL; op->round_size = 0; - op->flying_w = false; } else { asyncio_op_clear(op);