kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: EXPORT_SYMBOL and rebinding functions
Date: Tue, 03 Jun 2014 09:03:13 -0400	[thread overview]
Message-ID: <38416.1401800593@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Mon, 02 Jun 2014 20:29:16 -0700." <1401766156.2748.6.camel@mwynne-laptop>

On Mon, 02 Jun 2014 20:29:16 -0700, Peter Tosh said:


> function_1()
> {
> 	do some stuff
> }
>
> my_print_function = function_1
>
> EXPORT_SYMBOL(my_print_function)

No, you want EXPORT_SYMBOL(function_1) here.

> function_t()
> {
> 	doing different stuff
> }
>
> my_print_fuction = function_2

And just another function pointer assignment here
> (other code)

> my_print_function = function_1

> My question is: Is this the correct way of doing this? Or will this
> cause issues?

The correct way to do this would be just use a call through a function
pointer - that way any other code that's at a different point in
execution doesn't end up calling something unexpected.(because let's
face it - if the code is expecting to call function_1, and it suddenly
ends up in function_2 anyhow, it will quite possibly misbehave).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140603/f5106241/attachment.bin 

      parent reply	other threads:[~2014-06-03 13:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03  3:29 EXPORT_SYMBOL and rebinding functions Peter Tosh
2014-06-03  3:57 ` Greg KH
2014-06-03  4:19   ` Peter Tosh
2014-06-03  4:47     ` Greg KH
2014-06-03  5:10       ` Peter Tosh
2014-06-03  5:21         ` Greg KH
2014-06-03  8:57           ` AYAN KUMAR HALDER
2014-06-03 13:03 ` Valdis.Kletnieks at vt.edu [this message]

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=38416.1401800593@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).