From: Dave Jiang <dave.jiang@intel.com>
To: Dmitry Ilvokhin <d@ilvokhin.com>,
Peter Zijlstra <peterz@infradead.org>,
Dan Williams <djbw@kernel.org>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>, Miguel Ojeda <ojeda@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Marco Elver <elver@google.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH v3 1/4] nvdimm: Convert nvdimm_bus guard to class
Date: Mon, 18 May 2026 08:45:23 -0700 [thread overview]
Message-ID: <8c2135c7-eb97-457e-860c-83f784b5328b@intel.com> (raw)
In-Reply-To: <9857a934214db3460bf55a56e152dedfa1d8bd01.1779116497.git.d@ilvokhin.com>
On 5/18/26 8:21 AM, Dmitry Ilvokhin wrote:
> 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(). 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>
Reviewed-by: Dave Jiang <dave.jiang@intel.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 b199eea3260e..18b64559664b 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);
next prev parent reply other threads:[~2026-05-18 15:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 15:21 [PATCH v3 0/4] cleanup: Remove NULL check from unconditional guards Dmitry Ilvokhin
2026-05-18 15:21 ` [PATCH v3 1/4] nvdimm: Convert nvdimm_bus guard to class Dmitry Ilvokhin
2026-05-18 15:45 ` Dave Jiang [this message]
2026-05-18 15:21 ` [PATCH v3 2/4] genirq: Move NULL check into irqdesc_lock guard unlock expression Dmitry Ilvokhin
2026-05-18 15:21 ` [PATCH v3 3/4] cleanup: Annotate guard constructors with __nonnull() Dmitry Ilvokhin
2026-05-18 18:19 ` Miguel Ojeda
2026-05-19 11:54 ` Dmitry Ilvokhin
2026-05-19 12:45 ` Miguel Ojeda
2026-05-18 15:21 ` [PATCH v3 4/4] cleanup: Remove NULL check from unconditional guards 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=8c2135c7-eb97-457e-860c-83f784b5328b@intel.com \
--to=dave.jiang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=d@ilvokhin.com \
--cc=djbw@kernel.org \
--cc=elver@google.com \
--cc=hpa@zytor.com \
--cc=ira.weiny@intel.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nvdimm@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--cc=vishal.l.verma@intel.com \
/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®