Linux Modules
 help / color / mirror / Atom feed
* About THIS_MODULE
From: John Garry @ 2026-07-03 15:33 UTC (permalink / raw)
  To: linux-modules

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

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox