On 2/27/26 20:49, Jithu Joseph wrote:
On 2/26/2026 11:52 PM, Cédric Le Goater wrote:
On 2/27/26 02:43, Jithu Joseph wrote:

Apologies for chiming in this late ... I only got a chance to test this last 
week
This really is a minor comment ... can be addressed subsequently

No problem. It is not merged yet and fixes are expected.


...

+static int mock_i3c_target_tx(I3CTarget *i3c, const uint8_t *data,
+                              uint32_t num_to_send, uint32_t *num_sent)
+{
+    MockI3cTargetState *s = MOCK_I3C_TARGET(i3c);
+    int ret;
+    uint32_t to_write;
+
+    if (s->cfg.ibi_magic && num_to_send == 1 && s->cfg.ibi_magic == *data) {
+        mock_i3c_target_ibi_timer_start(s);
+        return 0;
+    }
+
+    /* Bounds check. */
+    if (num_to_send + s->p_buf > s->cfg.buf_size) {
+        to_write = s->cfg.buf_size - s->p_buf;
+        ret = -1;
+    } else {
+        to_write = num_to_send;
+        ret = 0;
+    }
+    for (uint32_t i = 0; i < to_write; i++) {
+        trace_mock_i3c_target_tx(data[i]);
+        s->buf[s->p_buf] = data[i];
+        s->p_buf++;
+    }


num_sent is never updated prior to return, so the traces (from caller i3c_send) 
looked a bit confusing

<snip>
mock_i3c_target_tx I3C mock target write 0x12
i3c_send I3C send 0/1 bytes, ack=1   ---------------------> instead of 1/1 bytes
mock_i3c_target_tx I3C mock target write 0x34
i3c_send I3C send 0/1 bytes, ack=1
</snip>

Something like below is needed
+ *num_sent = to_write
(might also needed in the ibi magic path above)


Please send a patch.

Would you like me to revise this patch with the changes, and send it 
in-reply-to v7 18/22 ?

or would you like me to first apply the whole series and create a new patch 
with just the delta suggested above ?

I rather have new patches on top of this series for now. I might merge
some if they are trivial.

Thanks,

C.

Reply via email to