public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Beckett <bob.beckett@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: try_module_get question
Date: Mon, 16 Jul 2007 14:22:53 +0100	[thread overview]
Message-ID: <469B712D.80208@googlemail.com> (raw)

Hi all,

Im a newcomer to kernel development, and have my first question :

I want to create a small module that simply powers on an FPGA, and 
powers it off when it is released. Two other modules will then depend on 
this module and control different devices programmed into the FPGA. So 
that the shared module does not get removed before any of the device 
drivers, I want to do a try_module_get from each driver targeting the 
shared module. What is the easiest way to get a reference to the shared 
module?

My current thought is to export a function that will return a reference 
to it (using THIS_MODULE from the shared module). The device driver 
modules can then try_module_get the returned module. Is this the best 
way to do this?

Is there an alternative way? maybe based on a similar system to the 
device / driver matching code?
There seem to be a lot of FAQs online saying that you need to get and 
put a module before calling any function that may stall for example, but 
they dont tell you how to get the module reference to use.

Or am I just missing something obvious?

Thanks

Robert Beckett.

             reply	other threads:[~2007-07-16 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16 13:22 Robert Beckett [this message]
2007-07-21 15:32 ` try_module_get question Jan Engelhardt

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=469B712D.80208@googlemail.com \
    --to=bob.beckett@gmail.com \
    --cc=linux-kernel@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