* try_module_get question
@ 2007-07-16 13:22 Robert Beckett
2007-07-21 15:32 ` Jan Engelhardt
0 siblings, 1 reply; 2+ messages in thread
From: Robert Beckett @ 2007-07-16 13:22 UTC (permalink / raw)
To: linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: try_module_get question
2007-07-16 13:22 try_module_get question Robert Beckett
@ 2007-07-21 15:32 ` Jan Engelhardt
0 siblings, 0 replies; 2+ messages in thread
From: Jan Engelhardt @ 2007-07-21 15:32 UTC (permalink / raw)
To: Robert Beckett; +Cc: linux-kernel
On Jul 16 2007 14:22, Robert Beckett wrote:
> 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.
How do they depend on it?
> 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.
Jan
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-21 15:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-16 13:22 try_module_get question Robert Beckett
2007-07-21 15:32 ` Jan Engelhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox