Skip to content

Commit 9548507

Browse files
committed
ugly but working patch to avoid ALSA DMA callback traps on FunKey S
1 parent 7bcba86 commit 9548507

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

kernel/async.c

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,40 @@ static void async_run_entry_fn(struct work_struct *work)
113113
unsigned long flags;
114114
ktime_t uninitialized_var(calltime), delta, rettime;
115115

116-
/* 1) run (and print duration) */
117-
if (initcall_debug && system_state < SYSTEM_RUNNING) {
118-
pr_debug("calling %lli_%pF @ %i\n",
119-
(long long)entry->cookie,
120-
entry->func, task_pid_nr(current));
121-
calltime = ktime_get();
122-
}
123-
entry->func(entry->data, entry->cookie);
124-
if (initcall_debug && system_state < SYSTEM_RUNNING) {
125-
rettime = ktime_get();
126-
delta = ktime_sub(rettime, calltime);
127-
pr_debug("initcall %lli_%pF returned 0 after %lld usecs\n",
128-
(long long)entry->cookie,
129-
entry->func,
130-
(long long)ktime_to_ns(delta) >> 10);
131-
}
132-
133-
/* 2) remove self from the pending queues */
134-
spin_lock_irqsave(&async_lock, flags);
135-
list_del_init(&entry->domain_list);
136-
list_del_init(&entry->global_list);
116+
// Ugly (but working) Hack to avoid ALSA traps on FunKey S
117+
if(entry > 0xc0004000){
118+
119+
/* 1) run (and print duration) */
120+
if (initcall_debug && system_state < SYSTEM_RUNNING) {
121+
pr_debug("calling %lli_%pF @ %i\n",
122+
(long long)entry->cookie,
123+
entry->func, task_pid_nr(current));
124+
calltime = ktime_get();
125+
}
126+
entry->func(entry->data, entry->cookie);
127+
if (initcall_debug && system_state < SYSTEM_RUNNING) {
128+
rettime = ktime_get();
129+
delta = ktime_sub(rettime, calltime);
130+
pr_debug("initcall %lli_%pF returned 0 after %lld usecs\n",
131+
(long long)entry->cookie,
132+
entry->func,
133+
(long long)ktime_to_ns(delta) >> 10);
134+
}
135+
136+
/* 2) remove self from the pending queues */
137+
spin_lock_irqsave(&async_lock, flags);
138+
list_del_init(&entry->domain_list);
139+
list_del_init(&entry->global_list);
137140

138-
/* 3) free the entry */
139-
kfree(entry);
140-
atomic_dec(&entry_count);
141+
/* 3) free the entry */
142+
kfree(entry);
143+
atomic_dec(&entry_count);
141144

142-
spin_unlock_irqrestore(&async_lock, flags);
145+
spin_unlock_irqrestore(&async_lock, flags);
146+
}
147+
/*else{
148+
printk(KERN_ERR "Entry NULL\n");
149+
}*/
143150

144151
/* 4) wake up any waiters */
145152
wake_up(&async_done);

0 commit comments

Comments
 (0)