Skip to content

Commit 86ca32a

Browse files
committed
Revert "modules: nrf_wifi: Use spinlocks"
This reverts commit 3e9dffb. Though this works fine, when CONFIG_ASSERT=y the spinlock validation fails as the underlying code though uses OSAL spinlock APIs is not ready * sleeping with spinlock held * multiple threads taking the same spinlock (might work on UP, but not on SMP on the same CPU) Revert this for now, till the underyling is robust. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
1 parent 8add921 commit 86ca32a

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

modules/nrf_wifi/os/shim.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,9 @@ static void zep_shim_qspi_cpy_to(void *priv, unsigned long addr, const void *src
195195
}
196196
#endif /* !CONFIG_NRF71_ON_IPC */
197197

198-
struct zep_shim_spinlock {
199-
struct k_spinlock lock;
200-
k_spinlock_key_t key;
201-
};
202-
203198
static void *zep_shim_spinlock_alloc(void)
204199
{
205-
struct zep_shim_spinlock *slock = NULL;
200+
struct k_mutex *lock = NULL;
206201

207202
slock = k_heap_aligned_alloc(wifi_ctrl_pool, WORD_SIZE, sizeof(*slock), K_FOREVER);
208203
if (!slock) {
@@ -211,7 +206,7 @@ static void *zep_shim_spinlock_alloc(void)
211206
memset(slock, 0, sizeof(*slock));
212207
}
213208

214-
return slock;
209+
return lock;
215210
}
216211

217212
static void zep_shim_spinlock_free(void *lock)
@@ -223,38 +218,29 @@ static void zep_shim_spinlock_free(void *lock)
223218

224219
static void zep_shim_spinlock_init(void *lock)
225220
{
226-
/* No explicit initialization needed for k_spinlock_t */
227-
ARG_UNUSED(lock);
221+
k_mutex_init(lock);
228222
}
229223

230224
static void zep_shim_spinlock_take(void *lock)
231225
{
232-
struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock;
233-
234-
slock->key = k_spin_lock(&slock->lock);
226+
k_mutex_lock(lock, K_FOREVER);
235227
}
236228

237229
static void zep_shim_spinlock_rel(void *lock)
238230
{
239-
struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock;
240-
241-
k_spin_unlock(&slock->lock, slock->key);
231+
k_mutex_unlock(lock);
242232
}
243233

244234
static void zep_shim_spinlock_irq_take(void *lock, unsigned long *flags)
245235
{
246-
struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock;
247-
248236
ARG_UNUSED(flags);
249-
slock->key = k_spin_lock(&slock->lock);
237+
k_mutex_lock(lock, K_FOREVER);
250238
}
251239

252240
static void zep_shim_spinlock_irq_rel(void *lock, unsigned long *flags)
253241
{
254-
struct zep_shim_spinlock *slock = (struct zep_shim_spinlock *)lock;
255-
256242
ARG_UNUSED(flags);
257-
k_spin_unlock(&slock->lock, slock->key);
243+
k_mutex_unlock(lock);
258244
}
259245

260246
static int zep_shim_pr_dbg(const char *fmt, va_list args)

0 commit comments

Comments
 (0)