xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Xenomai <xenomai@lists.linux.dev>, Philippe Gerum <rpm@xenomai.org>
Subject: [dovetail-6.7][PATCH 1/2] genirq: irq_pipeline: Add lock guard support for hard spinlocks
Date: Sat, 9 Dec 2023 10:02:57 +0100	[thread overview]
Message-ID: <69ae4c12-197f-423e-b19f-b078573b73e6@siemens.com> (raw)

From: Jan Kiszka <jan.kiszka@siemens.com>

Will be needed when converting guard users of raw spinlocks to hard
ones.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/linux/spinlock.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index d5ab32d64cab..0f01c1cce343 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -554,6 +554,26 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irqsave, raw_spinlock_t,
 		    raw_spin_unlock_irqrestore(_T->lock, _T->flags),
 		    unsigned long flags)
 
+DEFINE_LOCK_GUARD_1(hard_spinlock, hard_spinlock_t,
+		    hard_spin_lock((raw_spinlock_t *)_T->lock),
+		    hard_spin_unlock((raw_spinlock_t *)_T->lock))
+
+DEFINE_LOCK_GUARD_1(hard_spinlock_nested, hard_spinlock_t,
+		    hard_spin_lock_nested((raw_spinlock_t *)_T->lock,
+					  SINGLE_DEPTH_NESTING),
+		    hard_spin_unlock((raw_spinlock_t *)_T->lock))
+
+DEFINE_LOCK_GUARD_1(hard_spinlock_irq, hard_spinlock_t,
+		    hard_spin_lock_irq((raw_spinlock_t *)_T->lock),
+		    hard_spin_unlock_irq((raw_spinlock_t *)_T->lock))
+
+DEFINE_LOCK_GUARD_1(hard_spinlock_irqsave, hard_spinlock_t,
+		    hard_spin_lock_irqsave((raw_spinlock_t *)_T->lock,
+					   _T->flags),
+		    hard_spin_unlock_irqrestore((raw_spinlock_t *)_T->lock,
+						_T->flags),
+		    unsigned long flags)
+
 DEFINE_LOCK_GUARD_1(spinlock, spinlock_t,
 		    spin_lock(_T->lock),
 		    spin_unlock(_T->lock))
-- 
2.35.3

             reply	other threads:[~2023-12-09  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09  9:02 Jan Kiszka [this message]
2023-12-12  8:39 ` [dovetail-6.7][PATCH 1/2] genirq: irq_pipeline: Add lock guard support for hard spinlocks Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69ae4c12-197f-423e-b19f-b078573b73e6@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).