Commit 5eecc553 authored by Dmitrii Sharshakov's avatar Dmitrii Sharshakov Committed by Johan Hedberg
Browse files

drivers: ipm: esp32: properly handle send wait parameter



As clarified by the subsystem maintainers, wait should be treated as a
boolean, not a duration.

Signed-off-by: default avatarDmitrii Sharshakov <d3dx12.xx@gmail.com>
parent 8ff638c5
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -121,18 +121,14 @@ static int esp32_ipm_send(const struct device *dev, int wait, uint32_t id,
	while (!atomic_cas(&dev_data->control->lock,
		ESP32_IPM_LOCK_FREE_VAL,
		dev_data->this_core_id)) {

		k_busy_wait(1);

		if ((wait != -1) && (wait > 0)) {
			/* lock could not be held this time, return */
			wait--;
		/* Do not wait for availability */
		if (wait == 0) {
			irq_unlock(key);

				return -ETIMEDOUT;
			}
			return -EBUSY;
		}

		k_busy_wait(1);
	}

	/* Only the lower 16bits of id are used */