mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	Satyam Sharma <satyam.sharma@gmail.com>,
	Neil Brown <neilb@suse.de>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>
Subject: Re: [PATCH (revised)] device_schedule_callback needs a module reference
Date: Tue, 10 Apr 2007 15:32:08 -0700	[thread overview]
Message-ID: <20070410153208.ad523206.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0704101141110.3614-100000@iolanthe.rowland.org>

On Tue, 10 Apr 2007 12:46:11 -0400 (EDT)
Alan Stern <stern@rowland.harvard.edu> wrote:

> On Tue, 10 Apr 2007, Cornelia Huck wrote:
> 
> > Whoops:
> > 
> > In file included from include/linux/interrupt.h:15,
> >                  from include/asm/hardirq.h:18,
> >                  from include/linux/hardirq.h:7,
> >                  from include/asm-generic/local.h:5,
> >                  from include/asm/local.h:1,
> >                  from include/linux/module.h:19,
> >                  from arch/s390/kernel/time.c:16:
> > include/linux/device.h: In function 'device_schedule_callback':
> > include/linux/device.h:374: error: 'THIS_MODULE' undeclared (first use in this function)
> > include/linux/device.h:374: error: (Each undeclared identifier is reported only once
> > include/linux/device.h:374: error: for each function it appears in.)
> > 
> > Maybe better move the implementation of device_schedule_callback() to
> > drivers/base/core.c? (Though I'm not sure why
> > include/asm-s390/hardirq.h includes linux/interrupt.h, and e.g.
> > include/asm-i386/hardirq.h doesn't.)
> 
> I don't think moving device_schedule_callback() is the answer.  For one 
> thing, the implementation _has_ to be compiled in the calling module so 
> that THIS_MODULE will have the correct value.  If it were compiled in 
> drivers/base/core.c then it wouldn't refer to the caller's module.
> 
> The real problem is bad nesting of #includes.  Maybe changing 
> include/asm-s390/hardirq.h not to include linux/interrupt.h will be 
> feasible.
> 
> Or perhaps it would be better to move the definition of THIS_MODULE in
> linux/module.h up before all the #include lines, since it seems reasonable
> that a file indirectly included by module.h might need to use THIS_MODULE.
> 

<holds nose>


--- a/include/linux/device.h~device_schedule_callback-needs-a-module-reference-fix
+++ a/include/linux/device.h
@@ -369,11 +369,9 @@ extern void device_remove_bin_file(struc
 extern int device_schedule_callback_owner(struct device *dev,
 		void (*func)(struct device *), struct module *owner);
 
-static inline int device_schedule_callback(struct device *dev,
-		void (*func)(struct device *))
-{
-	return device_schedule_callback_owner(dev, func, THIS_MODULE);
-}
+/* This is a macro to avoid include problems with THIS_MODULE */
+#define device_schedule_callback(dev, func)			\
+	device_schedule_callback_owner(dev, func, THIS_MODULE)
 
 /* device resource management */
 typedef void (*dr_release_t)(struct device *dev, void *res);
_


      reply	other threads:[~2007-04-10 22:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a781481a0704090752u27140ee8vc93bd344c5005549@mail.gmail.com>
2007-04-09 15:07 ` Alan Stern
2007-04-10 13:13   ` Cornelia Huck
2007-04-10 16:46     ` Alan Stern
2007-04-10 22:32       ` Andrew Morton [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=20070410153208.ad523206.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=satyam.sharma@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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

Powered by JetHome