eth/ksdk: Use k_sem_init() initial count
Remove the existing code that iterates over k_sem_give() and setup the
initial counter directly, take the opportunity to set the maximum count.
Change-Id: Ib91ea263567ff761e4953c142a22a56658efe293
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
diff --git a/drivers/ethernet/eth_ksdk.c b/drivers/ethernet/eth_ksdk.c
index c4bf4ea..9cdb195 100644
--- a/drivers/ethernet/eth_ksdk.c
+++ b/drivers/ethernet/eth_ksdk.c
@@ -289,10 +289,8 @@
.txBufferAlign = tx_buffer[0],
};
- k_sem_init(&context->tx_buf_sem, 0, UINT_MAX);
- for (int i = 0; i < CONFIG_ETH_KSDK_TX_BUFFERS; i++) {
- k_sem_give(&context->tx_buf_sem);
- }
+ k_sem_init(&context->tx_buf_sem,
+ CONFIG_ETH_KSDK_TX_BUFFERS, CONFIG_ETH_KSDK_TX_BUFFERS);
sys_clock = CLOCK_GetFreq(kCLOCK_CoreSysClk);