From: Marek Vasut Date: Mon, 27 Oct 2025 16:38:38 +0000 (+0100) Subject: mailbox: Allow operation without .recv callback X-Git-Tag: v2026.01-rc2~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b102d2fe17884d46cb555474310c8c942014d58;p=thirdparty%2Fu-boot.git mailbox: Allow operation without .recv callback Some shared memory mailboxes may have empty receive operation, because the data are polled by upper layers directly from the shared memory region, and there is no completion interrupt or bit of any sort. Allow empty .recv callback, and if the .recv callback is empty, exit from mbox_recv() right away, because any polling for completion here would be meaningless. Signed-off-by: Marek Vasut Reviewed-by: Alice Guo --- diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c index 4bf4987ce0a..fef437a4281 100644 --- a/drivers/mailbox/mailbox-uclass.c +++ b/drivers/mailbox/mailbox-uclass.c @@ -132,6 +132,15 @@ int mbox_recv(struct mbox_chan *chan, void *data, ulong timeout_us) debug("%s(chan=%p, data=%p, timeout_us=%ld)\n", __func__, chan, data, timeout_us); + /* + * Some shared memory mailboxes may have empty receive operation, + * because the data are polled by upper layers directly from the + * shared memory region, and there is no completion interrupt or + * bit of any sort. + */ + if (!ops->recv) + return 0; + start_time = timer_get_us(); /* * Account for partial us ticks, but if timeout_us is 0, ensure we