lkml.org 
[lkml]   [2002]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Re: [BUG]2.5.49-ac1 - more info on make error
Adrian Bunk wrote:
> On Wed, Nov 27, 2002 at 03:45:24PM -0500, Bill Davidsen wrote:
> ./drivers/net/tulip/de2104x.o(.data+0x74): undefined reference to `local
> symbols in discarded section .exit.text'
>
>
> In drivers/net/tulip/de2104x.c the function de_remove_on is __exit but
> the pointer to it is __devexit_p.
>
> Two possible solutions:
>
> 1. Make this driver hot-pluggable. Jeff Garzik vetoes against this
> solution.
>
> 2. Change the __devexit_p to an #ifdef MODULE (it's ugly, but it lets
> the driver compiles with all combinations of config options without
> making it hot-pluggable):


As noted in the #warning, solution 3 (__exit_p) is the preferred one ;-)

Bill Irwin wrote up the patch to fix things The Right Way(tm). The
attached patch from Bill should eliminate all compile errors and warnings.

Jeff



This patch fixes tulip up by doing the following things:
(1) add __exit_p() to <linux/init.h>
(2) add the unused attributed to __exit routines for non-modules
(3) use __exit_p() to refer to de_remove_one()
(4) remove redundant timer initialization preceding variable initialization

drivers/net/tulip/de2104x.c | 4 +---
include/linux/init.h | 13 ++++++++++++-
2 files changed, 13 insertions(+), 4 deletions(-)


--- linux-2.5.49-mm1/include/linux/init.h Fri Nov 22 13:40:14 2002
+++ linux-2.5.49-mm2/include/linux/init.h Wed Nov 27 15:32:17 2002
@@ -42,10 +42,15 @@
discard it in modules) */
#define __init __attribute__ ((__section__ (".init.text")))
#define __initdata __attribute__ ((__section__ (".init.data")))
-#define __exit __attribute__ ((__section__(".exit.text")))
#define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))

+#ifdef MODULE
+#define __exit __attribute__ ((__section__(".exit.text")))
+#else
+#define __exit __attribute__ ((unused,__section__(".exit.text")))
+#endif
+
/* For assembly routines */
#define __INIT .section ".init.text","ax"
#define __FINIT .previous
@@ -199,6 +204,12 @@ extern struct kernel_param __setup_start
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
+#endif
+
+#ifdef MODULE
+#define __exit_p(x) x
+#else
+#define __exit_p(x) NULL
#endif

#endif /* _LINUX_INIT_H */
--- linux-2.5.49-mm1/drivers/net/tulip/de2104x.c Fri Nov 22 13:40:56 2002
+++ linux-2.5.49-mm2/drivers/net/tulip/de2104x.c Wed Nov 27 14:31:11 2002
@@ -2014,7 +2014,6 @@ static int __init de_init_one (struct pc
dev->watchdog_timeo = TX_TIMEOUT;

dev->irq = pdev->irq;
- init_timer(&de->media_timer);

de = dev->priv;
de->de21040 = ent->driver_data == 0 ? 1 : 0;
@@ -2217,8 +2216,7 @@ static struct pci_driver de_driver = {
.name = DRV_NAME,
.id_table = de_pci_tbl,
.probe = de_init_one,
-#warning only here to fix build. should be __exit_p not __devexit_p.
- .remove = __devexit_p(de_remove_one),
+ .remove = __exit_p(de_remove_one),
#ifdef CONFIG_PM
.suspend = de_suspend,
.resume = de_resume,

\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.105 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site