From f322a6779379c36ea094d921b77d676e3b17d933 Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Sun, 6 Dec 1998 16:19:24 +0000 Subject: [PATCH] Better header files * Header files isa.h, sensors.h and smbus.h will now be installed on a 'make install'; * #ifdef __KERNEL__ added to the above header files where appropriate; * Correct files are included, both if __KERNEL__ is true and false. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@42 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/Module.mk | 3 ++- kernel/include/i2c-isa.h | 26 ++++++++++++++------------ kernel/include/isa.h | 26 ++++++++++++++------------ kernel/include/sensors.h | 4 ++-- kernel/include/smbus.h | 7 ++++++- src/Module.mk | 3 ++- src/isa.h | 26 ++++++++++++++------------ src/sensors.h | 4 ++-- src/smbus.h | 7 ++++++- 9 files changed, 62 insertions(+), 44 deletions(-) diff --git a/kernel/Module.mk b/kernel/Module.mk index 92cf5728..5d653080 100644 --- a/kernel/Module.mk +++ b/kernel/Module.mk @@ -26,7 +26,8 @@ SRCTARGETS := $(MODULE_DIR)/smbus.o $(MODULE_DIR)/piix4.o $(MODULE_DIR)/isa.o \ $(MODULE_DIR)/lm78.o $(MODULE_DIR)/sensors.o \ $(MODULE_DIR)/i2c-proc.o $(MODULE_DIR)/lm75.o -HEADERFILES := $(MODULE_DIR)/sensors.h +HEADERFILES := $(MODULE_DIR)/sensors.h $(MODULE_DIR)/isa.h \ + $(MODULE_DIR)/smbus.h # Include all dependency files INCLUDEFILES += $(SRCTARGETS:.o=.d) diff --git a/kernel/include/i2c-isa.h b/kernel/include/i2c-isa.h index 9c738b67..d7a1d74d 100644 --- a/kernel/include/i2c-isa.h +++ b/kernel/include/i2c-isa.h @@ -20,16 +20,12 @@ #ifndef SENSORS_SENSOR_H #define SENSORS_SENSOR_H +#ifdef __KERNEL__ + /* This file must interface with Simon Vogl's i2c driver. Version 19981006 is OK, earlier versions are not; later versions will probably give problems too. */ -#ifdef I2C -#include "i2c/i2c.h" -#else /* def I2C */ -#include -#endif /* def I2C */ - #include /* SPINLOCK is defined in i2c.h. */ @@ -39,7 +35,11 @@ #include #endif -#include "isa.h" +#ifdef LM_SENSORS +#include "i2c.h" +#else /* ndef LM_SENSORS */ +#include +#endif /* def LM_SENSORS */ /* Note that this driver is *not* built upon smbus.c, but is parallel to it. We do not need SMBus facilities if we are on the ISA bus, after all */ @@ -117,11 +117,6 @@ struct isa_adapter { int retries; }; -/* We need to mark ISA algorithms in the algorithm structure. */ -#define ALGO_ISA 0x50000 - -/* ISA Adapter ids */ -#define ISA_MAIN 1 /* Detect whether we are on the isa bus. If this returns true, all i2c access will fail! */ @@ -151,5 +146,12 @@ struct isa_adapter { #define isa_detach_client(clientptr) \ i2c_detach_client((struct i2c_client *) (clientptr)) +#endif /* def __KERNEL__ */ + +/* We need to mark ISA algorithms in the algorithm structure. */ +#define ALGO_ISA 0x50000 + +/* ISA Adapter ids */ +#define ISA_MAIN 1 #endif /* ndef SENSORS_ISA_H */ diff --git a/kernel/include/isa.h b/kernel/include/isa.h index 9c738b67..d7a1d74d 100644 --- a/kernel/include/isa.h +++ b/kernel/include/isa.h @@ -20,16 +20,12 @@ #ifndef SENSORS_SENSOR_H #define SENSORS_SENSOR_H +#ifdef __KERNEL__ + /* This file must interface with Simon Vogl's i2c driver. Version 19981006 is OK, earlier versions are not; later versions will probably give problems too. */ -#ifdef I2C -#include "i2c/i2c.h" -#else /* def I2C */ -#include -#endif /* def I2C */ - #include /* SPINLOCK is defined in i2c.h. */ @@ -39,7 +35,11 @@ #include #endif -#include "isa.h" +#ifdef LM_SENSORS +#include "i2c.h" +#else /* ndef LM_SENSORS */ +#include +#endif /* def LM_SENSORS */ /* Note that this driver is *not* built upon smbus.c, but is parallel to it. We do not need SMBus facilities if we are on the ISA bus, after all */ @@ -117,11 +117,6 @@ struct isa_adapter { int retries; }; -/* We need to mark ISA algorithms in the algorithm structure. */ -#define ALGO_ISA 0x50000 - -/* ISA Adapter ids */ -#define ISA_MAIN 1 /* Detect whether we are on the isa bus. If this returns true, all i2c access will fail! */ @@ -151,5 +146,12 @@ struct isa_adapter { #define isa_detach_client(clientptr) \ i2c_detach_client((struct i2c_client *) (clientptr)) +#endif /* def __KERNEL__ */ + +/* We need to mark ISA algorithms in the algorithm structure. */ +#define ALGO_ISA 0x50000 + +/* ISA Adapter ids */ +#define ISA_MAIN 1 #endif /* ndef SENSORS_ISA_H */ diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index c5c949be..232cfaab 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -20,13 +20,13 @@ #ifndef SENSORS_SENSORS_H #define SENSORS_SENSORS_H +#ifdef __KERNEL__ + /* Next two must be included before sysctl.h can be included, in 2.0 kernels */ #include #include #include -#ifdef __KERNEL__ - /* The type of callback functions used in sensors_{proc,sysctl}_real */ typedef void (*sensors_real_callback) (struct i2c_client *client, int operation, int ctl_name, diff --git a/kernel/include/smbus.h b/kernel/include/smbus.h index 4a164113..d9919117 100644 --- a/kernel/include/smbus.h +++ b/kernel/include/smbus.h @@ -26,7 +26,6 @@ OK, earlier versions are not; later versions will probably give problems too. */ -#include "i2c.h" #include /* SPINLOCK is defined in i2c.h. */ @@ -36,6 +35,12 @@ #include #endif +#ifdef LM_SENSORS +#include "i2c.h" +#else +#include +#endif + /* Declarations, to keep the compiler happy */ struct smbus_driver; struct smbus_client; diff --git a/src/Module.mk b/src/Module.mk index 92cf5728..5d653080 100644 --- a/src/Module.mk +++ b/src/Module.mk @@ -26,7 +26,8 @@ SRCTARGETS := $(MODULE_DIR)/smbus.o $(MODULE_DIR)/piix4.o $(MODULE_DIR)/isa.o \ $(MODULE_DIR)/lm78.o $(MODULE_DIR)/sensors.o \ $(MODULE_DIR)/i2c-proc.o $(MODULE_DIR)/lm75.o -HEADERFILES := $(MODULE_DIR)/sensors.h +HEADERFILES := $(MODULE_DIR)/sensors.h $(MODULE_DIR)/isa.h \ + $(MODULE_DIR)/smbus.h # Include all dependency files INCLUDEFILES += $(SRCTARGETS:.o=.d) diff --git a/src/isa.h b/src/isa.h index 9c738b67..d7a1d74d 100644 --- a/src/isa.h +++ b/src/isa.h @@ -20,16 +20,12 @@ #ifndef SENSORS_SENSOR_H #define SENSORS_SENSOR_H +#ifdef __KERNEL__ + /* This file must interface with Simon Vogl's i2c driver. Version 19981006 is OK, earlier versions are not; later versions will probably give problems too. */ -#ifdef I2C -#include "i2c/i2c.h" -#else /* def I2C */ -#include -#endif /* def I2C */ - #include /* SPINLOCK is defined in i2c.h. */ @@ -39,7 +35,11 @@ #include #endif -#include "isa.h" +#ifdef LM_SENSORS +#include "i2c.h" +#else /* ndef LM_SENSORS */ +#include +#endif /* def LM_SENSORS */ /* Note that this driver is *not* built upon smbus.c, but is parallel to it. We do not need SMBus facilities if we are on the ISA bus, after all */ @@ -117,11 +117,6 @@ struct isa_adapter { int retries; }; -/* We need to mark ISA algorithms in the algorithm structure. */ -#define ALGO_ISA 0x50000 - -/* ISA Adapter ids */ -#define ISA_MAIN 1 /* Detect whether we are on the isa bus. If this returns true, all i2c access will fail! */ @@ -151,5 +146,12 @@ struct isa_adapter { #define isa_detach_client(clientptr) \ i2c_detach_client((struct i2c_client *) (clientptr)) +#endif /* def __KERNEL__ */ + +/* We need to mark ISA algorithms in the algorithm structure. */ +#define ALGO_ISA 0x50000 + +/* ISA Adapter ids */ +#define ISA_MAIN 1 #endif /* ndef SENSORS_ISA_H */ diff --git a/src/sensors.h b/src/sensors.h index c5c949be..232cfaab 100644 --- a/src/sensors.h +++ b/src/sensors.h @@ -20,13 +20,13 @@ #ifndef SENSORS_SENSORS_H #define SENSORS_SENSORS_H +#ifdef __KERNEL__ + /* Next two must be included before sysctl.h can be included, in 2.0 kernels */ #include #include #include -#ifdef __KERNEL__ - /* The type of callback functions used in sensors_{proc,sysctl}_real */ typedef void (*sensors_real_callback) (struct i2c_client *client, int operation, int ctl_name, diff --git a/src/smbus.h b/src/smbus.h index 4a164113..d9919117 100644 --- a/src/smbus.h +++ b/src/smbus.h @@ -26,7 +26,6 @@ OK, earlier versions are not; later versions will probably give problems too. */ -#include "i2c.h" #include /* SPINLOCK is defined in i2c.h. */ @@ -36,6 +35,12 @@ #include #endif +#ifdef LM_SENSORS +#include "i2c.h" +#else +#include +#endif + /* Declarations, to keep the compiler happy */ struct smbus_driver; struct smbus_client;