diff --git a/Makefile b/Makefile index 53a1d2f9..dedc75d5 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,11 @@ I2C := 1 WARN := 0 #WARN := 1 +# Uncomment the second line if you want to get (loads of) debug information. +# Not recommended, unless you are actually debugging the code +DEBUG := 0 +#DEBUG := 1 + # This is the directory into which the modules will be installed, if you # call 'make install' MODDIR := /lib/modules/extra/misc @@ -106,10 +111,14 @@ endif all:: # Include all makefiles for sub-modules +INCLUDEFILES := include $(patsubst %,%/Module.mk,$(MODULES)) +ifneq ($(MAKECMDGOALS),clean) +include $(INCLUDEFILES) +endif # Making the dependency files - done automatically! -dep: +dep : all :: diff --git a/i2c/Module.mk b/i2c/Module.mk index 594670b5..eeba8eaa 100644 --- a/i2c/Module.mk +++ b/i2c/Module.mk @@ -27,7 +27,7 @@ I2CTARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \ $(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o # Include all dependency files -include $(I2CTARGETS:.o=.d) +INCLUDEFILES += $(I2CTARGETS:.o=.d) all :: $(I2CTARGETS) diff --git a/i2c/detect/Module.mk b/i2c/detect/Module.mk index fbbd8fa8..9b89a42e 100644 --- a/i2c/detect/Module.mk +++ b/i2c/detect/Module.mk @@ -26,7 +26,7 @@ I2CDETECTTARGETS := $(MODULE_DIR)/detect I2CDETECTSOURCES := $(MODULE_DIR)/detect.c # Include all dependency files -include $(I2CDETECTSOURCES:.c=.d) +INCLUDEFILES += $(I2CDETECTSOURCES:.c=.d) all :: $(I2CDETECTTARGETS) diff --git a/i2c/drivers/Module.mk b/i2c/drivers/Module.mk index 23be9f68..01aafa34 100644 --- a/i2c/drivers/Module.mk +++ b/i2c/drivers/Module.mk @@ -25,7 +25,7 @@ MODULE_DIR := i2c/drivers I2CDRIVERTARGETS := $(MODULE_DIR)/eeprom.o # Include all dependency files -include $(I2CDRIVERTARGETS:.o=.d) +INCLUDEFILES += $(I2CDRIVERTARGETS:.o=.d) all :: $(I2CDRIVERTARGETS) diff --git a/i2c/eeprom/Module.mk b/i2c/eeprom/Module.mk index 791fb913..ef0fb9af 100644 --- a/i2c/eeprom/Module.mk +++ b/i2c/eeprom/Module.mk @@ -26,7 +26,7 @@ I2CEEPROMTARGETS := $(MODULE_DIR)/eeprom I2CEEPROMSOURCES := $(MODULE_DIR)/eeprom.c # Include all dependency files -include $(I2CEEPROMSOURCES:.c=.d) +INCLUDEFILES += $(I2CEEPROMSOURCES:.c=.d) all :: $(I2CEEPROMTARGETS) diff --git a/kernel/Module.mk b/kernel/Module.mk index cc7ced8d..9a4e96bb 100644 --- a/kernel/Module.mk +++ b/kernel/Module.mk @@ -25,7 +25,7 @@ MODULE_DIR := src SRCTARGETS := $(MODULE_DIR)/smbus.o $(MODULE_DIR)/piix4.o # Include all dependency files -include $(SRCTARGETS:.o=.d) +INCLUDEFILES += $(SRCTARGETS:.o=.d) all :: $(SRCTARGETS) diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index 2796312d..c06f5a5f 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -20,6 +20,7 @@ #include #include #include "smbus.h" +#include "version.h" static int piix4_init(void); static int piix4_cleanup(void); @@ -39,6 +40,7 @@ static int piix4_initialized; Return -ENODEV if not found. */ int piix4_setup(void) { + return -ENODEV; /* TO BE WRITTEN! */ } @@ -53,15 +55,16 @@ s32 piix4_access(u8 addr, char read_write, int piix4_init(void) { int res; + printk("piix4.o version %s (%s)\n",LM_VERSION,LM_DATE); #ifdef DEBUG if (piix4_initialized) { - printk("piix4.o: Oops, piix4_init called a second time!"); + printk("piix4.o: Oops, piix4_init called a second time!\n"); return -EBUSY; } #endif piix4_initialized = 0; if ((res = piix4_setup())) { - printk("piix4.o: PIIX4 not detected, module not inserted"); + printk("piix4.o: PIIX4 not detected, module not inserted\n"); piix4_cleanup(); return res; } @@ -71,12 +74,12 @@ int piix4_init(void) piix4_adapter.algo = &smbus_algorithm; piix4_adapter.smbus_access = &piix4_access; if ((res = smbus_add_adapter(&piix4_adapter))) { - printk("piix4.o: smbus_add_adapter failed, module not inserted"); + printk("piix4.o: smbus_add_adapter failed, module not inserted\n"); piix4_cleanup(); return res; } piix4_initialized++; - printk("piix4.o: PIIX4 bus detected and initialized"); + printk("piix4.o: PIIX4 bus detected and initialized\n"); return 0; } diff --git a/kernel/smbus.c b/kernel/smbus.c index 3d847cb2..cb31e616 100644 --- a/kernel/smbus.c +++ b/kernel/smbus.c @@ -26,6 +26,7 @@ #include #endif +#include "version.h" #include "smbus.h" static s32 smbus_access_i2c (struct smbus_adapter * adapter, u8 addr, @@ -201,10 +202,11 @@ int smbus_detach_client(struct smbus_client *client) int smbus_init(void) { int res; + printk("smbus.o version %s (%s)\n",LM_VERSION,LM_DATE); if ((res = smbus_add_algorithm(&smbus_algorithm))) printk("Module smbus.o not inserted!\n"); else - printk("smbus.o initialized"); + printk("smbus.o initialized\n"); return res; } diff --git a/src/Module.mk b/src/Module.mk index cc7ced8d..9a4e96bb 100644 --- a/src/Module.mk +++ b/src/Module.mk @@ -25,7 +25,7 @@ MODULE_DIR := src SRCTARGETS := $(MODULE_DIR)/smbus.o $(MODULE_DIR)/piix4.o # Include all dependency files -include $(SRCTARGETS:.o=.d) +INCLUDEFILES += $(SRCTARGETS:.o=.d) all :: $(SRCTARGETS) diff --git a/src/piix4.c b/src/piix4.c index 2796312d..c06f5a5f 100644 --- a/src/piix4.c +++ b/src/piix4.c @@ -20,6 +20,7 @@ #include #include #include "smbus.h" +#include "version.h" static int piix4_init(void); static int piix4_cleanup(void); @@ -39,6 +40,7 @@ static int piix4_initialized; Return -ENODEV if not found. */ int piix4_setup(void) { + return -ENODEV; /* TO BE WRITTEN! */ } @@ -53,15 +55,16 @@ s32 piix4_access(u8 addr, char read_write, int piix4_init(void) { int res; + printk("piix4.o version %s (%s)\n",LM_VERSION,LM_DATE); #ifdef DEBUG if (piix4_initialized) { - printk("piix4.o: Oops, piix4_init called a second time!"); + printk("piix4.o: Oops, piix4_init called a second time!\n"); return -EBUSY; } #endif piix4_initialized = 0; if ((res = piix4_setup())) { - printk("piix4.o: PIIX4 not detected, module not inserted"); + printk("piix4.o: PIIX4 not detected, module not inserted\n"); piix4_cleanup(); return res; } @@ -71,12 +74,12 @@ int piix4_init(void) piix4_adapter.algo = &smbus_algorithm; piix4_adapter.smbus_access = &piix4_access; if ((res = smbus_add_adapter(&piix4_adapter))) { - printk("piix4.o: smbus_add_adapter failed, module not inserted"); + printk("piix4.o: smbus_add_adapter failed, module not inserted\n"); piix4_cleanup(); return res; } piix4_initialized++; - printk("piix4.o: PIIX4 bus detected and initialized"); + printk("piix4.o: PIIX4 bus detected and initialized\n"); return 0; } diff --git a/src/smbus.c b/src/smbus.c index 3d847cb2..cb31e616 100644 --- a/src/smbus.c +++ b/src/smbus.c @@ -26,6 +26,7 @@ #include #endif +#include "version.h" #include "smbus.h" static s32 smbus_access_i2c (struct smbus_adapter * adapter, u8 addr, @@ -201,10 +202,11 @@ int smbus_detach_client(struct smbus_client *client) int smbus_init(void) { int res; + printk("smbus.o version %s (%s)\n",LM_VERSION,LM_DATE); if ((res = smbus_add_algorithm(&smbus_algorithm))) printk("Module smbus.o not inserted!\n"); else - printk("smbus.o initialized"); + printk("smbus.o initialized\n"); return res; }