Skip to contentSkip to conversation

missing module_init & module_exit (a mystery?)

PATCH In review Tom 'spot' Callaway 2 participants 2 messages Jan 5, 2004 – Jan 6, 2004 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 missing module_init & module_exit (a mystery?)

When I tried to build drivers/media/dvb/ttusb-dec/ttusb_dec.c in the 2.6 kernel tree, it failed, because it couldn't find the definitions of module_init and module_exit, found in linux/init.h.

Now, this puzzled me, because it should have failed for all arches. I spent some time digging into it, and the best conclusion I can draw is that its due to the following:

ttusb_dec.c includes linux/interrupt.h, which includes asm/hardirq.h. On many of the architectures (h8300, i386, ia64, mips, ppc, sh, x86_64), hardirq.h includes linux/irq.h, which includes asm/hw_irq.h. On a subset of the previously listed architectures (i386, ia64, mips, x86_64), asm/hw_irq.h includes linux/profile.h, which includes linux/init.h.

Sparc and sparc64 are missing the needed includes in asm/hw_irq.h and asm/hardiq.h (in fact, hw_irq.h is a dummy include for both arches).

This explains why ttusb_dec.c (and drivers/mtd/chips/jedec_probe.c) were missing the init.h definitions on sparc64, but built fine in the main tree.

Now, the obvious fix is to add #include <linux/init.h> to ttusb_dec.c, but if this is a recurring problem (dbus.c had it as well), then perhaps we should complete the chain? Thoughts?

Patch for obvious fix is attached. Making a patch to fix the include chain for sparc and sparc64 is trivial, but I want to make sure its a good idea before I do it.

~spot
---
Tom "spot" Callaway <tcallawa(a)redhat*com> LCA, RHCE Red Hat Sales Engineer || Aurora SPARC Linux Project Leader

"The author's mathematical treatment of the conception of purpose is novel and highly ingenious, but heretical and, so far as the present social order is concerned, dangerous and potentially subversive. Not to be published." -- Aldous Huxley's "Brave New World"

drivers/media/dvb/ttusb-dec/ttusb_dec.c renamed from drivers/media/dvb/ttusb-dec/ttusb_dec.c.BAD +1 -0
@@ -29,6 +29,7 @@
 #include <linux/version.h>
 #include <linux/interrupt.h>
 #include <linux/firmware.h>
+#include <linux/init.h>
 
 #include "dmxdev.h"
 #include "dvb_demux.h"
#1 lore raw
Quoted 3 lines · On Mon, 05 Jan 2004 16:57:11 -0600 "Tom 'spot' Callaway" <[email protected]>…

When I tried to build drivers/media/dvb/ttusb-dec/ttusb_dec.c in the 2.6 kernel tree, it failed, because it couldn't find the definitions of module_init and module_exit, found in linux/init.h.

Fixed in 2.6.1-rc1 by adding the appropriate linux/init.h include to the driver.

Quoted 5 lines

ttusb_dec.c includes linux/interrupt.h, which includes asm/hardirq.h. On many of the architectures (h8300, i386, ia64, mips, ppc, sh, x86_64), hardirq.h includes linux/irq.h, which includes asm/hw_irq.h. On a subset of the previously listed architectures (i386, ia64, mips, x86_64), asm/hw_irq.h includes linux/profile.h, which includes linux/init.h.

That's right, and there is no reason such an obscure IRQ arch include should be required to include linux/init.h, it belongs in the drivers that make use of the facilities in that header file.