root/lm-sensors/trunk/kernel/compat.h @ 19

Revision 19, 1.7 KB (checked in by frodo, 14 years ago)

Many things, most notable the lm78 module

* Some Makefile changes. doc/makefiles documents most of them.
* The lm78 module now compiles, but it will still crash.
* New module sensors, with general code usable by chip driver modules
* i2c-core: added function i2c_adapter_id(), which returns a (low)

unique i2c-bus ID.

* lm78.h stuff moved into lm78.c or sensors.h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*
2    compar.h - A Linux module for reading sensor data.
3    Copyright (c) 1998  Frodo Looijaard <frodol@dds.nl>
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/
19
20#ifndef SENSORS_COMPAT_H
21#define SENSORS_COMPAT_H
22
23/* This useful macro is not defined in the 2.0 kernels */
24
25#include <linux/version.h>
26#ifndef KERNEL_VERSION
27#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
28#endif
29
30#ifdef MODULE
31#include <linux/module.h>
32#ifndef MODULE_AUTHOR
33#define MODULE_AUTHOR(whatever)
34#endif
35#ifndef MODULE_DESCRIPTION
36#define MODULE_DESCRIPTION(whatever)
37#endif
38#endif /* def MODULE */
39
40/* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels; perhaps in
41   some early 2.1 kernels too? */
42#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4))
43#define copy_from_user memcpy_fromfs
44#define copy_to_user memcpy_tofs
45#endif
46
47/* get_user was redefined in 2.1 kernels to use two arguments, and returns
48   an error code */
49#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4))
50#define get_user_data(to,from) ((to) = get_user(from),0)
51#else
52#define get_user_data(to,from) get_user(to,from)
53#endif
54
55
56#endif /* SENSORS_COMPAT_H */
Note: See TracBrowser for help on using the browser.