diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2020-04-12 17:47:26 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2020-04-12 17:47:26 +0000 |
commit | ac05e613e225dee266af91661fdd7666e7ac3747 (patch) | |
tree | a70df512110b25cf76e93afb463f4b10a43e0ef5 /sys/dev | |
parent | 019d79d86509f6c105fe095d744691ae07fab5b0 (diff) |
Turn those spinlock and seqlock inline functions to macros
They're macros on Linux because they save state in their flags
parameter. Turning them to static inline functions creates a lot
of -Wuninitialized warnings, so just use macros which set their flags
argument.
ok kettenis@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/include/linux/seqlock.h | 12 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/linux/spinlock.h | 31 |
2 files changed, 25 insertions, 18 deletions
diff --git a/sys/dev/pci/drm/include/linux/seqlock.h b/sys/dev/pci/drm/include/linux/seqlock.h index 7e3ba8dc136..63490a20d93 100644 --- a/sys/dev/pci/drm/include/linux/seqlock.h +++ b/sys/dev/pci/drm/include/linux/seqlock.h @@ -99,12 +99,16 @@ write_seqlock(seqlock_t *sl) } static inline void -write_seqlock_irqsave(seqlock_t *sl, __unused long flags) +__write_seqlock_irqsave(seqlock_t *sl) { mtx_enter(&sl->lock); sl->seq++; membar_producer(); } +#define write_seqlock_irqsave(_sl, _flags) do { \ + _flags = 0; \ + __write_seqlock_irqsave(_sl); \ + } while (0) static inline void write_sequnlock(seqlock_t *sl) @@ -115,12 +119,16 @@ write_sequnlock(seqlock_t *sl) } static inline void -write_sequnlock_irqrestore(seqlock_t *sl, __unused long flags) +__write_sequnlock_irqrestore(seqlock_t *sl) { membar_producer(); sl->seq++; mtx_leave(&sl->lock); } +#define write_sequnlock_irqrestore(_sl, _flags) do { \ + (void)(_flags); \ + __write_sequnlock_irqrestore(_sl); \ + } while (0) static inline unsigned int read_seqbegin(seqlock_t *sl) diff --git a/sys/dev/pci/drm/include/linux/spinlock.h b/sys/dev/pci/drm/include/linux/spinlock.h index 14dc60ebfe2..e40d2872d00 100644 --- a/sys/dev/pci/drm/include/linux/spinlock.h +++ b/sys/dev/pci/drm/include/linux/spinlock.h @@ -8,22 +8,21 @@ #include <linux/preempt.h> #include <linux/bottom_half.h> -static inline void -spin_lock_irqsave(struct mutex *mtxp, __unused unsigned long flags) -{ - mtx_enter(mtxp); -} -static inline void -spin_lock_irqsave_nested(struct mutex *mtxp, __unused unsigned long flags, - __unused int subclass) -{ - mtx_enter(mtxp); -} -static inline void -spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags) -{ - mtx_leave(mtxp); -} +#define spin_lock_irqsave(_mtxp, _flags) do { \ + _flags = 0; \ + mtx_enter(_mtxp); \ + } while (0) + +#define spin_lock_irqsave_nested(_mtxp, _flags, _subclass) do { \ + (void)(_subclass); \ + _flags = 0; \ + mtx_enter(_mtxp); \ + } while (0) + +#define spin_unlock_irqrestore(_mtxp, _flags) do { \ + (void)(_flags); \ + mtx_leave(_mtxp); \ + } while (0) #define spin_lock(mtxp) mtx_enter(mtxp) #define spin_lock_nested(mtxp, l) mtx_enter(mtxp) |