* [PATCH] __devexit_p macro
@ 2002-08-02 9:24 Felipe W Damasio
2002-08-02 12:33 ` Dave Jones
0 siblings, 1 reply; 4+ messages in thread
From: Felipe W Damasio @ 2002-08-02 9:24 UTC (permalink / raw)
To: Linux-kernel; +Cc: trivial
Hi,
This patch defines __devexit_p when CONFIG_HOTPLUG || MODULE, instead of
when just CONFIG_HOTPLUG is defined.
This is needed for some net drivers (at least) that use "remove_one"
(which use unregister_netdev), allowing the driver to be re-installed.
This is the same behaviour that 2.4.
Patch against 2.5.30
Please consider pulling it from:
http://cscience.org/~coqueiro/linux/patches-fwd/2.5/init.h-__devexit_p.patch
Felipe
--- ./include/linux/init.h.orig Fri Aug 2 09:15:44 2002
+++ ./include/linux/init.h Fri Aug 2 09:06:39 2002
@@ -177,12 +177,16 @@
#define __devinitdata
#define __devexit
#define __devexitdata
-#define __devexit_p(x) &(x)
#else
#define __devinit __init
#define __devinitdata __initdata
#define __devexit __exit
#define __devexitdata __exitdata
+#endif
+
+#ifdef MODULE || CONFIG_HOTPLUG
+#define __devexit_p(x) &(x)
+#else
#define __devexit_p(x) 0
#endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] __devexit_p macro
2002-08-02 9:24 [PATCH] __devexit_p macro Felipe W Damasio
@ 2002-08-02 12:33 ` Dave Jones
2002-08-02 13:46 ` Keith Owens
0 siblings, 1 reply; 4+ messages in thread
From: Dave Jones @ 2002-08-02 12:33 UTC (permalink / raw)
To: Felipe W Damasio; +Cc: Linux-kernel, trivial
On Fri, Aug 02, 2002 at 09:24:56AM +0000, Felipe W Damasio wrote:
> --- ./include/linux/init.h.orig Fri Aug 2 09:15:44 2002
> +++ ./include/linux/init.h Fri Aug 2 09:06:39 2002
> @@ -177,12 +177,16 @@
> #define __devinitdata
> #define __devexit
> #define __devexitdata
> -#define __devexit_p(x) &(x)
> #else
> #define __devinit __init
> #define __devinitdata __initdata
> #define __devexit __exit
> #define __devexitdata __exitdata
> +#endif
> +
> +#ifdef MODULE || CONFIG_HOTPLUG
> +#define __devexit_p(x) &(x)
> +#else
> #define __devexit_p(x) 0
> #endif
Instead of making this a maze of #if/else's, you can acheive
the same effect with the following patch that has been in my
tree for a few months.. (hand pasted, may not apply cleanly)
@@ -167,12 +167,18 @@ typedef void (*__cleanup_module_func_t)(
#define device_initcall(fn) module_init(fn)
#define late_initcall(fn) module_init(fn)
-#endif
+#endif /* !MODULE */
/* Data marked not to be saved by software_suspend() */
#define __nosavedata __attribute__ ((__section__ (".data.nosave")))
-#ifdef CONFIG_HOTPLUG
+/* Functions marked as __devexit may be discarded at kernel link time, depending
+ on config options. Newer versions of binutils detect references from
+ retained sections to discarded sections and flag an error. Pointers to
+ __devexit functions must use __devexit_p(function_name), the wrapper will
+ insert either the function_name or NULL, depending on the config options.
+ */
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devinit
#define __devinitdata
#define __devexit
--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] __devexit_p macro
2002-08-02 12:33 ` Dave Jones
@ 2002-08-02 13:46 ` Keith Owens
2002-08-02 13:54 ` Keith Owens
0 siblings, 1 reply; 4+ messages in thread
From: Keith Owens @ 2002-08-02 13:46 UTC (permalink / raw)
To: Dave Jones; +Cc: Felipe W Damasio, Linux-kernel, trivial
On Fri, 2 Aug 2002 14:33:49 +0200,
Dave Jones <davej@suse.de> wrote:
>On Fri, Aug 02, 2002 at 09:24:56AM +0000, Felipe W Damasio wrote:
> > +#ifdef MODULE || CONFIG_HOTPLUG
> > +#define __devexit_p(x) &(x)
> > +#else
> > #define __devexit_p(x) 0
> > #endif
>
>Instead of making this a maze of #if/else's, you can acheive
>the same effect with the following patch that has been in my
>tree for a few months.. (hand pasted, may not apply cleanly)
Better still, copy the end of 2.5.19-rc5/include/linux/init.h to
2.5.30, from #ifdef CONFIG_HOTPLUG onwards. There is no point in
having slight differences between the 2.4 and 2.5 versions, ATM they
should be the same.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] __devexit_p macro
2002-08-02 13:46 ` Keith Owens
@ 2002-08-02 13:54 ` Keith Owens
0 siblings, 0 replies; 4+ messages in thread
From: Keith Owens @ 2002-08-02 13:54 UTC (permalink / raw)
To: Dave Jones, Linux-kernel
On Fri, 02 Aug 2002 23:46:39 +1000,
Keith Owens <kaos@ocs.com.au> wrote:
>On Fri, 2 Aug 2002 14:33:49 +0200,
>Dave Jones <davej@suse.de> wrote:
>>On Fri, Aug 02, 2002 at 09:24:56AM +0000, Felipe W Damasio wrote:
>> > +#ifdef MODULE || CONFIG_HOTPLUG
>> > +#define __devexit_p(x) &(x)
>> > +#else
>> > #define __devexit_p(x) 0
>> > #endif
>>
>>Instead of making this a maze of #if/else's, you can acheive
>>the same effect with the following patch that has been in my
>>tree for a few months.. (hand pasted, may not apply cleanly)
>
>Better still, copy the end of 2.5.19-rc5/include/linux/init.h to
Duh, that should be 2.4.19-rc5 of course.
>2.5.30, from #ifdef CONFIG_HOTPLUG onwards. There is no point in
>having slight differences between the 2.4 and 2.5 versions, ATM they
>should be the same.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-08-02 13:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-02 9:24 [PATCH] __devexit_p macro Felipe W Damasio
2002-08-02 12:33 ` Dave Jones
2002-08-02 13:46 ` Keith Owens
2002-08-02 13:54 ` Keith Owens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox