From: Pavel Roskin <proski@gnu.org>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: How to create library module with callbacks?
Date: Fri, 14 Oct 2011 10:42:29 -0400 [thread overview]
Message-ID: <20111014104229.7738c6cc@mj> (raw)
In-Reply-To: <CACna6ryphLSrh5vtOEDXek7s9DGxWKSSgQB-KJVLyzfmBCP3KA@mail.gmail.com>
On Fri, 14 Oct 2011 15:21:16 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:
> I want to create module library, which will handle PHY operations on
> Broadcom card. For most of the time, I'm going to call library
> functions from b43.
>
> However, there are places where I need to call some (b43) driver
> function from library module.
>
> How can I handle that? Should I pass some functions pointers to the
> library? Is that going to work? Or is there a better approach?
Yes, that should work. All modules and the kernel live in the same
address space. But you should make sure that those pointers won't be
used if the calling module is unloaded.
In fact, b43 does it already with mac80211, ssb and bcma. See
b43_hw_ops, b43_ssb_driver and b43_bcma_driver in the code.
--
Regards,
Pavel Roskin
next prev parent reply other threads:[~2011-10-14 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 13:21 How to create library module with callbacks? Rafał Miłecki
2011-10-14 14:42 ` Pavel Roskin [this message]
2011-10-14 14:43 ` Arend van Spriel
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=20111014104229.7738c6cc@mj \
--to=proski@gnu.org \
--cc=linux-wireless@vger.kernel.org \
--cc=zajec5@gmail.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;
as well as URLs for NNTP newsgroup(s).