mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
locking: Introduce __cleanup() based infrastructure
Use __attribute__((__cleanup__(func))) to build: - simple auto-release pointers using __free() - 'classes' with constructor and destructor semantics for scope-based resource management. - lock guards based on the above classes. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#define _LINUX_TRACE_IRQFLAGS_H
|
||||
|
||||
#include <linux/typecheck.h>
|
||||
#include <linux/cleanup.h>
|
||||
#include <asm/irqflags.h>
|
||||
#include <asm/percpu.h>
|
||||
|
||||
@@ -267,4 +268,10 @@ extern void warn_bogus_irq_restore(void);
|
||||
|
||||
#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
|
||||
|
||||
DEFINE_LOCK_GUARD_0(irq, local_irq_disable(), local_irq_enable())
|
||||
DEFINE_LOCK_GUARD_0(irqsave,
|
||||
local_irq_save(_T->flags),
|
||||
local_irq_restore(_T->flags),
|
||||
unsigned long flags)
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user