Skip to content

Commit 0251d87

Browse files
author
Frank Duerr
committed
Fixed bug: mutex called from ISR.
1 parent 021d90b commit 0251d87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/ethernet/eth_nxp_enet.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ static inline void ts_register_tx_event(const struct device *dev,
164164

165165
if (pkt && atomic_get(&pkt->atomic_ref) > 0) {
166166
if (eth_get_ptp_data(net_pkt_iface(pkt), pkt) && frameinfo->isTsAvail) {
167-
k_mutex_lock(data->ptp.ptp_mutex, K_FOREVER);
168-
167+
// Timestamp is written in ISR.
168+
// Semaphore ptp_ts_sem ensures sequential execution of writing the timestamp
169+
// here and subsequently reading the timestamp after waiting for
170+
// ptp_ts_sem in eth_wait_for_ptp_ts().
169171
pkt->timestamp.nanosecond = frameinfo->timeStamp.nanosecond;
170172
pkt->timestamp.second = frameinfo->timeStamp.second;
171173

172174
net_if_add_tx_timestamp(pkt);
173175
k_sem_give(&data->ptp.ptp_ts_sem);
174-
175-
k_mutex_unlock(data->ptp.ptp_mutex);
176176
}
177177
net_pkt_unref(pkt);
178178
}

0 commit comments

Comments
 (0)