#include #include #include #include struct once_work { struct work_struct work; struct static_key *key; }; static void once_deferred(struct work_struct *w) { struct once_work *work; work = container_of(w, struct once_work, work); BUG_ON(!static_key_enabled(work->key)); static_key_slow_dec(work->key); kfree(work); } static void once_disable_jump(struct static_key *key) { struct once_work *w; w = kmalloc(sizeof(*w), GFP_ATOMIC); if (!w) return; INIT_WORK(&w->work, once_deferred); w->key = key; schedule_work(&w->work); } static DEFINE_SPINLOCK(once_lock); bool __do_once_start(bool *done, unsigned long *flags) __acquires(once_lock) { spin_lock_irqsave(&once_lock, *flags); if (*done) { spin_unlock_irqrestore(&once_lock, *flags); /* Keep sparse happy by restoring an even lock count on * this lock. In case we return here, we don't call into * __do_once_done but return early in the DO_ONCE() macro. */ __acquire(once_lock); return false; } return true; } EXPORT_SYMBOL(__do_once_start); void __do_once_done(bool *done, struct static_key *once_key, unsigned long *flags) __releases(once_lock) { *done = true; spin_unlock_irqrestore(&once_lock, *flags); once_disable_jump(once_key); } EXPORT_SYMBOL(__do_once_done); t' value='switch'/> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2017-01-29 12:40:52 +0100
committerKalle Valo <kvalo@codeaurora.org>2017-01-31 09:08:52 +0200
commit33e962c8871f015f5c8978384553dddcf5b81b22 (patch)
tree43aff96c2ee21d9e0fa2018457778a4de52053cd /include/net/tc_act
parent575ddce0507789bf9830d089557d2199d2f91865 (diff)
rt2x00: fix clk_get call
clk_get() takes two arguments and might return ERR_PTR(), so we have to nullify pointer on that case, to do not break further call to clk_get_rate(). Reported-by: Felix Fietkau <nbd@nbd.name> Fixes: 34db70b92fae ("rt2x00: add copy of clk for soc devices") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'include/net/tc_act')