mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Dmitry Ilvokhin" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Dmitry Ilvokhin <d@ilvokhin.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Dave Jiang <dave.jiang@intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/core] nvdimm: Convert nvdimm_bus guard to class
Date: Wed, 03 Jun 2026 14:25:11 -0000	[thread overview]
Message-ID: <178049671157.710.18361358982802138347.tip-bot2@tip-bot2> (raw)
In-Reply-To: <8c0417904d280896ecf2e9923ffa9f20076f59b8.1780064327.git.d@ilvokhin.com>

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     813e5598e5b551a1fb82b516428ce2f135921122
Gitweb:        https://git.kernel.org/tip/813e5598e5b551a1fb82b516428ce2f135921122
Author:        Dmitry Ilvokhin <d@ilvokhin.com>
AuthorDate:    Tue, 02 Jun 2026 07:12:50 
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 03 Jun 2026 11:38:47 +02:00

nvdimm: Convert nvdimm_bus guard to class

The nvdimm_bus guard accepts NULL and skips locking when NULL is passed.
Convert from DEFINE_GUARD() to DEFINE_CLASS() + DEFINE_CLASS_IS_GUARD().

This is a preparatory change for making DEFINE_GUARD() constructors
__nonnull_args(). nvdimm_bus legitimately passes NULL, so it must be
adjusted to avoid a compile error.

No functional change.

Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/8c0417904d280896ecf2e9923ffa9f20076f59b8.1780064327.git.d@ilvokhin.com
---
 drivers/nvdimm/nd.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
index b199eea..18b6455 100644
--- a/drivers/nvdimm/nd.h
+++ b/drivers/nvdimm/nd.h
@@ -632,8 +632,11 @@ u64 nd_region_interleave_set_cookie(struct nd_region *nd_region,
 u64 nd_region_interleave_set_altcookie(struct nd_region *nd_region);
 void nvdimm_bus_lock(struct device *dev);
 void nvdimm_bus_unlock(struct device *dev);
-DEFINE_GUARD(nvdimm_bus, struct device *,
-	     if (_T) nvdimm_bus_lock(_T), if (_T) nvdimm_bus_unlock(_T));
+DEFINE_CLASS(nvdimm_bus, struct device *,
+	     if (_T) nvdimm_bus_unlock(_T),
+	     ({ if (_T) nvdimm_bus_lock(_T); _T; }),
+	     struct device *_T);
+DEFINE_CLASS_IS_GUARD(nvdimm_bus);
 
 bool is_nvdimm_bus_locked(struct device *dev);
 void nvdimm_check_and_set_ro(struct gendisk *disk);

  reply	other threads:[~2026-06-03 14:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  7:12 [PATCH v5 0/4] cleanup: Remove NULL check from unconditional guards Dmitry Ilvokhin
2026-06-02  7:12 ` [PATCH v5 1/4] nvdimm: Convert nvdimm_bus guard to class Dmitry Ilvokhin
2026-06-03 14:25   ` tip-bot2 for Dmitry Ilvokhin [this message]
2026-06-02  7:12 ` [PATCH v5 2/4] genirq: Move NULL check into irqdesc_lock guard unlock expression Dmitry Ilvokhin
2026-06-02 20:37   ` Thomas Gleixner
2026-06-03 14:25   ` [tip: locking/core] " tip-bot2 for Dmitry Ilvokhin
2026-06-02  7:12 ` [PATCH v5 3/4] cleanup: Annotate guard constructors with nonnull Dmitry Ilvokhin
2026-06-02  7:32   ` Miguel Ojeda
2026-06-02  9:19     ` Dmitry Ilvokhin
2026-06-03 14:25   ` [tip: locking/core] " tip-bot2 for Dmitry Ilvokhin
2026-06-05  5:46   ` [PATCH v5 3/4] " Dan Carpenter
2026-06-05 10:46     ` Dmitry Ilvokhin
2026-06-05 13:08       ` [tip: locking/core] cleanup: Specify nonnull argument index tip-bot2 for Dmitry Ilvokhin
2026-06-02  7:12 ` [PATCH v5 4/4] cleanup: Remove NULL check from unconditional guards Dmitry Ilvokhin
2026-06-03 14:25   ` [tip: locking/core] " tip-bot2 for Dmitry Ilvokhin

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=178049671157.710.18361358982802138347.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=d@ilvokhin.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®