drivers: can: mcux: flexcan: assume can_send() always provides callback

Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

This saves approximately 500 bytes of SRAM on the frdm_k64f board, while on
the mimxrt1024_evk board the saving is approximately 2.5 kbytes of SRAM,
both when running in default configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
diff --git a/drivers/can/can_mcux_flexcan.c b/drivers/can/can_mcux_flexcan.c
index 0f570bf..1a03b52 100644
--- a/drivers/can/can_mcux_flexcan.c
+++ b/drivers/can/can_mcux_flexcan.c
@@ -104,8 +104,6 @@
 };
 
 struct mcux_flexcan_tx_callback {
-	struct k_sem done;
-	int status;
 	flexcan_frame_t frame;
 	can_tx_callback_t function;
 	void *arg;
@@ -408,6 +406,8 @@
 	status_t status;
 	int alloc;
 
+	__ASSERT_NO_MSG(callback != NULL);
+
 	if (frame->dlc > CAN_MAX_DLC) {
 		LOG_ERR("DLC of %d exceeds maximum (%d)", frame->dlc, CAN_MAX_DLC);
 		return -EINVAL;
@@ -445,11 +445,6 @@
 		return -EIO;
 	}
 
-	if (callback == NULL) {
-		k_sem_take(&data->tx_cbs[alloc].done, K_FOREVER);
-		return data->tx_cbs[alloc].status;
-	}
-
 	return 0;
 }
 
@@ -647,13 +642,8 @@
 			if (atomic_test_and_clear_bit(data->tx_allocs, alloc)) {
 				FLEXCAN_TransferAbortSend(config->base, &data->handle,
 							  ALLOC_IDX_TO_TXMB_IDX(alloc));
-				if (function != NULL) {
-					function(dev, -ENETUNREACH, arg);
-				} else {
-					data->tx_cbs[alloc].status = -ENETUNREACH;
-					k_sem_give(&data->tx_cbs[alloc].done);
-				}
 
+				function(dev, -ENETUNREACH, arg);
 				k_sem_give(&data->tx_allocs_sem);
 			}
 		}
@@ -675,12 +665,7 @@
 	arg = data->tx_cbs[alloc].arg;
 
 	if (atomic_test_and_clear_bit(data->tx_allocs, alloc)) {
-		if (function != NULL) {
-			function(dev, 0, arg);
-		} else {
-			data->tx_cbs[alloc].status = 0;
-			k_sem_give(&data->tx_cbs[alloc].done);
-		}
+		function(dev, 0, arg);
 		k_sem_give(&data->tx_allocs_sem);
 	}
 }
@@ -774,7 +759,6 @@
 	flexcan_config_t flexcan_config;
 	uint32_t clock_freq;
 	int err;
-	int i;
 
 	if (config->phy != NULL) {
 		if (!device_is_ready(config->phy)) {
@@ -792,10 +776,6 @@
 	k_sem_init(&data->tx_allocs_sem, MCUX_FLEXCAN_MAX_TX,
 		   MCUX_FLEXCAN_MAX_TX);
 
-	for (i = 0; i < ARRAY_SIZE(data->tx_cbs); i++) {
-		k_sem_init(&data->tx_cbs[i].done, 0, 1);
-	}
-
 	data->timing.sjw = config->sjw;
 	if (config->sample_point && USE_SP_ALGO) {
 		err = can_calc_timing(dev, &data->timing, config->bitrate,