From: John Garry <john.g.garry@oracle.com>
To: linux-modules@vger.kernel.org
Subject: About THIS_MODULE
Date: Fri, 3 Jul 2026 16:33:18 +0100 [thread overview]
Message-ID: <610fc63b-f3dc-4824-99fd-907fc96f3194@oracle.com> (raw)
Hi all,
I have a query which I hope someone can advise on.
I am adding a library API which requires a driver to pass the driver
module pointer to the API.
So we use THIS_MODULE for that purpose.
However, adding a sanity check in the library to ensure that pointer is
set is a challenge. Normally we would check that the module pointer is
non-NULL. However, for a built-in driver module, THIS_MODULE is NULL, so
rely on the non-NULL check.
Any idea how to deal with this?
Cheers
reply other threads:[~2026-07-03 15:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=610fc63b-f3dc-4824-99fd-907fc96f3194@oracle.com \
--to=john.g.garry@oracle.com \
--cc=linux-modules@vger.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