From 48148eb7aefb961867969dbd90cd4e99c570b1eb Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sat, 10 Aug 2002 16:57:27 +0000 Subject: [PATCH] fix compile for SMP and modversions by copying 'magic' stuff from top-level makefile git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1489 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/hotplug/Makefile.p4b | 31 ++++++++++++++++++++++++++++++- prog/hotplug/p4b_smbus.c | 14 ++++---------- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index ce5344d4..c08ea318 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ ask CVS about it: Program mkpatch: Add Config.in entries for, lm92, pcf8574, pcf8591, smsc47m1, vt1211; add dmi_scan + Program p4b_smbus: Fix compile for SMP and MODVERSIONS Program sensord: Add /usr/local/etc to config file path; add support for logging loadavg in RRD; fix down-converting raw labels for RRD; diff --git a/prog/hotplug/Makefile.p4b b/prog/hotplug/Makefile.p4b index e39057c1..a883d732 100644 --- a/prog/hotplug/Makefile.p4b +++ b/prog/hotplug/Makefile.p4b @@ -3,10 +3,39 @@ VERSION=1.40 +# The location of linux itself. This is used to find the kernel headers +# and other things. +LINUX=/usr/src/linux +LINUX_HEADERS=$(LINUX)/include + +# Uncomment the third line on SMP systems if the magic invocation fails. It +# is a bit complicated because SMP configuration changed around kernel 2.1.130 +SMP := $(shell if grep -q '^SMP[[:space:]]*=' $(LINUX)/Makefile || \ + grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_SMP[[:space:]]*1' $(LINUX_HEADERS)/linux/autoconf.h ; \ + then echo 1; else echo 0; fi) +#SMP := 0 +#SMP := 1 + +# Uncomment the second or third line if the magic invocation fails. +# We need to know whether CONFIG_MODVERSIONS is defined. +MODVER := $(shell if cat $(LINUX_HEADERS)/linux/config.h $(LINUX_HEADERS)/linux/autoconf.h 2>/dev/null | grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_MODVERSIONS[[:space:]]*1'; then echo 1; else echo 0; fi) +#MODVER := 0 +#MODVER := 1 + +MODCPPFLAGS := + +ifeq ($(SMP),1) +MODCPPFLAGS += -D__SMP__ +endif + +ifeq ($(MODVER),1) +MODCPPFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h +endif + VER = $(shell uname -r) INCLUDEDIR= /lib/modules/$(VER)/build/include -CFLAGS= -D__KERNEL__ -DMODULE -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -I$(INCLUDEDIR) +CFLAGS= $(MODCPPFLAGS) -D__KERNEL__ -DMODULE -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -I$(INCLUDEDIR) OBJS = p4b_smbus.o diff --git a/prog/hotplug/p4b_smbus.c b/prog/hotplug/p4b_smbus.c index 66b98cfc..e8d8955f 100644 --- a/prog/hotplug/p4b_smbus.c +++ b/prog/hotplug/p4b_smbus.c @@ -60,12 +60,6 @@ #error ERROR - You must have 'Support for hot-pluggable devices' enabled in your kernel (under 'general setup')!! #endif -/* Deal with CONFIG_MODVERSIONS */ -#ifdef CONFIG_MODVERSIONS -#define MODVERSIONS -#include -#endif - #include #include #include @@ -131,7 +125,7 @@ i801smbus_enable(struct pci_dev *dev){ return -EIO; } else - printk("SMBus activated in LPC!\n"); + printk("i801smbus: SMBus activated in LPC!\n"); } return 0; @@ -230,17 +224,17 @@ int init_module(void) dev = pci_find_device(0x8086, ICH4, NULL); if (NULL == dev) { - printk("INTEL ICH2/4 (82801AB/DB) not found.\n"); + printk("i801smbus: INTEL ICH2/4 (82801AB/DB) not found.\n"); return -ENODEV ; } else { - printk("found Intel ICH4 (82801DB).\n"); + printk("i801smbus: found Intel ICH4 (82801DB).\n"); } } else { - printk("found Intel ICH2 (82801AB).\n"); + printk("i801smbus: found Intel ICH2 (82801AB).\n"); } /* we need the bus pointer later */