From ee80fadb9dffc0d8aaac1bfeee52c4ba2ffabaa7 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 20 Aug 2026 12:53:09 -0700 Subject: [PATCH] [csl] simplify `SubMac::SetCslParams()` (#13530) This commit simplifies `SubMac::SetCslParams()` by setting `mCslChannel` directly and using a single `VerifyOrExit` check to detect if `mCslPeriod` or `mCslPeerShort` changed, removing redundant temporary variables and checks. --- src/core/mac/sub_mac_csl_receiver.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/core/mac/sub_mac_csl_receiver.cpp b/src/core/mac/sub_mac_csl_receiver.cpp index ab7cb48ef..155d47fcd 100644 --- a/src/core/mac/sub_mac_csl_receiver.cpp +++ b/src/core/mac/sub_mac_csl_receiver.cpp @@ -111,15 +111,10 @@ exit: void SubMac::SetCslParams(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr) { - bool diffPeriod = aPeriod != mCslPeriod; - bool diffChannel = aChannel != mCslChannel; - bool diffPeer = aShortAddr != mCslPeerShort; - bool retval = diffPeriod || diffChannel || diffPeer; - - VerifyOrExit(retval); mCslChannel = aChannel; - VerifyOrExit(diffPeriod || diffPeer); + VerifyOrExit((aPeriod != mCslPeriod) || (aShortAddr != mCslPeerShort)); + mCslPeerShort = aShortAddr; IgnoreError(Get().EnableCsl(aPeriod, aShortAddr, aExtAddr));