]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
xen/spinlock: Don't perpetuate broken API in new logic
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 19 Mar 2024 11:17:16 +0000 (11:17 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Mar 2025 12:53:15 +0000 (12:53 +0000)
The single user wants this the sane way around.  Write it as a normal static
inline just like rspin_lock().

Fixes: cc3e8df542ed ("xen/spinlock: add rspin_[un]lock_irq[save|restore]()")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
xen/drivers/char/console.c
xen/include/xen/spinlock.h

index 2f48001a4419777c28f0353de9f4bfd7d93cfff2..b3bc4bc96304fbfb6a515d3b22c97c319b8f4517 100644 (file)
@@ -1158,11 +1158,7 @@ void console_end_log_everything(void)
 
 unsigned long console_lock_recursive_irqsave(void)
 {
-    unsigned long flags;
-
-    rspin_lock_irqsave(&console_lock, flags);
-
-    return flags;
+    return rspin_lock_irqsave(&console_lock);
 }
 
 void console_unlock_recursive_irqrestore(unsigned long flags)
index 8825affb25ca1a1c07d568c1b808e07dd1c487ac..ca9d8c7ec0a104f10f619b910af271b1d165ec57 100644 (file)
@@ -303,12 +303,6 @@ static always_inline void spin_lock_if(bool condition, spinlock_t *l)
  */
 bool _rspin_trylock(rspinlock_t *lock);
 void _rspin_lock(rspinlock_t *lock);
-#define rspin_lock_irqsave(l, f)                                \
-    ({                                                          \
-        BUILD_BUG_ON(sizeof(f) != sizeof(unsigned long));       \
-        (f) = _rspin_lock_irqsave(l);                           \
-        block_lock_speculation();                               \
-    })
 unsigned long _rspin_lock_irqsave(rspinlock_t *lock);
 void _rspin_unlock(rspinlock_t *lock);
 void _rspin_unlock_irqrestore(rspinlock_t *lock, unsigned long flags);
@@ -321,6 +315,14 @@ static always_inline void rspin_lock(rspinlock_t *lock)
     block_lock_speculation();
 }
 
+static always_inline unsigned long rspin_lock_irqsave(rspinlock_t *lock)
+{
+    unsigned long flags = _rspin_lock_irqsave(lock);
+
+    block_lock_speculation();
+    return flags;
+}
+
 #define rspin_trylock(l)              lock_evaluate_nospec(_rspin_trylock(l))
 #define rspin_unlock(l)               _rspin_unlock(l)
 #define rspin_unlock_irqrestore(l, f) _rspin_unlock_irqrestore(l, f)