Skip to content

Commit 00801cb

Browse files
committed
Refactor for readability
Use switches this looks cleaner and easier to read. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 0a3ea77 commit 00801cb

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

fw_if/umac_if/src/common/fmac_api_common.c

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,36 +66,43 @@ static int nrf_wifi_patch_version_compat(struct nrf_wifi_fmac_dev_ctx *fmac_dev_
6666
}
6767

6868
static int nrf_wifi_patch_feature_flags_compat(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
69-
const unsigned int feature_flags)
69+
const unsigned int feature_flags)
7070
{
71-
if (fmac_dev_ctx->op_mode == NRF_WIFI_OP_MODE_RT) {
71+
switch (fmac_dev_ctx->op_mode) {
72+
case NRF_WIFI_OP_MODE_RT:
7273
if (!(feature_flags & NRF70_FEAT_RADIO_TEST)) {
7374
nrf_wifi_osal_log_err("Radio test feature flag not set");
7475
return -1;
7576
}
76-
} else if (fmac_dev_ctx->op_mode == NRF_WIFI_OP_MODE_SYS) {
77+
break;
78+
79+
case NRF_WIFI_OP_MODE_SYS:
7780
#ifdef NRF70_SCAN_ONLY
78-
if (!(feature_flags & NRF70_FEAT_SCAN_ONLY)) {
79-
nrf_wifi_osal_log_err("Scan only feature flag not set");
80-
return -1;
81-
}
81+
if (!(feature_flags & NRF70_FEAT_SCAN_ONLY)) {
82+
nrf_wifi_osal_log_err("Scan only feature flag not set");
83+
return -1;
84+
}
8285
#elif defined(NRF70_SYSTEM_MODE)
83-
if (!(feature_flags & NRF70_FEAT_SYSTEM_MODE) &&
84-
!(feature_flags & NRF70_FEAT_SYSTEM_WITH_RAW_MODES)) {
85-
nrf_wifi_osal_log_err("System mode or system with raw mode feature flag not set");
86-
return -1;
87-
}
86+
if (!(feature_flags & NRF70_FEAT_SYSTEM_MODE) &&
87+
!(feature_flags & NRF70_FEAT_SYSTEM_WITH_RAW_MODES)) {
88+
nrf_wifi_osal_log_err("System mode or system with raw mode feature flag not set");
89+
return -1;
90+
}
8891
#else
89-
nrf_wifi_osal_log_err("Invalid feature flags: 0x%x or build configuration",
90-
feature_flags);
91-
return -1;
92+
nrf_wifi_osal_log_err("Invalid feature flags: 0x%x or build configuration",
93+
feature_flags);
94+
return -1;
9295
#endif
93-
} else if (fmac_dev_ctx->op_mode == NRF_WIFI_OP_MODE_OFF_RAW_TX) {
96+
break;
97+
98+
case NRF_WIFI_OP_MODE_OFF_RAW_TX:
9499
if (!(feature_flags & NRF70_FEAT_OFFLOADED_RAW_TX)) {
95100
nrf_wifi_osal_log_err("Offloaded raw tx feature flag not set");
96101
return -1;
97102
}
98-
} else {
103+
break;
104+
105+
default:
99106
nrf_wifi_osal_log_err("Invalid op_mode: %d", fmac_dev_ctx->op_mode);
100107
return -1;
101108
}

0 commit comments

Comments
 (0)