Skip to content

Commit

Permalink
eth/ksdk: Use k_sem_init() initial count
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mshawcroft authored and Anas Nashif committed Dec 21, 2016
1 parent 5fbbe44 commit 4ede76a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/ethernet/eth_ksdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,8 @@ static int eth_0_init(struct device *dev)
.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);

Expand Down

0 comments on commit 4ede76a

Please sign in to comment.