All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: parameter of module_init() and module_exit() must not be a macro
Date: Thu, 15 Oct 2015 06:55:22 -0700	[thread overview]
Message-ID: <20151015135522.GA8230@kroah.com> (raw)
In-Reply-To: <6D83E89737156549AEA25EF9ED712C5D159818@DEFTHW99EK1MSX.ww902.siemens.net>

On Thu, Oct 15, 2015 at 09:48:53AM +0000, Warlich, Christof wrote:
> I'd just like to get some feedback on the following issue and if the patch that I'm suggesting would be appropriate to be considered for upstream submission:
> 
> While writing a driver template, I just came across an issue with the module_init() and module_exit() macros: They don't work properly when the parameter being passed to them is a macro itself. Here is a minimal example that shows the issue:
> 
> $ cat test.c
> #include <linux/module.h>
> #define DRIVER_INIT test_init
> static int __init DRIVER_INIT(void)
> {
> 	return 0;
> }
> //module_init(test_init); // This works, ...
> module_init(DRIVER_INIT); // ... but this doesn't.

I'll ask, why would you ever want to pass a macro to module_init()?

We don't like functions to be macros in the kernel, do you have a
real-world need for this somewhere?  If so, can you show the code?

thanks,

greg k-h

  reply	other threads:[~2015-10-15 13:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15  9:48 parameter of module_init() and module_exit() must not be a macro Warlich, Christof
2015-10-15 13:55 ` Greg KH [this message]
2015-10-15 14:26   ` AW: " Warlich, Christof
2015-10-15 15:44     ` Greg KH
2015-10-16  6:40       ` AW: " Warlich, Christof
2015-10-16 13:59         ` Greg KH

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=20151015135522.GA8230@kroah.com \
    --to=greg@kroah.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.