(Kyösti) some cleanups for 2.4+

Module refcounting using .owner, removing of inc/dec_use.
   These require (yet unreleased) i2c 2.8.0+.

   Named initializers everywhere. Unified namespace.

   Cleanup for 2.5, remove EXPORT_NO_SYMBOLS, declare everything
   static. Apply initcalls.

   PCI device registration changes for busses started, replicating
   from i2c-amd*. While everything does compile, nothing really
   works. Well, maybe i2c-amd* ported back from 2.5 tree.

   After updating your work directory, run
    > cvs diff -u -r LAST-PRE-2-8-I2C > lm-2.8-patches-1

   BEWARE: I have not even insmoded any of these yet.

   To compile, you need i2c from cvs too.
   For 2.4 kernel :
    > cvs co -r lk2-4 i2c

   For 2.5 kernel :
    > cvs co i2c


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1698 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Kyosti Malkki committed 2003-01-17 01:19:52 +00:00
1 parent 2a462eaae3
commit 39391ba6ea
59 files changed
+1596 -5391

No files matched your search

+13 -29
View File
@@ -120,8 +120,6 @@ static void adm1021_init_client(struct i2c_client *client);
static int adm1021_detach_client(struct i2c_client *client);
static int adm1021_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void adm1021_inc_use(struct i2c_client *client);
static void adm1021_dec_use(struct i2c_client *client);
static int adm1021_read_value(struct i2c_client *client, u8 reg);
static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask);
static int adm1021_write_value(struct i2c_client *client, u8 reg,
@@ -143,14 +141,13 @@ static int read_only = 0;
/* This is the driver that will be inserted */
static struct i2c_driver adm1021_driver = {
.owner = THIS_MODULE,
.name = "ADM1021, MAX1617 sensor driver",
.id = I2C_DRIVERID_ADM1021,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1021_attach_adapter,
.detach_client = adm1021_detach_client,
.command = adm1021_command,
.inc_use = adm1021_inc_use,
.dec_use = adm1021_dec_use
};
/* These files are created for each detected adm1021. This is just a template;
@@ -185,7 +182,7 @@ static ctl_table adm1021_max_dir_table_template[] = {
take more memory than the datastructure takes now. */
static int adm1021_id = 0;
int adm1021_attach_adapter(struct i2c_adapter *adapter)
static int adm1021_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, adm1021_detect);
}
@@ -338,7 +335,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
return err;
}
void adm1021_init_client(struct i2c_client *client)
static void adm1021_init_client(struct i2c_client *client)
{
/* Initialize the adm1021 chip */
adm1021_write_value(client, ADM1021_REG_TOS_W,
@@ -355,7 +352,7 @@ void adm1021_init_client(struct i2c_client *client)
adm1021_write_value(client, ADM1021_REG_CONV_RATE_W, 0x04);
}
int adm1021_detach_client(struct i2c_client *client)
static int adm1021_detach_client(struct i2c_client *client)
{
int err;
@@ -377,33 +374,20 @@ int adm1021_detach_client(struct i2c_client *client)
/* No commands defined yet */
int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void adm1021_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void adm1021_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* All registers are byte-sized */
int adm1021_read_value(struct i2c_client *client, u8 reg)
static int adm1021_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}
/* only update value if read succeeded; set fail bit if failed */
int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask)
static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask)
{
int i;
struct adm1021_data *data = client->data;
@@ -417,7 +401,7 @@ int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask)
return 0;
}
int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
static int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
{
if (read_only > 0)
return 0;
@@ -425,7 +409,7 @@ int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
return i2c_smbus_write_byte_data(client, reg, value);
}
void adm1021_update_client(struct i2c_client *client)
static void adm1021_update_client(struct i2c_client *client)
{
struct adm1021_data *data = client->data;
@@ -613,13 +597,13 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name,
}
}
static int __init sensors_adm1021_init(void)
static int __init sm_adm1021_init(void)
{
printk(KERN_INFO "adm1021.o version %s (%s)\n", LM_VERSION, LM_DATE);
return i2c_add_driver(&adm1021_driver);
}
static void __exit sensors_adm1021_exit(void)
static void __exit sm_adm1021_exit(void)
{
i2c_del_driver(&adm1021_driver);
}
@@ -632,5 +616,5 @@ MODULE_LICENSE("GPL");
MODULE_PARM(read_only, "i");
MODULE_PARM_DESC(read_only, "Don't set any values, read only mode");
module_init(sensors_adm1021_init)
module_exit(sensors_adm1021_exit)
module_init(sm_adm1021_init)
module_exit(sm_adm1021_exit)
+21 -95
View File
@@ -37,15 +37,6 @@
#include "sensors.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END };
@@ -126,7 +117,7 @@ SENSORS_INSMOD_1(adm1024);
#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255))
#define IN_FROM_REG(val,nr) (val)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -202,11 +193,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define ADM1024_INIT_TEMP_HOT_MAX 700
#define ADM1024_INIT_TEMP_HOT_HYST 600
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered ADM1024, we need to keep some data in memory. That
data is pointed to by adm1024_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new adm1024 client is
@@ -240,13 +226,6 @@ struct adm1024_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_adm1024_init(void);
static int __init adm1024_cleanup(void);
static int adm1024_attach_adapter(struct i2c_adapter *adapter);
static int adm1024_detect(struct i2c_adapter *adapter, int address,
@@ -254,8 +233,6 @@ static int adm1024_detect(struct i2c_adapter *adapter, int address,
static int adm1024_detach_client(struct i2c_client *client);
static int adm1024_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void adm1024_inc_use(struct i2c_client *client);
static void adm1024_dec_use(struct i2c_client *client);
static int adm1024_read_value(struct i2c_client *client, u8 register);
static int adm1024_write_value(struct i2c_client *client, u8 register,
@@ -290,19 +267,15 @@ static void adm1024_vid(struct i2c_client *client, int operation,
static int adm1024_id = 0;
static struct i2c_driver adm1024_driver = {
/* name */ "ADM1024 sensor driver",
/* id */ I2C_DRIVERID_ADM1024,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &adm1024_attach_adapter,
/* detach_client */ &adm1024_detach_client,
/* command */ &adm1024_command,
/* inc_use */ &adm1024_inc_use,
/* dec_use */ &adm1024_dec_use
.owner = THIS_MODULE,
.name = "ADM1024 sensor driver",
.id = I2C_DRIVERID_ADM1024,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1024_attach_adapter,
.detach_client = adm1024_detach_client,
.command = adm1024_command,
};
/* Used by adm1024_init/cleanup */
static int __initdata adm1024_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected ADM1024. This is just a template;
though at first sight, you might think we could use a statically
@@ -343,7 +316,7 @@ static ctl_table adm1024_dir_table_template[] = {
{0}
};
int adm1024_attach_adapter(struct i2c_adapter *adapter)
static int adm1024_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, adm1024_detect);
}
@@ -460,7 +433,7 @@ static int adm1024_detect(struct i2c_adapter *adapter, int address,
return err;
}
int adm1024_detach_client(struct i2c_client *client)
static int adm1024_detach_client(struct i2c_client *client)
{
int err;
@@ -480,37 +453,24 @@ int adm1024_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int adm1024_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int adm1024_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void adm1024_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void adm1024_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int adm1024_read_value(struct i2c_client *client, u8 reg)
static int adm1024_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
}
int adm1024_write_value(struct i2c_client *client, u8 reg, u8 value)
static int adm1024_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* Called when we have found a new ADM1024. It should set limits, etc. */
void adm1024_init_client(struct i2c_client *client)
static void adm1024_init_client(struct i2c_client *client)
{
/* Reset all except Watchdog values and last conversion values
This sets fan-divs to 2, among others. This makes most other
@@ -566,7 +526,7 @@ void adm1024_init_client(struct i2c_client *client)
adm1024_write_value(client, ADM1024_REG_CONFIG, 0x07);
}
void adm1024_update_client(struct i2c_client *client)
static void adm1024_update_client(struct i2c_client *client)
{
struct adm1024_data *data = client->data;
u8 i;
@@ -879,58 +839,24 @@ void adm1024_vid(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_adm1024_init(void)
static int __init sm_adm1024_init(void)
{
int res;
printk("adm1024.o version %s (%s)\n", LM_VERSION, LM_DATE);
adm1024_initialized = 0;
if ((res = i2c_add_driver(&adm1024_driver))) {
printk
("adm1024.o: Driver registration failed, module not inserted.\n");
adm1024_cleanup();
return res;
}
adm1024_initialized++;
return 0;
return i2c_add_driver(&adm1024_driver);
}
int __init adm1024_cleanup(void)
static void __exit sm_adm1024_exit(void)
{
int res;
if (adm1024_initialized >= 1) {
if ((res = i2c_del_driver(&adm1024_driver))) {
printk
("adm1024.o: Driver deregistration failed, module not removed.\n");
return res;
}
adm1024_initialized--;
}
return 0;
i2c_del_driver(&adm1024_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("ADM1024 driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_adm1024_init();
}
int cleanup_module(void)
{
return adm1024_cleanup();
}
#endif /* MODULE */
module_init(sm_adm1024_init);
module_exit(sm_adm1024_exit);
+20 -96
View File
@@ -37,18 +37,7 @@
#include "sensors_vid.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -157,11 +146,6 @@ SENSORS_INSMOD_1(adm1025);
#define ADM1025_INIT_TEMP_MAX 600
#define ADM1025_INIT_TEMP_MIN 0
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered ADM1025, we need to keep some data in memory. That
data is pointed to by adm1025_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new adm1025 client is
@@ -190,23 +174,12 @@ struct adm1025_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_adm1025_init(void);
static int __init adm1025_cleanup(void);
static int adm1025_attach_adapter(struct i2c_adapter *adapter);
static int adm1025_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int adm1025_detach_client(struct i2c_client *client);
static int adm1025_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void adm1025_inc_use(struct i2c_client *client);
static void adm1025_dec_use(struct i2c_client *client);
static int adm1025_read_value(struct i2c_client *client, u8 register);
static int adm1025_write_value(struct i2c_client *client, u8 register,
u8 value);
@@ -236,19 +209,15 @@ static void adm1025_vrm(struct i2c_client *client, int operation,
static int adm1025_id = 0;
static struct i2c_driver adm1025_driver = {
/* name */ "ADM1025 sensor driver",
/* id */ I2C_DRIVERID_ADM1025,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &adm1025_attach_adapter,
/* detach_client */ &adm1025_detach_client,
/* command */ &adm1025_command,
/* inc_use */ &adm1025_inc_use,
/* dec_use */ &adm1025_dec_use
.owner = THIS_MODULE,
.name = "ADM1025 sensor driver",
.id = I2C_DRIVERID_ADM1025,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1025_attach_adapter,
.detach_client = adm1025_detach_client,
.command = adm1025_command,
};
/* Used by adm1025_init/cleanup */
static int __initdata adm1025_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected ADM1025. This is just a template;
though at first sight, you might think we could use a statically
@@ -283,7 +252,7 @@ static ctl_table adm1025_dir_table_template[] = {
{0}
};
int adm1025_attach_adapter(struct i2c_adapter *adapter)
static int adm1025_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, adm1025_detect);
}
@@ -400,7 +369,7 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address,
return err;
}
int adm1025_detach_client(struct i2c_client *client)
static int adm1025_detach_client(struct i2c_client *client)
{
int err;
@@ -420,37 +389,24 @@ int adm1025_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int adm1025_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int adm1025_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void adm1025_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void adm1025_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int adm1025_read_value(struct i2c_client *client, u8 reg)
static int adm1025_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
}
int adm1025_write_value(struct i2c_client *client, u8 reg, u8 value)
static int adm1025_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* Called when we have found a new ADM1025. It should set limits, etc. */
void adm1025_init_client(struct i2c_client *client)
static void adm1025_init_client(struct i2c_client *client)
{
struct adm1025_data *data = client->data;
@@ -498,7 +454,7 @@ void adm1025_init_client(struct i2c_client *client)
adm1025_write_value(client, ADM1025_REG_CONFIG, 0x01);
}
void adm1025_update_client(struct i2c_client *client)
static void adm1025_update_client(struct i2c_client *client)
{
struct adm1025_data *data = client->data;
u8 i;
@@ -723,54 +679,22 @@ void adm1025_vrm(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_adm1025_init(void)
static int __init sm_adm1025_init(void)
{
int res;
printk("adm1025.o version %s (%s)\n", LM_VERSION, LM_DATE);
adm1025_initialized = 0;
if ((res = i2c_add_driver(&adm1025_driver))) {
printk
("adm1025.o: Driver registration failed, module not inserted.\n");
adm1025_cleanup();
return res;
}
adm1025_initialized++;
return 0;
return i2c_add_driver(&adm1025_driver);
}
int __init adm1025_cleanup(void)
static void __exit sm_adm1025_exit(void)
{
int res;
if (adm1025_initialized >= 1) {
if ((res = i2c_del_driver(&adm1025_driver))) {
printk
("adm1025.o: Driver deregistration failed, module not removed.\n");
return res;
}
adm1025_initialized--;
}
return 0;
i2c_del_driver(&adm1025_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("ADM1025 driver");
int init_module(void)
{
return sensors_adm1025_init();
}
int cleanup_module(void)
{
return adm1025_cleanup();
}
#endif /* MODULE */
module_init(sm_adm1025_init);
module_exit(sm_adm1025_exit);
+21 -96
View File
@@ -62,18 +62,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -148,7 +137,7 @@ SENSORS_INSMOD_3(adm9240, ds1780, lm81);
#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255))
#define IN_FROM_REG(val,nr) (val)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -221,11 +210,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define ADM9240_INIT_TEMP_HOT_MAX 700
#define ADM9240_INIT_TEMP_HOT_HYST 600
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered ADM9240, we need to keep some data in memory. That
data is pointed to by adm9240_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new adm9240 client is
@@ -253,22 +237,12 @@ struct adm9240_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_adm9240_init(void);
static int __init adm9240_cleanup(void);
static int adm9240_attach_adapter(struct i2c_adapter *adapter);
static int adm9240_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int adm9240_detach_client(struct i2c_client *client);
static int adm9240_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void adm9240_inc_use(struct i2c_client *client);
static void adm9240_dec_use(struct i2c_client *client);
static int adm9240_read_value(struct i2c_client *client, u8 register);
static int adm9240_write_value(struct i2c_client *client, u8 register,
@@ -299,19 +273,15 @@ static void adm9240_vid(struct i2c_client *client, int operation,
static int adm9240_id = 0;
static struct i2c_driver adm9240_driver = {
/* name */ "ADM9240 sensor driver",
/* id */ I2C_DRIVERID_ADM9240,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &adm9240_attach_adapter,
/* detach_client */ &adm9240_detach_client,
/* command */ &adm9240_command,
/* inc_use */ &adm9240_inc_use,
/* dec_use */ &adm9240_dec_use
.owner = THIS_MODULE,
.name = "ADM9240 sensor driver",
.id = I2C_DRIVERID_ADM9240,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm9240_attach_adapter,
.detach_client = adm9240_detach_client,
.command = adm9240_command,
};
/* Used by adm9240_init/cleanup */
static int __initdata adm9240_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected ADM9240. This is just a template;
though at first sight, you might think we could use a statically
@@ -348,7 +318,7 @@ static ctl_table adm9240_dir_table_template[] = {
{0}
};
int adm9240_attach_adapter(struct i2c_adapter *adapter)
static int adm9240_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, adm9240_detect);
}
@@ -480,7 +450,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address,
return err;
}
int adm9240_detach_client(struct i2c_client *client)
static int adm9240_detach_client(struct i2c_client *client)
{
int err;
@@ -500,37 +470,24 @@ int adm9240_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int adm9240_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int adm9240_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void adm9240_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void adm9240_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int adm9240_read_value(struct i2c_client *client, u8 reg)
static int adm9240_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
}
int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value)
static int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* Called when we have found a new ADM9240. It should set limits, etc. */
void adm9240_init_client(struct i2c_client *client)
static void adm9240_init_client(struct i2c_client *client)
{
/* Reset all except Watchdog values and last conversion values
This sets fan-divs to 2, among others. This makes most other
@@ -575,7 +532,7 @@ void adm9240_init_client(struct i2c_client *client)
adm9240_write_value(client, ADM9240_REG_CONFIG, 0x01);
}
void adm9240_update_client(struct i2c_client *client)
static void adm9240_update_client(struct i2c_client *client)
{
struct adm9240_data *data = client->data;
u8 i;
@@ -824,54 +781,22 @@ void adm9240_vid(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_adm9240_init(void)
static int __init sm_adm9240_init(void)
{
int res;
printk("adm9240.o version %s (%s)\n", LM_VERSION, LM_DATE);
adm9240_initialized = 0;
if ((res = i2c_add_driver(&adm9240_driver))) {
printk
("adm9240.o: Driver registration failed, module not inserted.\n");
adm9240_cleanup();
return res;
}
adm9240_initialized++;
return 0;
return i2c_add_driver(&adm9240_driver);
}
int __init adm9240_cleanup(void)
static void __exit sm_adm9240_exit(void)
{
int res;
if (adm9240_initialized >= 1) {
if ((res = i2c_del_driver(&adm9240_driver))) {
printk
("adm9240.o: Driver deregistration failed, module not removed.\n");
return res;
}
adm9240_initialized--;
}
return 0;
i2c_del_driver(&adm9240_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("ADM9240 driver");
int init_module(void)
{
return sensors_adm9240_init();
}
int cleanup_module(void)
{
return adm9240_cleanup();
}
#endif /* MODULE */
module_init(sm_adm9240_init);
module_exit(sm_adm9240_exit);
+13 -78
View File
@@ -40,11 +40,6 @@ static unsigned int normal_isa_range[] = { SENSORS_ISA_END };
SENSORS_INSMOD_1(bmcsensors);
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
struct bmcsensors_data {
struct semaphore lock;
int sysctl_id;
@@ -56,13 +51,6 @@ struct bmcsensors_data {
u8 alarms;
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_bmcsensors_init(void);
static int __init bmcsensors_cleanup(void);
static int bmcsensors_attach_adapter(struct i2c_adapter *adapter);
static int bmcsensors_detect(struct i2c_adapter *adapter, int address,
@@ -70,8 +58,6 @@ static int bmcsensors_detect(struct i2c_adapter *adapter, int address,
static int bmcsensors_detach_client(struct i2c_client *client);
static int bmcsensors_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void bmcsensors_inc_use(struct i2c_client *client);
static void bmcsensors_dec_use(struct i2c_client *client);
static void bmcsensors_update_client(struct i2c_client *client);
static int bmcsensors_find(int *address);
@@ -92,14 +78,13 @@ static void bmcsensors_get_reading(struct i2c_client *client, int i);
static int bmcsensors_id = 0;
static struct i2c_driver bmcsensors_driver = {
/* name */ "BMC Sensors driver",
/* id */ I2C_DRIVERID_BMCSENSORS,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &bmcsensors_attach_adapter,
/* detach_client */ &bmcsensors_detach_client,
/* command */ &bmcsensors_command,
/* inc_use */ &bmcsensors_inc_use,
/* dec_use */ &bmcsensors_dec_use
.owner = THIS_MODULE,
.name = "BMC Sensors driver",
.id = I2C_DRIVERID_BMCSENSORS,
.flags = I2C_DF_NOTIFY,
.attach_adapter = bmcsensors_attach_adapter,
.detach_client = bmcsensors_detach_client,
.command = bmcsensors_command,
};
static struct bmcsensors_data bmc_data;
@@ -114,9 +99,6 @@ struct i2c_client bmc_client = {
0
};
static bmcsensors_initialized;
#define MAX_SDR_ENTRIES 50
#define SDR_LIMITS 8
#define SDR_MAX_ID_LENGTH 16
@@ -806,19 +788,6 @@ static int bmcsensors_detach_client(struct i2c_client *client)
return 0;
}
static void bmcsensors_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
static void bmcsensors_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
static void bmc_do_pause(unsigned int amount)
{
@@ -972,56 +941,22 @@ static void bmcsensors_alarms(struct i2c_client *client, int operation, int ctl_
#endif
}
static int __init sensors_bmcsensors_init(void)
static int __init sm_bmcsensors_init(void)
{
int res, addr;
printk(KERN_INFO "bmcsensors.o version %s (%s)\n", LM_VERSION, LM_DATE);
bmcsensors_initialized = 0;
if ((res = i2c_add_driver(&bmcsensors_driver))) {
printk(KERN_ERR
"bmcsensors.o: Driver registration failed, module not inserted.\n");
bmcsensors_cleanup();
return res;
}
bmcsensors_initialized = 1;
return 0;
return i2c_add_driver(&bmcsensors_driver);
}
static int __init bmcsensors_cleanup(void)
static void __exit sm_bmcsensors_exit(void)
{
int res;
if (bmcsensors_initialized >= 1) {
if ((res = i2c_del_driver(&bmcsensors_driver))) {
printk(KERN_WARNING
"bmcsensors.o: Driver deregistration failed, module not removed.\n");
return res;
}
bmcsensors_initialized--;
}
return 0;
i2c_del_driver(&bmcsensors_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("IPMI BMC sensors");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_bmcsensors_init();
}
int cleanup_module(void)
{
return bmcsensors_cleanup();
}
#endif /* MODULE */
module_init(sm_bmcsensors_init);
module_exit(sm_bmcsensors_exit);
+21 -98
View File
@@ -31,19 +31,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -88,18 +76,6 @@ struct bt869_data {
u8 svideo; /* output format: (2=RGB) 1=SVIDEO, 0=Composite */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_bt869_init(void);
static int __init bt869_cleanup(void);
static int bt869_attach_adapter(struct i2c_adapter *adapter);
static int bt869_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -107,8 +83,6 @@ static void bt869_init_client(struct i2c_client *client);
static int bt869_detach_client(struct i2c_client *client);
static int bt869_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void bt869_inc_use(struct i2c_client *client);
static void bt869_dec_use(struct i2c_client *client);
static int bt869_read_value(struct i2c_client *client, u8 reg);
static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value);
static void bt869_write_values(struct i2c_client *client, u16 *values);
@@ -131,14 +105,13 @@ static void bt869_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver bt869_driver = {
/* name */ "BT869 video-output chip driver",
/* id */ I2C_DRIVERID_BT869,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &bt869_attach_adapter,
/* detach_client */ &bt869_detach_client,
/* command */ &bt869_command,
/* inc_use */ &bt869_inc_use,
/* dec_use */ &bt869_dec_use
.owner = THIS_MODULE,
.name = "BT869 video-output chip driver",
.id = I2C_DRIVERID_BT869,
.flags = I2C_DF_NOTIFY,
.attach_adapter = bt869_attach_adapter,
.detach_client = bt869_detach_client,
.command = bt869_command,
};
/* These files are created for each detected bt869. This is just a template;
@@ -487,12 +460,9 @@ static u16 registers_720_480[] =
};
/* Used by init/cleanup */
static int __initdata bt869_initialized = 0;
int bt869_id = 0;
int bt869_attach_adapter(struct i2c_adapter *adapter)
static int bt869_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, bt869_detect);
}
@@ -596,7 +566,7 @@ int bt869_detect(struct i2c_adapter *adapter, int address,
return err;
}
int bt869_detach_client(struct i2c_client *client)
static int bt869_detach_client(struct i2c_client *client)
{
int err;
@@ -616,31 +586,16 @@ int bt869_detach_client(struct i2c_client *client)
/* No commands defined yet */
int bt869_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int bt869_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void bt869_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void bt869_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* All registers are byte-sized.
bt869 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int bt869_read_value(struct i2c_client *client, u8 reg)
static int bt869_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte(client);
}
@@ -648,7 +603,7 @@ int bt869_read_value(struct i2c_client *client, u8 reg)
/* All registers are byte-sized.
bt869 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
{
#ifdef DEBUG
printk("bt869.o: write_value(0x%X, 0x%X)\n", reg, value);
@@ -656,7 +611,7 @@ int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
return i2c_smbus_write_byte_data(client, reg, value);
}
void bt869_write_values(struct i2c_client *client, u16 *values)
static void bt869_write_values(struct i2c_client *client, u16 *values)
{
/* writes set of registers from array. 0,0 marks end of table */
while (*values) {
@@ -665,7 +620,7 @@ void bt869_write_values(struct i2c_client *client, u16 *values)
}
}
void bt869_init_client(struct i2c_client *client)
static void bt869_init_client(struct i2c_client *client)
{
struct bt869_data *data = client->data;
@@ -690,7 +645,7 @@ void bt869_init_client(struct i2c_client *client)
}
void bt869_update_client(struct i2c_client *client)
static void bt869_update_client(struct i2c_client *client)
{
struct bt869_data *data = client->data;
@@ -917,54 +872,22 @@ void bt869_depth(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_bt869_init(void)
static int __init sm_bt869_init(void)
{
int res;
printk("bt869.o version %s (%s)\n", LM_VERSION, LM_DATE);
bt869_initialized = 0;
if ((res = i2c_add_driver(&bt869_driver))) {
printk
("bt869.o: Driver registration failed, module not inserted.\n");
bt869_cleanup();
return res;
}
bt869_initialized++;
return 0;
return i2c_add_driver(&bt869_driver);
}
int __init bt869_cleanup(void)
static void __exit sm_bt869_exit(void)
{
int res;
if (bt869_initialized >= 1) {
if ((res = i2c_del_driver(&bt869_driver))) {
printk
("bt869.o: Driver deregistration failed, module not removed.\n");
return res;
}
bt869_initialized--;
}
return 0;
i2c_del_driver(&bt869_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Stephen Davies <steve@daviesfam.org>");
MODULE_DESCRIPTION("bt869 driver");
int init_module(void)
{
return sensors_bt869_init();
}
int cleanup_module(void)
{
return bt869_cleanup();
}
#endif /* MODULE */
module_init(sm_bt869_init);
module_exit(sm_bt869_exit);
+17 -92
View File
@@ -28,18 +28,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x50, SENSORS_I2C_END };
@@ -79,18 +68,6 @@ struct ddcmon_data {
int memtype;
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_ddcmon_init(void);
static int __init ddcmon_cleanup(void);
static int ddcmon_attach_adapter(struct i2c_adapter *adapter);
static int ddcmon_detect(struct i2c_adapter *adapter, int address,
@@ -99,9 +76,6 @@ static int ddcmon_detach_client(struct i2c_client *client);
static int ddcmon_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void ddcmon_inc_use(struct i2c_client *client);
static void ddcmon_dec_use(struct i2c_client *client);
static void ddcmon_idcall(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void ddcmon_size(struct i2c_client *client, int operation,
@@ -117,14 +91,13 @@ static void ddcmon_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver ddcmon_driver = {
/* name */ "DDCMON READER",
/* id */ I2C_DRIVERID_DDCMON,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &ddcmon_attach_adapter,
/* detach_client */ &ddcmon_detach_client,
/* command */ &ddcmon_command,
/* inc_use */ &ddcmon_inc_use,
/* dec_use */ &ddcmon_dec_use
.owner = THIS_MODULE,
.name = "DDCMON READER",
.id = I2C_DRIVERID_DDCMON,
.flags = I2C_DF_NOTIFY,
.attach_adapter = ddcmon_attach_adapter,
.detach_client = ddcmon_detach_client,
.command = ddcmon_command,
};
/* These files are created for each detected DDCMON. This is just a template;
@@ -146,12 +119,9 @@ static ctl_table ddcmon_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata ddcmon_initialized = 0;
static int ddcmon_id = 0;
int ddcmon_attach_adapter(struct i2c_adapter *adapter)
static int ddcmon_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, ddcmon_detect);
}
@@ -236,7 +206,7 @@ int ddcmon_detect(struct i2c_adapter *adapter, int address,
return err;
}
int ddcmon_detach_client(struct i2c_client *client)
static int ddcmon_detach_client(struct i2c_client *client)
{
int err;
@@ -252,26 +222,12 @@ int ddcmon_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int ddcmon_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int ddcmon_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void ddcmon_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void ddcmon_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
void ddcmon_update_client(struct i2c_client *client)
static void ddcmon_update_client(struct i2c_client *client)
{
struct ddcmon_data *data = client->data;
int i, j;
@@ -403,54 +359,23 @@ void ddcmon_serial(struct i2c_client *client, int operation,
}
}
int __init sensors_ddcmon_init(void)
static int __init sm_ddcmon_init(void)
{
int res;
printk("ddcmon.o version %s (%s)\n", LM_VERSION, LM_DATE);
ddcmon_initialized = 0;
if ((res = i2c_add_driver(&ddcmon_driver))) {
printk
("ddcmon.o: Driver registration failed, module not inserted.\n");
ddcmon_cleanup();
return res;
}
ddcmon_initialized++;
return 0;
return i2c_add_driver(&ddcmon_driver);
}
int __init ddcmon_cleanup(void)
static void __exit sm_ddcmon_exit(void)
{
int res;
if (ddcmon_initialized >= 1) {
if ((res = i2c_del_driver(&ddcmon_driver))) {
printk
("ddcmon.o: Driver deregistration failed, module not removed.\n");
return res;
}
} else
ddcmon_initialized--;
return 0;
i2c_del_driver(&ddcmon_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge .com>, "
"and Mark Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("DDCMON driver");
int init_module(void)
{
return sensors_ddcmon_init();
}
int cleanup_module(void)
{
return ddcmon_cleanup();
}
#endif /* MODULE */
module_init(sm_ddcmon_init);
module_exit(sm_ddcmon_exit);
+14 -41
View File
@@ -315,62 +315,35 @@ static int ds1307_command (struct i2c_client *client,unsigned int cmd,void *arg)
return (-EINVAL);
}
static void ds1307_inc_use (struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif /* #ifdef MODULE */
}
static void ds1307_dec_use (struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif /* #ifdef MODULE */
}
static struct i2c_driver ds1307 = {
name: "ds1307",
id: I2C_DRIVERID_DS1307,
flags: I2C_DF_NOTIFY,
attach_adapter: ds1307_attach_adapter,
detach_client: ds1307_detach_client,
command: ds1307_command,
inc_use: ds1307_inc_use,
dec_use: ds1307_dec_use
.owner = THIS_MODULE,
.name = "ds1307",
.id = I2C_DRIVERID_DS1307,
.flags = I2C_DF_NOTIFY,
.attach_adapter = ds1307_attach_adapter,
.detach_client = ds1307_detach_client,
.command = ds1307_command,
};
static int __init ds1307_init (void)
static int __init sm_ds1307_init(void)
{
int result;
if ((result = i2c_add_driver (&ds1307)))
return (result);
printk ("Dallas Semiconductor DS1307 Real-Time Clock driver (V0.03)\n");
return (0);
return i2c_add_driver(&ds1307);
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
#undef __exit
#define __exit
#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
static void __exit ds1307_exit (void)
static void __exit sm_ds1307_exit(void)
{
i2c_del_driver (&ds1307);
i2c_del_driver(&ds1307);
}
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
MODULE_DESCRIPTION ("Linux support for DS1307 Real-Time Clock");
#ifdef MODULE_LICENSE
MODULE_LICENSE ("GPL");
#endif /* #ifdef MODULE_LICENSE */
module_init (ds1307_init);
module_exit (ds1307_exit);
module_init(sm_ds1307_init);
module_exit(sm_ds1307_exit);
+22 -97
View File
@@ -29,18 +29,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -109,18 +98,6 @@ struct ds1621_data {
u8 temp_int, temp_counter, temp_slope; /* Register values, byte */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_ds1621_init(void);
static int __init ds1621_cleanup(void);
static int ds1621_attach_adapter(struct i2c_adapter *adapter);
static int ds1621_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -128,8 +105,7 @@ static void ds1621_init_client(struct i2c_client *client);
static int ds1621_detach_client(struct i2c_client *client);
static int ds1621_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void ds1621_inc_use(struct i2c_client *client);
static void ds1621_dec_use(struct i2c_client *client);
static u16 swap_bytes(u16 val);
static int ds1621_read_value(struct i2c_client *client, u8 reg);
static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value);
@@ -148,14 +124,13 @@ static void ds1621_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver ds1621_driver = {
/* name */ "DS1621 sensor driver",
/* id */ I2C_DRIVERID_DS1621,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &ds1621_attach_adapter,
/* detach_client */ &ds1621_detach_client,
/* command */ &ds1621_command,
/* inc_use */ &ds1621_inc_use,
/* dec_use */ &ds1621_dec_use
.owner = THIS_MODULE,
.name = "DS1621 sensor driver",
.id = I2C_DRIVERID_DS1621,
.flags = I2C_DF_NOTIFY,
.attach_adapter = ds1621_attach_adapter,
.detach_client = ds1621_detach_client,
.command = ds1621_command,
};
/* These files are created for each detected DS1621. This is just a template;
@@ -177,12 +152,9 @@ static ctl_table ds1621_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata ds1621_initialized = 0;
static int ds1621_id = 0;
int ds1621_attach_adapter(struct i2c_adapter *adapter)
static int ds1621_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, ds1621_detect);
}
@@ -287,7 +259,7 @@ int ds1621_detect(struct i2c_adapter *adapter, int address,
return err;
}
int ds1621_detach_client(struct i2c_client *client)
static int ds1621_detach_client(struct i2c_client *client)
{
int err;
@@ -313,28 +285,13 @@ int ds1621_detach_client(struct i2c_client *client)
/* No commands defined yet */
int ds1621_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int ds1621_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void ds1621_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void ds1621_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u16 swap_bytes(u16 val)
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
@@ -342,7 +299,7 @@ u16 swap_bytes(u16 val)
/* All registers are word-sized, except for the configuration register.
DS1621 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int ds1621_read_value(struct i2c_client *client, u8 reg)
static int ds1621_read_value(struct i2c_client *client, u8 reg)
{
if ((reg == DS1621_REG_CONF) || (reg == DS1621_REG_TEMP_COUNTER)
|| (reg == DS1621_REG_TEMP_SLOPE))
@@ -354,7 +311,7 @@ int ds1621_read_value(struct i2c_client *client, u8 reg)
/* All registers are word-sized, except for the configuration register.
DS1621 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
{
if ( (reg == DS1621_COM_START) || (reg == DS1621_COM_STOP) )
return i2c_smbus_write_byte(client, reg);
@@ -367,7 +324,7 @@ int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
swap_bytes(value));
}
void ds1621_init_client(struct i2c_client *client)
static void ds1621_init_client(struct i2c_client *client)
{
int reg;
@@ -382,7 +339,7 @@ void ds1621_init_client(struct i2c_client *client)
ds1621_write_value(client, DS1621_REG_CONF, reg & 0xfe);
}
void ds1621_update_client(struct i2c_client *client)
static void ds1621_update_client(struct i2c_client *client)
{
struct ds1621_data *data = client->data;
u8 new_conf;
@@ -573,53 +530,21 @@ void ds1621_polarity(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_ds1621_init(void)
static int __init sm_ds1621_init(void)
{
int res;
printk("ds1621.o version %s (%s)\n", LM_VERSION, LM_DATE);
ds1621_initialized = 0;
if ((res = i2c_add_driver(&ds1621_driver))) {
printk
("ds1621.o: Driver registration failed, module not inserted.\n");
ds1621_cleanup();
return res;
}
ds1621_initialized++;
return 0;
return i2c_add_driver(&ds1621_driver);
}
int __init ds1621_cleanup(void)
static void __exit sm_ds1621_exit(void)
{
int res;
if (ds1621_initialized >= 1) {
if ((res = i2c_del_driver(&ds1621_driver))) {
printk
("ds1621.o: Driver deregistration failed, module not removed.\n");
return res;
}
ds1621_initialized--;
}
return 0;
i2c_del_driver(&ds1621_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Christian W. Zuckschwerdt <zany@triq.net>");
MODULE_DESCRIPTION("DS1621 driver");
int init_module(void)
{
return sensors_ds1621_init();
}
int cleanup_module(void)
{
return ds1621_cleanup();
}
#endif /* MODULE */
module_init(sm_ds1621_init);
module_exit(sm_ds1621_exit);
+18 -93
View File
@@ -27,18 +27,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -85,18 +74,6 @@ struct eeprom_data {
#endif
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_eeprom_init(void);
static int __init eeprom_cleanup(void);
static int eeprom_attach_adapter(struct i2c_adapter *adapter);
static int eeprom_detect(struct i2c_adapter *adapter, int address,
@@ -105,9 +82,6 @@ static int eeprom_detach_client(struct i2c_client *client);
static int eeprom_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void eeprom_inc_use(struct i2c_client *client);
static void eeprom_dec_use(struct i2c_client *client);
#if 0
static int eeprom_write_value(struct i2c_client *client, u8 reg,
u8 value);
@@ -120,14 +94,13 @@ static void eeprom_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver eeprom_driver = {
/* name */ "EEPROM READER",
/* id */ I2C_DRIVERID_EEPROM,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &eeprom_attach_adapter,
/* detach_client */ &eeprom_detach_client,
/* command */ &eeprom_command,
/* inc_use */ &eeprom_inc_use,
/* dec_use */ &eeprom_dec_use
.owner = THIS_MODULE,
.name = "EEPROM READER",
.id = I2C_DRIVERID_EEPROM,
.flags = I2C_DF_NOTIFY,
.attach_adapter = eeprom_attach_adapter,
.detach_client = eeprom_detach_client,
.command = eeprom_command,
};
/* These files are created for each detected EEPROM. This is just a template;
@@ -171,12 +144,9 @@ static ctl_table eeprom_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata eeprom_initialized = 0;
static int eeprom_id = 0;
int eeprom_attach_adapter(struct i2c_adapter *adapter)
static int eeprom_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, eeprom_detect);
}
@@ -285,7 +255,7 @@ int eeprom_detect(struct i2c_adapter *adapter, int address,
return err;
}
int eeprom_detach_client(struct i2c_client *client)
static int eeprom_detach_client(struct i2c_client *client)
{
int err;
@@ -305,34 +275,21 @@ int eeprom_detach_client(struct i2c_client *client)
/* No commands defined yet */
int eeprom_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int eeprom_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void eeprom_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void eeprom_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
#if 0
/* No writes yet (PAE) */
int eeprom_write_value(struct i2c_client *client, u8 reg, u8 value)
static int eeprom_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
#endif
void eeprom_update_client(struct i2c_client *client)
static void eeprom_update_client(struct i2c_client *client)
{
struct eeprom_data *data = client->data;
int i, j;
@@ -454,54 +411,22 @@ void eeprom_contents(struct i2c_client *client, int operation,
}
}
int __init sensors_eeprom_init(void)
static int __init sm_eeprom_init(void)
{
int res;
printk("eeprom.o version %s (%s)\n", LM_VERSION, LM_DATE);
eeprom_initialized = 0;
if ((res = i2c_add_driver(&eeprom_driver))) {
printk
("eeprom.o: Driver registration failed, module not inserted.\n");
eeprom_cleanup();
return res;
}
eeprom_initialized++;
return 0;
return i2c_add_driver(&eeprom_driver);
}
int __init eeprom_cleanup(void)
static void __exit sm_eeprom_exit(void)
{
int res;
if (eeprom_initialized >= 1) {
if ((res = i2c_del_driver(&eeprom_driver))) {
printk
("eeprom.o: Driver deregistration failed, module not removed.\n");
return res;
}
} else
eeprom_initialized--;
return 0;
i2c_del_driver(&eeprom_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("EEPROM driver");
int init_module(void)
{
return sensors_eeprom_init();
}
int cleanup_module(void)
{
return eeprom_cleanup();
}
#endif /* MODULE */
module_init(sm_eeprom_init);
module_exit(sm_eeprom_exit);
+20 -97
View File
@@ -39,15 +39,6 @@
#include "sensors.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END };
@@ -124,11 +115,6 @@ SENSORS_INSMOD_1(fscpos);
/* Initial limits */
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered FSCPOS, we need to keep some data in memory. That
data is pointed to by fscpos_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new fscpos client is
@@ -154,22 +140,12 @@ struct fscpos_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_fscpos_init(void);
static int __init fscpos_cleanup(void);
static int fscpos_attach_adapter(struct i2c_adapter *adapter);
static int fscpos_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int fscpos_detach_client(struct i2c_client *client);
static int fscpos_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void fscpos_inc_use(struct i2c_client *client);
static void fscpos_dec_use(struct i2c_client *client);
static int fscpos_read_value(struct i2c_client *client, u8 register);
static int fscpos_write_value(struct i2c_client *client, u8 register,
@@ -195,19 +171,15 @@ static void fscpos_wdog(struct i2c_client *client, int operation,
static int fscpos_id = 0;
static struct i2c_driver fscpos_driver = {
/* name */ "FSCPOS sensor driver",
/* id */ I2C_DRIVERID_FSCPOS,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &fscpos_attach_adapter,
/* detach_client */ &fscpos_detach_client,
/* command */ &fscpos_command,
/* inc_use */ &fscpos_inc_use,
/* dec_use */ &fscpos_dec_use
.owner = THIS_MODULE,
.name = "FSCPOS sensor driver",
.id = I2C_DRIVERID_FSCPOS,
.flags = I2C_DF_NOTIFY,
.attach_adapter = fscpos_attach_adapter,
.detach_client = fscpos_detach_client,
.command = fscpos_command,
};
/* Used by fscpos_init/cleanup */
static int __initdata fscpos_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected FSCPOS. This is just a template;
though at first sight, you might think we could use a statically
@@ -244,7 +216,7 @@ static ctl_table fscpos_dir_table_template[] = {
{0}
};
int fscpos_attach_adapter(struct i2c_adapter *adapter)
static int fscpos_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, fscpos_detect);
}
@@ -337,7 +309,7 @@ int fscpos_detect(struct i2c_adapter *adapter, int address,
return err;
}
int fscpos_detach_client(struct i2c_client *client)
static int fscpos_detach_client(struct i2c_client *client)
{
int err;
@@ -356,27 +328,13 @@ int fscpos_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int fscpos_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int fscpos_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void fscpos_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void fscpos_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int fscpos_read_value(struct i2c_client *client, u8 reg)
static int fscpos_read_value(struct i2c_client *client, u8 reg)
{
#ifdef DEBUG
printk("fscpos: read reg 0x%02x\n",reg);
@@ -384,7 +342,7 @@ int fscpos_read_value(struct i2c_client *client, u8 reg)
return i2c_smbus_read_byte_data(client, reg);
}
int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
static int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
{
#ifdef DEBUG
printk("fscpos: write reg 0x%02x, val 0x%02x\n",reg, value);
@@ -393,7 +351,7 @@ int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
}
/* Called when we have found a new FSCPOS. It should set limits, etc. */
void fscpos_init_client(struct i2c_client *client)
static void fscpos_init_client(struct i2c_client *client)
{
struct fscpos_data *data = client->data;
@@ -403,7 +361,7 @@ void fscpos_init_client(struct i2c_client *client)
data->fan_min[2] = 0xff;
}
void fscpos_update_client(struct i2c_client *client)
static void fscpos_update_client(struct i2c_client *client)
{
struct fscpos_data *data = client->data;
@@ -714,58 +672,23 @@ void fscpos_wdog(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_fscpos_init(void)
static int __init sm_fscpos_init(void)
{
int res;
printk("fscpos.o version %s (%s)\n", LM_VERSION, LM_DATE);
fscpos_initialized = 0;
if ((res = i2c_add_driver(&fscpos_driver))) {
printk
("fscpos.o: Driver registration failed, module not inserted.\n");
fscpos_cleanup();
return res;
}
fscpos_initialized++;
return 0;
return i2c_add_driver(&fscpos_driver);
}
int __init fscpos_cleanup(void)
static void __exit sm_fscpos_exit(void)
{
int res;
if (fscpos_initialized >= 1) {
if ((res = i2c_del_driver(&fscpos_driver))) {
printk
("fscpos.o: Driver deregistration failed, module not removed.\n");
return res;
}
fscpos_initialized--;
}
return 0;
i2c_del_driver(&fscpos_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Hermann Jung <hej@odn.de> based on work from Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("fujitsu siemens poseidon chip driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_fscpos_init();
}
int cleanup_module(void)
{
return fscpos_cleanup();
}
#endif /* MODULE */
module_init(sm_fscpos_init);
module_exit(sm_fscpos_exit);
+20 -97
View File
@@ -39,19 +39,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END };
@@ -170,11 +158,6 @@ SENSORS_INSMOD_1(fscscy);
/* Initial limits */
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered FSCSCY, we need to keep some data in memory. That
data is pointed to by fscscy_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new fscscy client is
@@ -210,22 +193,12 @@ struct fscscy_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_fscscy_init(void);
static int __init fscscy_cleanup(void);
static int fscscy_attach_adapter(struct i2c_adapter *adapter);
static int fscscy_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int fscscy_detach_client(struct i2c_client *client);
static int fscscy_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void fscscy_inc_use(struct i2c_client *client);
static void fscscy_dec_use(struct i2c_client *client);
static int fscscy_read_value(struct i2c_client *client, u8 register);
static int fscscy_write_value(struct i2c_client *client, u8 register,
@@ -255,19 +228,15 @@ static void fscscy_intrusion(struct i2c_client *client, int operation,
static int fscscy_id = 0;
static struct i2c_driver fscscy_driver = {
/* name */ "FSCSCY sensor driver",
/* id */ I2C_DRIVERID_FSCSCY,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &fscscy_attach_adapter,
/* detach_client */ &fscscy_detach_client,
/* command */ &fscscy_command,
/* inc_use */ &fscscy_inc_use,
/* dec_use */ &fscscy_dec_use
.owner = THIS_MODULE,
.name = "FSCSCY sensor driver",
.id = I2C_DRIVERID_FSCSCY,
.flags = I2C_DF_NOTIFY,
.attach_adapter = fscscy_attach_adapter,
.detach_client = fscscy_detach_client,
.command = fscscy_command,
};
/* Used by fscscy_init/cleanup */
static int __initdata fscscy_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected FSCSCY. This is just a template;
though at first sight, you might think we could use a statically
@@ -316,7 +285,7 @@ static ctl_table fscscy_dir_table_template[] = {
{0}
};
int fscscy_attach_adapter(struct i2c_adapter *adapter)
static int fscscy_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, fscscy_detect);
}
@@ -409,7 +378,7 @@ int fscscy_detect(struct i2c_adapter *adapter, int address,
return err;
}
int fscscy_detach_client(struct i2c_client *client)
static int fscscy_detach_client(struct i2c_client *client)
{
int err;
@@ -428,27 +397,13 @@ int fscscy_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int fscscy_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int fscscy_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void fscscy_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void fscscy_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int fscscy_read_value(struct i2c_client *client, u8 reg)
static int fscscy_read_value(struct i2c_client *client, u8 reg)
{
#ifdef DEBUG
printk("fscscy: read reg 0x%02x\n",reg);
@@ -456,7 +411,7 @@ int fscscy_read_value(struct i2c_client *client, u8 reg)
return i2c_smbus_read_byte_data(client, reg);
}
int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value)
static int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value)
{
#ifdef DEBUG
printk("fscscy: write reg 0x%02x, val 0x%02x\n",reg, value);
@@ -465,7 +420,7 @@ int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value)
}
/* Called when we have found a new FSCSCY. It should set limits, etc. */
void fscscy_init_client(struct i2c_client *client)
static void fscscy_init_client(struct i2c_client *client)
{
struct fscscy_data *data = client->data;
@@ -488,7 +443,7 @@ void fscscy_init_client(struct i2c_client *client)
data->volt_min[2] = data->volt_max[2] = fscscy_read_value(client, FSCSCY_REG_VOLT_BATT);
}
void fscscy_update_client(struct i2c_client *client)
static void fscscy_update_client(struct i2c_client *client)
{
struct fscscy_data *data = client->data;
@@ -933,54 +888,22 @@ void fscscy_intrusion(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_fscscy_init(void)
static int __init sm_fscscy_init(void)
{
int res;
printk("fscscy.o version %s (%s)\n", LM_VERSION, LM_DATE);
fscscy_initialized = 0;
if ((res = i2c_add_driver(&fscscy_driver))) {
printk
("fscscy.o: Driver registration failed, module not inserted.\n");
fscscy_cleanup();
return res;
}
fscscy_initialized++;
return 0;
return i2c_add_driver(&fscscy_driver);
}
int __init fscscy_cleanup(void)
static void __exit sm_fscscy_exit(void)
{
int res;
if (fscscy_initialized >= 1) {
if ((res = i2c_del_driver(&fscscy_driver))) {
printk
("fscscy.o: Driver deregistration failed, module not removed.\n");
return res;
}
fscscy_initialized--;
}
return 0;
i2c_del_driver(&fscscy_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Martin Knoblauch <mkn@teraport.de> based on work (fscpos) from Hermann Jung <hej@odn.de>");
MODULE_DESCRIPTION("fujitsu siemens scylla chip driver");
int init_module(void)
{
return sensors_fscscy_init();
}
int cleanup_module(void)
{
return fscscy_cleanup();
}
#endif /* MODULE */
module_init(sm_fscscy_init);
module_exit(sm_fscscy_exit);
+26 -116
View File
@@ -31,18 +31,7 @@
#include <linux/smp_lock.h>
#endif
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, SENSORS_I2C_END };
@@ -92,7 +81,7 @@ SENSORS_INSMOD_2(gl518sm_r00, gl518sm_r80);
0,255))
#define TEMP_FROM_REG(val) (((val) - 119) * 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -163,11 +152,7 @@ struct gl518_data {
int iterate_lock;
int quit_thread;
struct task_struct *thread;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
wait_queue_head_t wq;
#else
struct wait_queue *wq;
#endif
char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */
unsigned long last_updated_v00;
@@ -189,18 +174,6 @@ struct gl518_data {
u8 iterate; /* Voltage iteration mode */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_gl518sm_init(void);
static int __init gl518_cleanup(void);
static int gl518_attach_adapter(struct i2c_adapter *adapter);
static int gl518_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -208,17 +181,13 @@ static void gl518_init_client(struct i2c_client *client);
static int gl518_detach_client(struct i2c_client *client);
static int gl518_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void gl518_inc_use(struct i2c_client *client);
static void gl518_dec_use(struct i2c_client *client);
static u16 swap_bytes(u16 val);
static int gl518_read_value(struct i2c_client *client, u8 reg);
static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value);
static void gl518_update_client(struct i2c_client *client);
static void gl518_update_client_rev00(struct i2c_client *client);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
static int gl518_update_thread(void *data);
#endif
static void gl518_update_iterate(struct i2c_client *client);
static void gl518_vin(struct i2c_client *client, int operation,
@@ -240,14 +209,13 @@ static void gl518_iterate(struct i2c_client *client, int operation,
/* This is the driver that will be inserted */
static struct i2c_driver gl518_driver = {
/* name */ "GL518SM sensor chip driver",
/* id */ I2C_DRIVERID_GL518,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &gl518_attach_adapter,
/* detach_client */ &gl518_detach_client,
/* command */ &gl518_command,
/* inc_use */ &gl518_inc_use,
/* dec_use */ &gl518_dec_use
.owner = THIS_MODULE,
.name = "GL518SM sensor chip driver",
.id = I2C_DRIVERID_GL518,
.flags = I2C_DF_NOTIFY,
.attach_adapter = gl518_attach_adapter,
.detach_client = gl518_detach_client,
.command = gl518_command,
};
/* These files are created for each detected GL518. This is just a template;
@@ -283,16 +251,13 @@ static ctl_table gl518_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata gl518_initialized = 0;
/* I choose here for semi-static GL518SM allocation. Complete dynamic
allocation could also be used; the code needed for this would probably
take more memory than the datastructure takes now. */
#define MAX_GL518_NR 4
static struct i2c_client *gl518_list[MAX_GL518_NR];
int gl518_attach_adapter(struct i2c_adapter *adapter)
static int gl518_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, gl518_detect);
}
@@ -443,7 +408,7 @@ static int gl518_detect(struct i2c_adapter *adapter, int address,
/* Called when we have found a new GL518SM. It should set limits, etc. */
void gl518_init_client(struct i2c_client *client)
static void gl518_init_client(struct i2c_client *client)
{
/* Power-on defaults (bit 7=1) */
gl518_write_value(client, GL518_REG_CONF, 0x80);
@@ -482,7 +447,7 @@ void gl518_init_client(struct i2c_client *client)
gl518_write_value(client, GL518_REG_CONF, 0x44);
}
int gl518_detach_client(struct i2c_client *client)
static int gl518_detach_client(struct i2c_client *client)
{
int err, i;
struct gl518_data *data = client->data;
@@ -517,28 +482,13 @@ int gl518_detach_client(struct i2c_client *client)
/* No commands defined yet */
int gl518_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int gl518_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void gl518_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void gl518_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u16 swap_bytes(u16 val)
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
@@ -546,7 +496,7 @@ u16 swap_bytes(u16 val)
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
GL518 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int gl518_read_value(struct i2c_client *client, u8 reg)
static int gl518_read_value(struct i2c_client *client, u8 reg)
{
if ((reg >= 0x07) && (reg <= 0x0c))
return swap_bytes(i2c_smbus_read_word_data(client, reg));
@@ -557,7 +507,7 @@ int gl518_read_value(struct i2c_client *client, u8 reg)
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
GL518 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int gl518_write_value(struct i2c_client *client, u8 reg, u16 value)
static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value)
{
if ((reg >= 0x07) && (reg <= 0x0c))
return i2c_smbus_write_word_data(client, reg,
@@ -566,7 +516,7 @@ int gl518_write_value(struct i2c_client *client, u8 reg, u16 value)
return i2c_smbus_write_byte_data(client, reg, value);
}
void gl518_update_client(struct i2c_client *client)
static void gl518_update_client(struct i2c_client *client)
{
struct gl518_data *data = client->data;
int val;
@@ -645,7 +595,7 @@ void gl518_update_client(struct i2c_client *client)
/* Here we decide how to run the iteration code.
When called, we trigger the iteration and report the last
measured voltage. No delay for user apps */
void gl518_update_client_rev00(struct i2c_client *client)
static void gl518_update_client_rev00(struct i2c_client *client)
{
struct gl518_data *data = client->data;
int i;
@@ -672,7 +622,7 @@ void gl518_update_client_rev00(struct i2c_client *client)
}
}
int gl518_update_thread(void *c)
static int gl518_update_thread(void *c)
{
struct i2c_client *client = c;
struct gl518_data *data = client->data;
@@ -687,11 +637,7 @@ int gl518_update_thread(void *c)
current->fs->umask = 0;
strcpy(current->comm, "gl518sm");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
init_waitqueue_head(&(data->wq));
#else
data->wq = NULL;
#endif
data->thread = current;
#ifdef __SMP__
@@ -719,7 +665,7 @@ int gl518_update_thread(void *c)
comparisons for the GL518SM rev 00 that lacks support for direct
reading of these values. Values are kept in iter_voltage */
void gl518_update_iterate(struct i2c_client *client)
static void gl518_update_iterate(struct i2c_client *client)
{
struct gl518_data *data = client->data;
int i, j, loop_more = 1, min[3], max[3], delta[3];
@@ -1062,11 +1008,7 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name,
data->quit_thread = 1;
wake_up_interruptible(&data->wq);
} else if ((data->iterate == 2) && (!data->thread)) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
init_waitqueue_head(&(data->wq));
#else
data->wq = NULL;
#endif
kernel_thread(gl518_update_thread,
(void *) client, 0);
}
@@ -1074,54 +1016,22 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_gl518sm_init(void)
static int __init sm_gl518sm_init(void)
{
int res;
printk("gl518sm.o version %s (%s)\n", LM_VERSION, LM_DATE);
gl518_initialized = 0;
if ((res = i2c_add_driver(&gl518_driver))) {
printk
("gl518sm.o: Driver registration failed, module not inserted.\n");
gl518_cleanup();
return res;
}
gl518_initialized++;
return 0;
return i2c_add_driver(&gl518_driver);
}
int __init gl518_cleanup(void)
static void __exit sm_gl518sm_exit(void)
{
int res;
if (gl518_initialized >= 1) {
if ((res = i2c_del_driver(&gl518_driver))) {
printk
("gl518.o: Driver deregistration failed, module not removed.\n");
return res;
}
gl518_initialized--;
}
return 0;
i2c_del_driver(&gl518_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Kyösti Mälkki <kmalkki@cc.hut.fi>");
MODULE_DESCRIPTION("GL518SM driver");
int init_module(void)
{
return sensors_gl518sm_init();
}
int cleanup_module(void)
{
return gl518_cleanup();
}
#endif /* MODULE */
module_init(sm_gl518sm_init);
module_exit(sm_gl518sm_exit);
+23 -98
View File
@@ -28,18 +28,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, SENSORS_I2C_END };
@@ -94,7 +83,7 @@ That's why _TEMP2 and _VIN4 access the same register
0,255))
#define TEMP_FROM_REG(val) (((val) - 130) * 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -185,18 +174,6 @@ struct gl520_data {
u8 two_temps; /* Boolean */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_gl520_init(void);
static int __init gl520_cleanup(void);
static int gl520_attach_adapter(struct i2c_adapter *adapter);
static int gl520_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -204,8 +181,7 @@ static void gl520_init_client(struct i2c_client *client);
static int gl520_detach_client(struct i2c_client *client);
static int gl520_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void gl520_inc_use(struct i2c_client *client);
static void gl520_dec_use(struct i2c_client *client);
static u16 swap_bytes(u16 val);
static int gl520_read_value(struct i2c_client *client, u8 reg);
static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value);
@@ -232,14 +208,13 @@ static void gl520_config(struct i2c_client *client, int operation,
/* This is the driver that will be inserted */
static struct i2c_driver gl520_driver = {
/* name */ "GL520SM sensor chip driver",
/* id */ I2C_DRIVERID_GL520,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &gl520_attach_adapter,
/* detach_client */ &gl520_detach_client,
/* command */ &gl520_command,
/* inc_use */ &gl520_inc_use,
/* dec_use */ &gl520_dec_use
.owner = THIS_MODULE,
.name = "GL520SM sensor chip driver",
.id = I2C_DRIVERID_GL520,
.flags = I2C_DF_NOTIFY,
.attach_adapter = gl520_attach_adapter,
.detach_client = gl520_detach_client,
.command = gl520_command,
};
/* These files are created for each detected GL520. This is just a template;
@@ -281,15 +256,12 @@ static ctl_table gl520_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata gl520_initialized = 0;
/* I choose here for semi-static GL520SM allocation. Complete dynamic
allocation could also be used; the code needed for this would probably
take more memory than the datastructure takes now. */
static int gl520_id = 0;
int gl520_attach_adapter(struct i2c_adapter *adapter)
static int gl520_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, gl520_detect);
}
@@ -402,7 +374,7 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
/* Called when we have found a new GL520SM. It should set limits, etc. */
void gl520_init_client(struct i2c_client *client)
static void gl520_init_client(struct i2c_client *client)
{
/* Power-on defaults (bit 7=1) */
gl520_write_value(client, GL520_REG_CONF, 0x80);
@@ -449,7 +421,7 @@ void gl520_init_client(struct i2c_client *client)
gl520_write_value(client, GL520_REG_CONF, 0x44);
}
int gl520_detach_client(struct i2c_client *client)
static int gl520_detach_client(struct i2c_client *client)
{
int err;
@@ -469,28 +441,13 @@ int gl520_detach_client(struct i2c_client *client)
/* No commands defined yet */
int gl520_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int gl520_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void gl520_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void gl520_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u16 swap_bytes(u16 val)
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
@@ -498,7 +455,7 @@ u16 swap_bytes(u16 val)
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
GL520 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int gl520_read_value(struct i2c_client *client, u8 reg)
static int gl520_read_value(struct i2c_client *client, u8 reg)
{
if ((reg >= 0x07) && (reg <= 0x0c))
return swap_bytes(i2c_smbus_read_word_data(client, reg));
@@ -509,7 +466,7 @@ int gl520_read_value(struct i2c_client *client, u8 reg)
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
GL520 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
{
if ((reg >= 0x07) && (reg <= 0x0c))
return i2c_smbus_write_word_data(client, reg,
@@ -518,7 +475,7 @@ int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
return i2c_smbus_write_byte_data(client, reg, value);
}
void gl520_update_client(struct i2c_client *client)
static void gl520_update_client(struct i2c_client *client)
{
struct gl520_data *data = client->data;
int val;
@@ -874,54 +831,22 @@ void gl520_config(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_gl520_init(void)
static int __init sm_gl520sm_init(void)
{
int res;
printk("gl520sm.o version %s (%s)\n", LM_VERSION, LM_DATE);
gl520_initialized = 0;
if ((res = i2c_add_driver(&gl520_driver))) {
printk
("gl520sm.o: Driver registration failed, module not inserted.\n");
gl520_cleanup();
return res;
}
gl520_initialized++;
return 0;
return i2c_add_driver(&gl520_driver);
}
int __init gl520_cleanup(void)
static void __exit sm_gl520sm_exit(void)
{
int res;
if (gl520_initialized >= 1) {
if ((res = i2c_del_driver(&gl520_driver))) {
printk
("gl520.o: Driver deregistration failed, module not removed.\n");
return res;
}
gl520_initialized--;
}
return 0;
i2c_del_driver(&gl520_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Kyösti Mälkki <kmalkki@cc.hut.fi>");
MODULE_DESCRIPTION("GL520SM driver");
int init_module(void)
{
return sensors_gl520_init();
}
int cleanup_module(void)
{
return gl520_cleanup();
}
#endif /* MODULE */
module_init(sm_gl520sm_init);
module_exit(sm_gl520sm_exit);
+18 -94
View File
@@ -37,19 +37,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
#define ADDRESS 0x69
@@ -74,27 +62,12 @@ struct icspll_data {
int memtype;
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_icspll_init(void);
static int __init icspll_cleanup(void);
static int icspll_attach_adapter(struct i2c_adapter *adapter);
static int icspll_detach_client(struct i2c_client *client);
static int icspll_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static int icspll_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static void icspll_inc_use(struct i2c_client *client);
static void icspll_dec_use(struct i2c_client *client);
#if 0
static int icspll_write_value(struct i2c_client *client, u8 reg,
@@ -108,14 +81,13 @@ static void icspll_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver icspll_driver = {
/* name */ "Clock chip reader",
/* id */ I2C_DRIVERID_ICSPLL,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &icspll_attach_adapter,
/* detach_client */ &icspll_detach_client,
/* command */ &icspll_command,
/* inc_use */ &icspll_inc_use,
/* dec_use */ &icspll_dec_use
.owner = THIS_MODULE,
.name = "Clock chip reader",
.id = I2C_DRIVERID_ICSPLL,
.flags = I2C_DF_NOTIFY,
.attach_adapter = icspll_attach_adapter,
.detach_client = icspll_detach_client,
.command = icspll_command,
};
/* These files are created for each detected ICSPLL. This is just a template;
@@ -132,11 +104,8 @@ static ctl_table icspll_dir_table_template[] = {
/* holding place for data - block read could be as much as 32 */
static u8 tempdata[MAXBLOCK_SIZE];
/* Used by init/cleanup */
static int __initdata icspll_initialized = 0;
static int icspll_id = 0;
int icspll_attach_adapter(struct i2c_adapter *adapter)
static int icspll_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, icspll_detect);
}
@@ -215,7 +184,7 @@ int icspll_detect(struct i2c_adapter *adapter, int address,
return err;
}
int icspll_detach_client(struct i2c_client *client)
static int icspll_detach_client(struct i2c_client *client)
{
int err;
@@ -234,35 +203,22 @@ int icspll_detach_client(struct i2c_client *client)
/* No commands defined yet */
int icspll_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int icspll_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void icspll_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void icspll_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
#if 0
/* No writes yet (PAE) */
int icspll_write_value(struct i2c_client *client, u8 reg, u16 value)
static int icspll_write_value(struct i2c_client *client, u8 reg, u16 value)
{
return i2c_smbus_write_block_data(client->adapter, client->addr,
reg, value);
}
#endif
void icspll_update_client(struct i2c_client *client)
static void icspll_update_client(struct i2c_client *client)
{
struct icspll_data *data = client->data;
int i, len;
@@ -320,54 +276,22 @@ void icspll_contents(struct i2c_client *client, int operation,
}
}
int __init sensors_icspll_init(void)
static int __init sm_icspll_init(void)
{
int res;
printk("icspll.o version %s (%s)\n", LM_VERSION, LM_DATE);
icspll_initialized = 0;
if ((res = i2c_add_driver(&icspll_driver))) {
printk
("icspll.o: Driver registration failed, module not inserted.\n");
icspll_cleanup();
return res;
}
icspll_initialized++;
return 0;
return i2c_add_driver(&icspll_driver);
}
int __init icspll_cleanup(void)
static void __exit sm_icspll_exit(void)
{
int res;
if (icspll_initialized >= 1) {
if ((res = i2c_del_driver(&icspll_driver))) {
printk
("icspll.o: Driver deregistration failed, module not removed.\n");
return res;
}
} else
icspll_initialized--;
return 0;
i2c_del_driver(&icspll_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, and Mark Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("ICSPLL driver");
int init_module(void)
{
return sensors_icspll_init();
}
int cleanup_module(void)
{
return icspll_cleanup();
}
#endif /* MODULE */
module_init(sm_icspll_init);
module_exit(sm_icspll_exit);
+21 -99
View File
@@ -45,18 +45,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -126,7 +115,7 @@ static int temp_type = 0x2a;
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -204,11 +193,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define IT87_INIT_TEMP_HIGH_3 600
#define IT87_INIT_TEMP_LOW_3 200
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered IT87, we need to keep some data in memory. That
data is pointed to by it87_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new it87 client is
@@ -236,22 +220,12 @@ struct it87_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_it87_init(void);
static int __init it87_cleanup(void);
static int it87_attach_adapter(struct i2c_adapter *adapter);
static int it87_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int it87_detach_client(struct i2c_client *client);
static int it87_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void it87_inc_use(struct i2c_client *client);
static void it87_dec_use(struct i2c_client *client);
static int it87_read_value(struct i2c_client *client, u8 register);
static int it87_write_value(struct i2c_client *client, u8 register,
@@ -274,19 +248,15 @@ static void it87_fan_div(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static struct i2c_driver it87_driver = {
/* name */ "IT87xx sensor driver",
/* id */ I2C_DRIVERID_IT87,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &it87_attach_adapter,
/* detach_client */ &it87_detach_client,
/* command */ &it87_command,
/* inc_use */ &it87_inc_use,
/* dec_use */ &it87_dec_use
.owner = THIS_MODULE,
.name = "IT87xx sensor driver",
.id = I2C_DRIVERID_IT87,
.flags = I2C_DF_NOTIFY,
.attach_adapter = it87_attach_adapter,
.detach_client = it87_detach_client,
.command = it87_command,
};
/* Used by it87_init/cleanup */
static int __initdata it87_initialized = 0;
static int it87_id = 0;
/* The /proc/sys entries */
@@ -340,7 +310,7 @@ static ctl_table it87_dir_table_template[] = {
* it87_driver is inserted (when this module is loaded), for each
available adapter
* when a new adapter is inserted (and it87_driver is still present) */
int it87_attach_adapter(struct i2c_adapter *adapter)
static int it87_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, it87_detect);
}
@@ -498,7 +468,7 @@ int it87_detect(struct i2c_adapter *adapter, int address,
return err;
}
int it87_detach_client(struct i2c_client *client)
static int it87_detach_client(struct i2c_client *client)
{
int err;
@@ -519,27 +489,11 @@ int it87_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int it87_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int it87_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void it87_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void it87_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* The SMBus locks itself, but ISA access must be locked explicitely!
We don't want to lock the whole ISA bus, so we lock each client
@@ -548,7 +502,7 @@ void it87_dec_use(struct i2c_client *client)
would slow down the IT87 access and should not be necessary.
There are some ugly typecasts here, but the good new is - they should
nowhere else be necessary! */
int it87_read_value(struct i2c_client *client, u8 reg)
static int it87_read_value(struct i2c_client *client, u8 reg)
{
int res;
if (i2c_is_isa_client(client)) {
@@ -568,7 +522,7 @@ int it87_read_value(struct i2c_client *client, u8 reg)
would slow down the IT87 access and should not be necessary.
There are some ugly typecasts here, but the good new is - they should
nowhere else be necessary! */
int it87_write_value(struct i2c_client *client, u8 reg, u8 value)
static int it87_write_value(struct i2c_client *client, u8 reg, u8 value)
{
if (i2c_is_isa_client(client)) {
down(&(((struct it87_data *) (client->data))->lock));
@@ -581,7 +535,7 @@ int it87_write_value(struct i2c_client *client, u8 reg, u8 value)
}
/* Called when we have found a new IT87. It should set limits, etc. */
void it87_init_client(struct i2c_client *client)
static void it87_init_client(struct i2c_client *client)
{
/* Reset all except Watchdog values and last conversion values
This sets fan-divs to 2, among others */
@@ -657,7 +611,7 @@ void it87_init_client(struct i2c_client *client)
| (update_vbat ? 0x41 : 0x01));
}
void it87_update_client(struct i2c_client *client)
static void it87_update_client(struct i2c_client *client)
{
struct it87_data *data = client->data;
int i;
@@ -884,41 +838,18 @@ void it87_fan_div(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_it87_init(void)
static int __init sm_it87_init(void)
{
int res;
printk("it87.o version %s (%s)\n", LM_VERSION, LM_DATE);
it87_initialized = 0;
if ((res = i2c_add_driver(&it87_driver))) {
printk
("it87.o: Driver registration failed, module not inserted.\n");
it87_cleanup();
return res;
}
it87_initialized++;
return 0;
return i2c_add_driver(&it87_driver);
}
int __init it87_cleanup(void)
static void __exit sm_it87_exit(void)
{
int res;
if (it87_initialized >= 1) {
if ((res = i2c_del_driver(&it87_driver))) {
printk
("it87.o: Driver deregistration failed, module not removed.\n");
return res;
}
it87_initialized--;
}
return 0;
i2c_del_driver(&it87_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Chris Gauthron <chrisg@0-in.com>");
MODULE_DESCRIPTION("IT8705F, IT8712F, Sis950 driver");
@@ -927,14 +858,5 @@ MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value");
MODULE_PARM(temp_type, "i");
MODULE_PARM_DESC(temp_type, "Temperature sensor type, normally leave unset");
int init_module(void)
{
return sensors_it87_init();
}
int cleanup_module(void)
{
return it87_cleanup();
}
#endif /* MODULE */
module_init(sm_it87_init);
module_exit(sm_it87_exit);
+14 -31
View File
@@ -74,8 +74,7 @@ static void lm75_init_client(struct i2c_client *client);
static int lm75_detach_client(struct i2c_client *client);
static int lm75_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void lm75_inc_use(struct i2c_client *client);
static void lm75_dec_use(struct i2c_client *client);
static u16 swap_bytes(u16 val);
static int lm75_read_value(struct i2c_client *client, u8 reg);
static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
@@ -86,14 +85,13 @@ static void lm75_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver lm75_driver = {
.owner = THIS_MODULE,
.name = "LM75 sensor chip driver",
.id = I2C_DRIVERID_LM75,
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm75_attach_adapter,
.detach_client = lm75_detach_client,
.command = lm75_command,
.inc_use = lm75_inc_use,
.dec_use = lm75_dec_use
};
/* These files are created for each detected LM75. This is just a template;
@@ -109,7 +107,7 @@ static ctl_table lm75_dir_table_template[] = {
static int lm75_id = 0;
int lm75_attach_adapter(struct i2c_adapter *adapter)
static int lm75_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, lm75_detect);
}
@@ -221,7 +219,7 @@ int lm75_detect(struct i2c_adapter *adapter, int address,
return err;
}
int lm75_detach_client(struct i2c_client *client)
static int lm75_detach_client(struct i2c_client *client)
{
struct lm75_data *data = client->data;
@@ -231,28 +229,13 @@ int lm75_detach_client(struct i2c_client *client)
return 0;
}
int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void lm75_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void lm75_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u16 swap_bytes(u16 val)
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
@@ -260,7 +243,7 @@ u16 swap_bytes(u16 val)
/* All registers are word-sized, except for the configuration register.
LM75 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int lm75_read_value(struct i2c_client *client, u8 reg)
static int lm75_read_value(struct i2c_client *client, u8 reg)
{
if (reg == LM75_REG_CONF)
return i2c_smbus_read_byte_data(client, reg);
@@ -271,7 +254,7 @@ int lm75_read_value(struct i2c_client *client, u8 reg)
/* All registers are word-sized, except for the configuration register.
LM75 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
{
if (reg == LM75_REG_CONF)
return i2c_smbus_write_byte_data(client, reg, value);
@@ -280,7 +263,7 @@ int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
swap_bytes(value));
}
void lm75_init_client(struct i2c_client *client)
static void lm75_init_client(struct i2c_client *client)
{
/* Initialize the LM75 chip */
lm75_write_value(client, LM75_REG_TEMP_OS,
@@ -290,7 +273,7 @@ void lm75_init_client(struct i2c_client *client)
lm75_write_value(client, LM75_REG_CONF, 0);
}
void lm75_update_client(struct i2c_client *client)
static void lm75_update_client(struct i2c_client *client)
{
struct lm75_data *data = client->data;
@@ -338,13 +321,13 @@ void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_lm75_init(void)
static int __init sm_lm75_init(void)
{
printk(KERN_INFO "lm75.o version %s (%s)\n", LM_VERSION, LM_DATE);
return i2c_add_driver(&lm75_driver);
}
static void __exit sensors_lm75_exit(void)
static void __exit sm_lm75_exit(void)
{
i2c_del_driver(&lm75_driver);
}
@@ -353,5 +336,5 @@ MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
MODULE_DESCRIPTION("LM75 driver");
MODULE_LICENSE("GPL");
module_init(sensors_lm75_init);
module_exit(sensors_lm75_exit);
module_init(sm_lm75_init);
module_exit(sm_lm75_exit);
+21 -98
View File
@@ -32,18 +32,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -92,7 +81,7 @@ SENSORS_INSMOD_3(lm78, lm78j, lm79);
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -162,11 +151,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define LM78_INIT_TEMP_OVER 600
#define LM78_INIT_TEMP_HYST 500
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* There are some complications in a module like this. First off, LM78 chips
may be both present on the SMBus and the ISA bus, and we have to handle
those cases separately at some places. Second, there might be several
@@ -209,22 +193,12 @@ struct lm78_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_lm78_init(void);
static int __init lm78_cleanup(void);
static int lm78_attach_adapter(struct i2c_adapter *adapter);
static int lm78_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int lm78_detach_client(struct i2c_client *client);
static int lm78_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void lm78_inc_use(struct i2c_client *client);
static void lm78_dec_use(struct i2c_client *client);
static int lm78_read_value(struct i2c_client *client, u8 register);
static int lm78_write_value(struct i2c_client *client, u8 register,
@@ -247,19 +221,15 @@ static void lm78_fan_div(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static struct i2c_driver lm78_driver = {
/* name */ "LM78(-J) and LM79 sensor driver",
/* id */ I2C_DRIVERID_LM78,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &lm78_attach_adapter,
/* detach_client */ &lm78_detach_client,
/* command */ &lm78_command,
/* inc_use */ &lm78_inc_use,
/* dec_use */ &lm78_dec_use
.owner = THIS_MODULE,
.name = "LM78(-J) and LM79 sensor driver",
.id = I2C_DRIVERID_LM78,
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm78_attach_adapter,
.detach_client = lm78_detach_client,
.command = lm78_command,
};
/* Used by lm78_init/cleanup */
static int __initdata lm78_initialized = 0;
static int lm78_id = 0;
/* The /proc/sys entries */
@@ -305,7 +275,7 @@ static ctl_table lm78_dir_table_template[] = {
* lm78_driver is inserted (when this module is loaded), for each
available adapter
* when a new adapter is inserted (and lm78_driver is still present) */
int lm78_attach_adapter(struct i2c_adapter *adapter)
static int lm78_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, lm78_detect);
}
@@ -469,7 +439,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address,
return err;
}
int lm78_detach_client(struct i2c_client *client)
static int lm78_detach_client(struct i2c_client *client)
{
int err;
@@ -490,26 +460,11 @@ int lm78_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int lm78_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int lm78_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void lm78_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void lm78_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* The SMBus locks itself, but ISA access must be locked explicitely!
@@ -519,7 +474,7 @@ void lm78_dec_use(struct i2c_client *client)
would slow down the LM78 access and should not be necessary.
There are some ugly typecasts here, but the good new is - they should
nowhere else be necessary! */
int lm78_read_value(struct i2c_client *client, u8 reg)
static int lm78_read_value(struct i2c_client *client, u8 reg)
{
int res;
if (i2c_is_isa_client(client)) {
@@ -539,7 +494,7 @@ int lm78_read_value(struct i2c_client *client, u8 reg)
would slow down the LM78 access and should not be necessary.
There are some ugly typecasts here, but the good new is - they should
nowhere else be necessary! */
int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
{
if (i2c_is_isa_client(client)) {
down(&(((struct lm78_data *) (client->data))->lock));
@@ -552,7 +507,7 @@ int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
}
/* Called when we have found a new LM78. It should set limits, etc. */
void lm78_init_client(struct i2c_client *client)
static void lm78_init_client(struct i2c_client *client)
{
int vid;
@@ -614,7 +569,7 @@ void lm78_init_client(struct i2c_client *client)
}
void lm78_update_client(struct i2c_client *client)
static void lm78_update_client(struct i2c_client *client)
{
struct lm78_data *data = client->data;
int i;
@@ -820,53 +775,21 @@ void lm78_fan_div(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_lm78_init(void)
static int __init sm_lm78_init(void)
{
int res;
printk("lm78.o version %s (%s)\n", LM_VERSION, LM_DATE);
lm78_initialized = 0;
if ((res = i2c_add_driver(&lm78_driver))) {
printk
("lm78.o: Driver registration failed, module not inserted.\n");
lm78_cleanup();
return res;
}
lm78_initialized++;
return 0;
return i2c_add_driver(&lm78_driver);
}
int __init lm78_cleanup(void)
static void __exit sm_lm78_exit(void)
{
int res;
if (lm78_initialized >= 1) {
if ((res = i2c_del_driver(&lm78_driver))) {
printk
("lm78.o: Driver deregistration failed, module not removed.\n");
return res;
}
lm78_initialized--;
}
return 0;
i2c_del_driver(&lm78_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
MODULE_DESCRIPTION("LM78, LM78-J and LM79 driver");
int init_module(void)
{
return sensors_lm78_init();
}
int cleanup_module(void)
{
return lm78_cleanup();
}
#endif /* MODULE */
module_init(sm_lm78_init);
module_exit(sm_lm78_exit);
+23 -97
View File
@@ -33,18 +33,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -90,7 +79,7 @@ SENSORS_INSMOD_1(lm80);
#define IN_TO_REG(val,nr) (SENSORS_LIMIT((val),0,255))
#define IN_FROM_REG(val,nr) (val)
extern inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div)
static inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div)
{
if (rpm == 0)
return 255;
@@ -102,7 +91,7 @@ extern inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div)
#define FAN_FROM_REG(val,div) ((val)==0?-1:\
(val)==255?0:1350000/((div)*(val)))
extern inline long TEMP_FROM_REG(u16 temp)
static inline long TEMP_FROM_REG(u16 temp)
{
long res;
@@ -174,10 +163,6 @@ extern inline long TEMP_FROM_REG(u16 temp)
#define LM80_INIT_TEMP_HOT_MAX 700
#define LM80_INIT_TEMP_HOT_HYST 600
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered LM80, we need to keep some data in memory. That
data is pointed to by lm80_list[NR]->data. The structure itself is
@@ -205,13 +190,6 @@ struct lm80_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_lm80_init(void);
static int __init lm80_cleanup(void);
static int lm80_attach_adapter(struct i2c_adapter *adapter);
static int lm80_detect(struct i2c_adapter *adapter, int address,
@@ -219,8 +197,6 @@ static int lm80_detect(struct i2c_adapter *adapter, int address,
static int lm80_detach_client(struct i2c_client *client);
static int lm80_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void lm80_inc_use(struct i2c_client *client);
static void lm80_dec_use(struct i2c_client *client);
static int lm80_read_value(struct i2c_client *client, u8 register);
static int lm80_write_value(struct i2c_client *client, u8 register,
@@ -243,19 +219,15 @@ static void lm80_fan_div(struct i2c_client *client, int operation,
static int lm80_id = 0;
static struct i2c_driver lm80_driver = {
/* name */ "LM80 sensor driver",
/* id */ I2C_DRIVERID_LM80,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &lm80_attach_adapter,
/* detach_client */ &lm80_detach_client,
/* command */ &lm80_command,
/* inc_use */ &lm80_inc_use,
/* dec_use */ &lm80_dec_use
.owner = THIS_MODULE,
.name = "LM80 sensor driver",
.id = I2C_DRIVERID_LM80,
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm80_attach_adapter,
.detach_client = lm80_detach_client,
.command = lm80_command,
};
/* Used by lm80_init/cleanup */
static int __initdata lm80_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected LM80. This is just a template;
though at first sight, you might think we could use a statically
@@ -290,7 +262,7 @@ static ctl_table lm80_dir_table_template[] = {
{0}
};
int lm80_attach_adapter(struct i2c_adapter *adapter)
static int lm80_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, lm80_detect);
}
@@ -395,7 +367,7 @@ int lm80_detect(struct i2c_adapter *adapter, int address,
return err;
}
int lm80_detach_client(struct i2c_client *client)
static int lm80_detach_client(struct i2c_client *client)
{
int err;
@@ -414,38 +386,24 @@ int lm80_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int lm80_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int lm80_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void lm80_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void lm80_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int lm80_read_value(struct i2c_client *client, u8 reg)
static int lm80_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}
int lm80_write_value(struct i2c_client *client, u8 reg, u8 value)
static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* Called when we have found a new LM80. It should set limits, etc. */
void lm80_init_client(struct i2c_client *client)
static void lm80_init_client(struct i2c_client *client)
{
/* Reset all except Watchdog values and last conversion values
This sets fan-divs to 2, among others. This makes most other
@@ -499,7 +457,7 @@ void lm80_init_client(struct i2c_client *client)
lm80_write_value(client, LM80_REG_CONFIG, 0x01);
}
void lm80_update_client(struct i2c_client *client)
static void lm80_update_client(struct i2c_client *client)
{
struct lm80_data *data = client->data;
int i;
@@ -707,54 +665,22 @@ void lm80_fan_div(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_lm80_init(void)
static int __init sm_lm80_init(void)
{
int res;
printk("lm80.o version %s (%s)\n", LM_VERSION, LM_DATE);
lm80_initialized = 0;
if ((res = i2c_add_driver(&lm80_driver))) {
printk
("lm80.o: Driver registration failed, module not inserted.\n");
lm80_cleanup();
return res;
}
lm80_initialized++;
return 0;
printk("lm80.o version %s (%s)\n", LM_VERSION, LM_DATE);
return i2c_add_driver(&lm80_driver);
}
int __init lm80_cleanup(void)
static void __exit sm_lm80_exit(void)
{
int res;
if (lm80_initialized >= 1) {
if ((res = i2c_del_driver(&lm80_driver))) {
printk
("lm80.o: Driver deregistration failed, module not removed.\n");
return res;
}
lm80_initialized--;
}
return 0;
i2c_del_driver(&lm80_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("LM80 driver");
int init_module(void)
{
return sensors_lm80_init();
}
int cleanup_module(void)
{
return lm80_cleanup();
}
#endif /* MODULE */
module_init(sm_lm80_init);
module_exit(sm_lm80_exit);
+22 -95
View File
@@ -71,14 +71,6 @@ Set to '1' the appropriate defines, as nessesary:
them insmod params, but it would be too much work. ;') */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -171,7 +163,7 @@ SENSORS_INSMOD_1(lm87);
#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255))
#define IN_FROM_REG(val,nr) (val)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -212,11 +204,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define LM87_INIT_INT_TEMP_MAX 600
#define LM87_INIT_INT_TEMP_MIN 100
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For each registered LM87, we need to keep some data in memory. That
data is pointed to by LM87_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new LM87 client is
@@ -259,22 +246,12 @@ struct lm87_data {
u8 vrm; /* VRM version * 10 */
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_lm87_init(void);
static int __init lm87_cleanup(void);
static int lm87_attach_adapter(struct i2c_adapter *adapter);
static int lm87_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int lm87_detach_client(struct i2c_client *client);
static int lm87_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void lm87_inc_use(struct i2c_client *client);
static void lm87_dec_use(struct i2c_client *client);
static int lm87_read_value(struct i2c_client *client, u8 register);
static int lm87_write_value(struct i2c_client *client, u8 register,
@@ -311,19 +288,15 @@ static void lm87_vrm(struct i2c_client *client, int operation,
static int lm87_id = 0;
static struct i2c_driver LM87_driver = {
/* name */ "LM87 sensor driver",
/* id */ I2C_DRIVERID_LM87,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &lm87_attach_adapter,
/* detach_client */ &lm87_detach_client,
/* command */ &lm87_command,
/* inc_use */ &lm87_inc_use,
/* dec_use */ &lm87_dec_use
.owner = THIS_MODULE,
.name = "LM87 sensor driver",
.id = I2C_DRIVERID_LM87,
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm87_attach_adapter,
.detach_client = lm87_detach_client,
.command = lm87_command,
};
/* Used by LM87_init/cleanup */
static int __initdata lm87_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected LM87. This is just a template;
though at first sight, you might think we could use a statically
@@ -388,7 +361,7 @@ static ctl_table LM87_dir_table_template[] = {
{0}
};
int lm87_attach_adapter(struct i2c_adapter *adapter)
static int lm87_attach_adapter(struct i2c_adapter *adapter)
{
int error;
struct i2c_client_address_data lm87_client_data;
@@ -487,7 +460,7 @@ static int lm87_detect(struct i2c_adapter *adapter, int address,
return err;
}
int lm87_detach_client(struct i2c_client *client)
static int lm87_detach_client(struct i2c_client *client)
{
int err;
@@ -507,37 +480,24 @@ int lm87_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void lm87_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void lm87_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int lm87_read_value(struct i2c_client *client, u8 reg)
static int lm87_read_value(struct i2c_client *client, u8 reg)
{
return 0xFF & i2c_smbus_read_byte_data(client, reg);
}
int lm87_write_value(struct i2c_client *client, u8 reg, u8 value)
static int lm87_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* Called when we have found a new LM87. It should set limits, etc. */
void lm87_init_client(struct i2c_client *client)
static void lm87_init_client(struct i2c_client *client)
{
struct lm87_data *data = client->data;
int vid;
@@ -640,7 +600,7 @@ void lm87_init_client(struct i2c_client *client)
lm87_write_value(client, LM87_REG_CONFIG, 0x01);
}
void lm87_update_client(struct i2c_client *client)
static void lm87_update_client(struct i2c_client *client)
{
struct lm87_data *data = client->data;
int i;
@@ -1041,44 +1001,20 @@ void lm87_vrm(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_lm87_init(void)
static int __init sm_lm87_init(void)
{
int res;
printk("lm87.o version %s (%s)\n", LM_VERSION, LM_DATE);
lm87_initialized = 0;
if ((res = i2c_add_driver(&LM87_driver))) {
printk
("lm87.o: Driver registration failed, module not inserted.\n");
lm87_cleanup();
return res;
}
lm87_initialized++;
return 0;
return i2c_add_driver(&LM87_driver);
}
int __init lm87_cleanup(void)
static void __exit sm_lm87_exit(void)
{
int res;
if (lm87_initialized >= 1) {
if ((res = i2c_del_driver(&LM87_driver))) {
printk
("lm87.o: Driver deregistration failed, module not removed.\n");
return res;
}
lm87_initialized--;
}
return 0;
i2c_del_driver(&LM87_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, "
@@ -1086,14 +1022,5 @@ MODULE_AUTHOR
MODULE_DESCRIPTION("LM87 driver");
int init_module(void)
{
return sensors_lm87_init();
}
int cleanup_module(void)
{
return lm87_cleanup();
}
#endif /* MODULE */
module_init(sm_lm87_init);
module_exit(sm_lm87_exit);
+14 -40
View File
@@ -356,62 +356,36 @@ static int lm92_command (struct i2c_client *client,unsigned int cmd,void *arg)
return (0);
}
static void lm92_inc_use (struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif /* #ifdef MODULE */
}
static void lm92_dec_use (struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif /* #ifdef MODULE */
}
static struct i2c_driver lm92_driver = {
name: "lm92",
id: I2C_DRIVERID_LM92,
flags: I2C_DF_NOTIFY,
attach_adapter: lm92_attach_adapter,
detach_client: lm92_detach_client,
command: lm92_command,
inc_use: lm92_inc_use,
dec_use: lm92_dec_use
.owner = THIS_MODULE,
.name = "lm92",
.id = I2C_DRIVERID_LM92,
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm92_attach_adapter,
.detach_client = lm92_detach_client,
.command = lm92_command,
};
int __init sensors_lm92_init (void)
static int __init sm_lm92_init(void)
{
int result;
if ((result = i2c_add_driver (&lm92_driver)))
return (result);
printk ("lm92.o version %s (%s)\n",LM_VERSION,LM_DATE);
return (0);
return i2c_add_driver(&lm92_driver);
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
#undef __exit
#define __exit
#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
static void __exit sensors_lm92_exit (void)
static void __exit sm_lm92_exit(void)
{
i2c_del_driver (&lm92_driver);
i2c_del_driver(&lm92_driver);
}
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
MODULE_DESCRIPTION ("Linux support for LM92 Temperature Sensor");
#ifdef MODULE_LICENSE
MODULE_LICENSE ("GPL");
#endif /* #ifdef MODULE_LICENSE */
module_init (sensors_lm92_init);
module_exit (sensors_lm92_exit);
module_init(sm_lm92_init);
module_exit(sm_lm92_exit);
+18 -94
View File
@@ -49,18 +49,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -89,26 +78,13 @@ struct ltc1710_data {
u8 status; /* Register values */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_ltc1710_init(void);
static int __init ltc1710_cleanup(void);
static int ltc1710_attach_adapter(struct i2c_adapter *adapter);
static int ltc1710_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int ltc1710_detach_client(struct i2c_client *client);
static int ltc1710_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void ltc1710_inc_use(struct i2c_client *client);
static void ltc1710_dec_use(struct i2c_client *client);
static void ltc1710_switch1(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void ltc1710_switch2(struct i2c_client *client, int operation,
@@ -118,14 +94,13 @@ static void ltc1710_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver ltc1710_driver = {
/* name */ "LTC1710 sensor chip driver",
/* id */ I2C_DRIVERID_LTC1710,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &ltc1710_attach_adapter,
/* detach_client */ &ltc1710_detach_client,
/* command */ &ltc1710_command,
/* inc_use */ &ltc1710_inc_use,
/* dec_use */ &ltc1710_dec_use
.owner = THIS_MODULE,
.name = "LTC1710 sensor chip driver",
.id = I2C_DRIVERID_LTC1710,
.flags = I2C_DF_NOTIFY,
.attach_adapter = ltc1710_attach_adapter,
.detach_client = ltc1710_detach_client,
.command = ltc1710_command,
};
/* These files are created for each detected LTC1710. This is just a template;
@@ -141,15 +116,12 @@ static ctl_table ltc1710_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata ltc1710_initialized = 0;
/* I choose here for semi-static LTC1710 allocation. Complete dynamic
allocation could also be used; the code needed for this would probably
take more memory than the datastructure takes now. */
static int ltc1710_id = 0;
int ltc1710_attach_adapter(struct i2c_adapter *adapter)
static int ltc1710_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, ltc1710_detect);
}
@@ -247,7 +219,7 @@ int ltc1710_detect(struct i2c_adapter *adapter, int address,
}
int ltc1710_detach_client(struct i2c_client *client)
static int ltc1710_detach_client(struct i2c_client *client)
{
int err;
@@ -267,29 +239,13 @@ int ltc1710_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int ltc1710_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int ltc1710_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void ltc1710_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void ltc1710_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
void ltc1710_update_client(struct i2c_client *client)
static void ltc1710_update_client(struct i2c_client *client)
{
struct ltc1710_data *data = client->data;
@@ -349,54 +305,22 @@ void ltc1710_switch2(struct i2c_client *client, int operation,
}
}
int __init sensors_ltc1710_init(void)
static int __init sm_ltc1710_init(void)
{
int res;
printk("ltc1710.o version %s (%s)\n", LM_VERSION, LM_DATE);
ltc1710_initialized = 0;
if ((res = i2c_add_driver(&ltc1710_driver))) {
printk
("ltc1710.o: Driver registration failed, module not inserted.\n");
ltc1710_cleanup();
return res;
}
ltc1710_initialized++;
return 0;
return i2c_add_driver(&ltc1710_driver);
}
int __init ltc1710_cleanup(void)
static void __exit sm_ltc1710_exit(void)
{
int res;
if (ltc1710_initialized >= 1) {
if ((res = i2c_del_driver(&ltc1710_driver))) {
printk
("ltc1710.o: Driver deregistration failed, module not removed.\n");
return res;
}
ltc1710_initialized--;
}
return 0;
i2c_del_driver(&ltc1710_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("LTC1710 driver");
int init_module(void)
{
return sensors_ltc1710_init();
}
int cleanup_module(void)
{
return ltc1710_cleanup();
}
#endif /* MODULE */
module_init(sm_ltc1710_init);
module_exit(sm_ltc1710_exit);
+21 -97
View File
@@ -30,19 +30,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2E, SENSORS_I2C_END };
@@ -66,18 +54,6 @@ struct matorb_data {
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_matorb_init(void);
static int __init matorb_cleanup(void);
static int matorb_attach_adapter(struct i2c_adapter *adapter);
static int matorb_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -85,8 +61,7 @@ static void matorb_init_client(struct i2c_client *client);
static int matorb_detach_client(struct i2c_client *client);
static int matorb_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void matorb_inc_use(struct i2c_client *client);
static void matorb_dec_use(struct i2c_client *client);
static int matorb_write_value(struct i2c_client *client, u8 reg,
u16 value);
static void matorb_disp(struct i2c_client *client, int operation,
@@ -96,14 +71,13 @@ static void matorb_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver matorb_driver = {
/* name */ "Matrix Orbital LCD driver",
/* id */ I2C_DRIVERID_MATORB,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &matorb_attach_adapter,
/* detach_client */ &matorb_detach_client,
/* command */ &matorb_command,
/* inc_use */ &matorb_inc_use,
/* dec_use */ &matorb_dec_use
.owner = THIS_MODULE,
.name = "Matrix Orbital LCD driver",
.id = I2C_DRIVERID_MATORB,
.flags = I2C_DF_NOTIFY,
.attach_adapter = matorb_attach_adapter,
.detach_client = matorb_detach_client,
.command = matorb_command,
};
/* These files are created for each detected MATORB. This is just a template;
@@ -117,12 +91,9 @@ static ctl_table matorb_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata matorb_initialized = 0;
static int matorb_id = 0;
int matorb_attach_adapter(struct i2c_adapter *adapter)
static int matorb_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, matorb_detect);
}
@@ -209,7 +180,7 @@ int matorb_detect(struct i2c_adapter *adapter, int address,
return err;
}
int matorb_detach_client(struct i2c_client *client)
static int matorb_detach_client(struct i2c_client *client)
{
int err;
@@ -229,32 +200,17 @@ int matorb_detach_client(struct i2c_client *client)
/* No commands defined yet */
int matorb_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int matorb_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void matorb_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void matorb_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
#if 0
/* All registers are word-sized, except for the configuration register.
MATORB uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int matorb_read_value(struct i2c_client *client, u8 reg)
static int matorb_read_value(struct i2c_client *client, u8 reg)
{
return -1; /* Doesn't support reads */
}
@@ -263,7 +219,7 @@ int matorb_read_value(struct i2c_client *client, u8 reg)
/* All registers are word-sized, except for the configuration register.
MATORB uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int matorb_write_value(struct i2c_client *client, u8 reg, u16 value)
static int matorb_write_value(struct i2c_client *client, u8 reg, u16 value)
{
if (reg == 0) {
return i2c_smbus_write_byte(client, value);
@@ -272,12 +228,12 @@ int matorb_write_value(struct i2c_client *client, u8 reg, u16 value)
}
}
void matorb_init_client(struct i2c_client *client)
static void matorb_init_client(struct i2c_client *client)
{
/* Initialize the MATORB chip */
}
void matorb_update_client(struct i2c_client *client)
static void matorb_update_client(struct i2c_client *client)
{
struct matorb_data *data = client->data;
@@ -317,54 +273,22 @@ void matorb_disp(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_matorb_init(void)
static int __init sm_matorb_init(void)
{
int res;
printk("matorb.o version %s (%s)\n", LM_VERSION, LM_DATE);
matorb_initialized = 0;
if ((res = i2c_add_driver(&matorb_driver))) {
printk
("matorb.o: Driver registration failed, module not inserted.\n");
matorb_cleanup();
return res;
}
matorb_initialized++;
return 0;
return i2c_add_driver(&matorb_driver);
}
int __init matorb_cleanup(void)
static void __exit sm_matorb_exit(void)
{
int res;
if (matorb_initialized >= 1) {
if ((res = i2c_del_driver(&matorb_driver))) {
printk
("matorb.o: Driver deregistration failed, module not removed.\n");
return res;
}
matorb_initialized--;
}
return 0;
i2c_del_driver(&matorb_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("MATORB driver");
int init_module(void)
{
return sensors_matorb_init();
}
int cleanup_module(void)
{
return matorb_cleanup();
}
#endif /* MODULE */
module_init(sm_matorb_init);
module_exit(sm_matorb_exit);
+22 -102
View File
@@ -65,19 +65,7 @@ static const char *version_str = "2.00 29/2/2000 Fons Rademakers";
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
#undef AUTODETECT /* try to autodetect MaxiLife version */
/*#define AUTODETECT*/
@@ -133,7 +121,7 @@ SENSORS_INSMOD_1(maxilife);
#define FAN_FROM_REG(val) ((val)==0xfe ? 0 : (val)==0xff ? -1 : \
(val)==0x00 ? -1 : (1171860 / (val)))
extern inline u8 FAN_TO_REG(long rpm)
static inline u8 FAN_TO_REG(long rpm)
{
if (rpm == 0)
return 255;
@@ -241,11 +229,6 @@ extern inline u8 FAN_TO_REG(long rpm)
(nr)==5 ? ((val) * 823 - 149140) : 0)
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* The following product codenames apply:
Cristal/Geronimo: HP KAYAK XU/XAs
(Dual Pentium II Slot 1, Deschutes/Klamath)
@@ -288,22 +271,12 @@ struct maxi_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_maxi_init(void);
static int __init maxi_cleanup(void);
static int maxi_attach_adapter(struct i2c_adapter *adapter);
static int maxi_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int maxi_detach_client(struct i2c_client *client);
static int maxi_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void maxi_inc_use(struct i2c_client *client);
static void maxi_dec_use(struct i2c_client *client);
static int maxi_read_value(struct i2c_client *client, u8 register);
static int maxi_read_token(struct i2c_client *client, u16 token);
@@ -341,19 +314,15 @@ static void maxi_alarms(struct i2c_client *client, int operation,
/* The driver. I choose to use type i2c_driver, as at is identical to
the smbus_driver. */
static struct i2c_driver maxi_driver = {
/* name */ "HP MaxiLife driver",
/* id */ I2C_DRIVERID_MAXILIFE,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &maxi_attach_adapter,
/* detach_client */ &maxi_detach_client,
/* command */ &maxi_command,
/* inc_use */ &maxi_inc_use,
/* dec_use */ &maxi_dec_use
.owner = THIS_MODULE,
.name = "HP MaxiLife driver",
.id = I2C_DRIVERID_MAXILIFE,
.flags = I2C_DF_NOTIFY,
.attach_adapter = maxi_attach_adapter,
.detach_client = maxi_detach_client,
.command = maxi_command,
};
/* Used by maxi_init/cleanup */
static int __initdata maxi_initialized = 0;
static int maxi_id = 0;
/* Default firmware version. Use module option "maxi_version"
@@ -416,7 +385,7 @@ static ctl_table maxi_dir_table_template[] = {
- maxi_driver is inserted (when this module is loaded), for each
available adapter
- when a new adapter is inserted (and maxi_driver is still present) */
int maxi_attach_adapter(struct i2c_adapter *adapter)
static int maxi_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, maxi_detect);
}
@@ -637,7 +606,7 @@ int maxi_detect(struct i2c_adapter *adapter, int address,
- maxi_driver is removed (when this module is unloaded)
- when an adapter is removed which has a maxi client (and maxi_driver
is still present). */
int maxi_detach_client(struct i2c_client *client)
static int maxi_detach_client(struct i2c_client *client)
{
int err;
@@ -654,36 +623,19 @@ int maxi_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int maxi_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int maxi_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void maxi_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void maxi_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* Read byte from specified register (-1 in case of error, value otherwise). */
int maxi_read_value(struct i2c_client *client, u8 reg)
static int maxi_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}
/* Read the byte value for a MaxiLife token (-1 in case of error, value otherwise */
int maxi_read_token(struct i2c_client *client, u16 token)
static int maxi_read_token(struct i2c_client *client, u16 token)
{
u8 lowToken, highToken;
int error, value;
@@ -749,7 +701,7 @@ int maxi_read_token(struct i2c_client *client, u16 token)
#ifndef NOWRITE
/* Write byte to specified register (-1 in case of error, 0 otherwise). */
int maxi_write_value(struct i2c_client *client, u8 reg, u8 value)
static int maxi_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
@@ -822,7 +774,7 @@ int maxi_write_token_loop(struct i2c_client *client, u16 token, u8 len,
}
/* Called when we have found a new MaxiLife. It should set limits, etc. */
void maxi_init_client(struct i2c_client *client)
static void maxi_init_client(struct i2c_client *client)
{
struct maxi_data *data = client->data;
@@ -834,7 +786,7 @@ void maxi_init_client(struct i2c_client *client)
}
}
void maxi_update_client(struct i2c_client *client)
static void maxi_update_client(struct i2c_client *client)
{
struct maxi_data *data = client->data;
int i;
@@ -1386,56 +1338,24 @@ void maxi_alarms(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_maxi_init(void)
static int __init sm_maxilife_init(void)
{
int res;
printk("maxilife: Version %s (lm_sensors %s (%s))\n", version_str,
LM_VERSION, LM_DATE);
maxi_initialized = 0;
if ((res = i2c_add_driver(&maxi_driver))) {
printk
("maxilife: Driver registration failed, module not inserted.\n");
maxi_cleanup();
return res;
}
maxi_initialized++;
return 0;
return i2c_add_driver(&maxi_driver);
}
int __init maxi_cleanup(void)
static void __exit sm_maxilife_exit(void)
{
int res;
if (maxi_initialized >= 1) {
if ((res = i2c_del_driver(&maxi_driver))) {
printk
("maxilife: Driver deregistration failed, module not removed.\n");
return res;
}
maxi_initialized--;
}
return 0;
i2c_del_driver(&maxi_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Fons Rademakers <Fons.Rademakers@cern.ch>");
MODULE_DESCRIPTION("HP MaxiLife driver");
MODULE_PARM(maxi_version, "i");
MODULE_PARM_DESC(maxi_version, "MaxiLife firmware version");
int init_module(void)
{
return sensors_maxi_init();
}
int cleanup_module(void)
{
return maxi_cleanup();
}
#endif /* MODULE */
module_init(sm_maxilife_init);
module_exit(sm_maxilife_exit);
+22 -97
View File
@@ -32,18 +32,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = {SENSORS_I2C_END};
@@ -131,7 +120,7 @@ SENSORS_INSMOD_1(mtp008);
* and the rpm is therefore:
* rpm = 1350000 / (count * div)
*/
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -250,11 +239,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define MTP008_INIT_TEMP2_OVER 700 /* 70 Celsius */
#define MTP008_INIT_TEMP2_HYST 500 /* 50 Celsius */
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/*
* For each registered MTP008, we need to keep some data in memory. The
* structure itself is dynamically allocated, at the same time when a new
@@ -287,21 +271,12 @@ struct mtp008_data {
u8 pwmenable; /* Register 0x57 value */
};
#ifdef MODULE
static int __init sensors_mtp008_init(void);
#else
extern int __init sensors_mtp008_init(void);
#endif
static int __init mtp008_cleanup(void);
static int mtp008_attach_adapter(struct i2c_adapter *adapter);
static int mtp008_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int mtp008_detach_client(struct i2c_client *client);
static int mtp008_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void mtp008_inc_use(struct i2c_client *client);
static void mtp008_dec_use(struct i2c_client *client);
static int mtp008_read_value(struct i2c_client *client, u8 register);
static int mtp008_write_value(struct i2c_client *client, u8 register, u8 value);
@@ -334,19 +309,15 @@ static int mtp008_id = 0;
static struct i2c_driver mtp008_driver =
{
/* name */ "MTP008 sensor driver",
/* id */ I2C_DRIVERID_MTP008,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &mtp008_attach_adapter,
/* detach_client */ &mtp008_detach_client,
/* command */ &mtp008_command,
/* inc_use */ &mtp008_inc_use,
/* dec_use */ &mtp008_dec_use
.owner = THIS_MODULE,
.name = "MTP008 sensor driver",
.id = I2C_DRIVERID_MTP008,
.flags = I2C_DF_NOTIFY,
.attach_adapter = mtp008_attach_adapter,
.detach_client = mtp008_detach_client,
.command = mtp008_command,
};
/* Used by mtp008_init/cleanup */
static int __initdata mtp008_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected chip. This is just a template;
though at first sight, you might think we could use a statically
@@ -409,7 +380,7 @@ static ctl_table mtp008_dir_table_template[] =
* mtp008_driver is inserted (when this module is loaded), for each available
* adapter when a new adapter is inserted (and mtp008_driver is still present)
*/
int mtp008_attach_adapter(struct i2c_adapter *adapter)
static int mtp008_attach_adapter(struct i2c_adapter *adapter)
{
struct i2c_client_address_data mtp008_addr_data;
@@ -513,7 +484,7 @@ int mtp008_detect(struct i2c_adapter *adapter, int address,
return err;
}
int mtp008_detach_client(struct i2c_client *client)
static int mtp008_detach_client(struct i2c_client *client)
{
int err;
@@ -531,37 +502,24 @@ int mtp008_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int mtp008_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int mtp008_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void mtp008_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void mtp008_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int mtp008_read_value(struct i2c_client *client, u8 reg)
static int mtp008_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg) & 0xff;
}
int mtp008_write_value(struct i2c_client *client, u8 reg, u8 value)
static int mtp008_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* Called when we have found a new MTP008. It should set limits, etc. */
void mtp008_init_client(struct i2c_client *client)
static void mtp008_init_client(struct i2c_client *client)
{
int vid;
u8 save1, save2;
@@ -651,7 +609,7 @@ void mtp008_init_client(struct i2c_client *client)
);
}
void mtp008_update_client(struct i2c_client *client)
static void mtp008_update_client(struct i2c_client *client)
{
int i;
u8 inp;
@@ -761,7 +719,7 @@ void mtp008_update_client(struct i2c_client *client)
up(&data->update_lock);
}
void mtp008_getsensortype(struct mtp008_data *data, u8 inp)
static void mtp008_getsensortype(struct mtp008_data *data, u8 inp)
{
inp &= 0x0f;
data->sens[0] = (inp >> 3) + 2; /* 2 or 3 */
@@ -1201,56 +1159,23 @@ void mtp008_sens(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_mtp008_init(void)
static int __init sm_mtp008_init(void)
{
int res;
printk("mtp008.o version %s (%s)\n", LM_VERSION, LM_DATE);
mtp008_initialized = 0;
if ((res = i2c_add_driver(&mtp008_driver))) {
printk("mtp008.o: Driver registration failed, "
"module not inserted.\n");
mtp008_cleanup();
return res;
}
mtp008_initialized++;
return 0;
return i2c_add_driver(&mtp008_driver);
}
int __init mtp008_cleanup(void)
static void __exit sm_mtp008_exit(void)
{
int res;
if (mtp008_initialized >= 1) {
if ((res = i2c_del_driver(&mtp008_driver))) {
printk("mtp008.o: Driver deregistration failed, "
"module not removed.\n");
return res;
}
mtp008_initialized--;
}
return 0;
i2c_del_driver(&mtp008_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"and Kris Van Hees <aedil@alchar.org>");
MODULE_DESCRIPTION("MTP008 driver");
int init_module(void)
{
return sensors_mtp008_init();
}
int cleanup_module(void)
{
return mtp008_cleanup();
}
#endif /* MODULE */
module_init(sm_mtp008_init);
module_exit(sm_mtp008_exit);
+19 -95
View File
@@ -46,18 +46,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -86,26 +75,13 @@ struct pcf8574_data {
u8 read, write; /* Register values */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_pcf8574_init(void);
static int __init pcf8574_cleanup(void);
static int pcf8574_attach_adapter(struct i2c_adapter *adapter);
static int pcf8574_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int pcf8574_detach_client(struct i2c_client *client);
static int pcf8574_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void pcf8574_inc_use(struct i2c_client *client);
static void pcf8574_dec_use(struct i2c_client *client);
static void pcf8574_read(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void pcf8574_write(struct i2c_client *client, int operation,
@@ -115,14 +91,13 @@ static void pcf8574_init_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver pcf8574_driver = {
/* name */ "PCF8574 sensor chip driver",
/* id */ I2C_DRIVERID_PCF8574,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &pcf8574_attach_adapter,
/* detach_client */ &pcf8574_detach_client,
/* command */ &pcf8574_command,
/* inc_use */ &pcf8574_inc_use,
/* dec_use */ &pcf8574_dec_use
.owner = THIS_MODULE,
.name = "PCF8574 sensor chip driver",
.id = I2C_DRIVERID_PCF8574,
.flags = I2C_DF_NOTIFY,
.attach_adapter = pcf8574_attach_adapter,
.detach_client = pcf8574_detach_client,
.command = pcf8574_command,
};
/* These files are created for each detected PCF8574. This is just a template;
@@ -138,15 +113,12 @@ static ctl_table pcf8574_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata pcf8574_initialized = 0;
/* I choose here for semi-static PCF8574 allocation. Complete dynamic
allocation could also be used; the code needed for this would probably
take more memory than the datastructure takes now. */
static int pcf8574_id = 0;
int pcf8574_attach_adapter(struct i2c_adapter *adapter)
static int pcf8574_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, pcf8574_detect);
}
@@ -255,7 +227,7 @@ int pcf8574_detect(struct i2c_adapter *adapter, int address,
}
int pcf8574_detach_client(struct i2c_client *client)
static int pcf8574_detach_client(struct i2c_client *client)
{
int err;
@@ -275,29 +247,13 @@ int pcf8574_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int pcf8574_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int pcf8574_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void pcf8574_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void pcf8574_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* Called when we have found a new PCF8574. */
void pcf8574_init_client(struct i2c_client *client)
static void pcf8574_init_client(struct i2c_client *client)
{
struct pcf8574_data *data = client->data;
data->write = PCF8574_INIT;
@@ -305,7 +261,7 @@ void pcf8574_init_client(struct i2c_client *client)
}
void pcf8574_update_client(struct i2c_client *client)
static void pcf8574_update_client(struct i2c_client *client)
{
struct pcf8574_data *data = client->data;
@@ -357,54 +313,22 @@ void pcf8574_write(struct i2c_client *client, int operation,
}
int __init sensors_pcf8574_init(void)
static int __init sm_pcf8574_init(void)
{
int res;
printk("pcf8574.o version %s (%s)\n", LM_VERSION, LM_DATE);
pcf8574_initialized = 0;
if ((res = i2c_add_driver(&pcf8574_driver))) {
printk
("pcf8574.o: Driver registration failed, module not inserted.\n");
pcf8574_cleanup();
return res;
}
pcf8574_initialized++;
return 0;
return i2c_add_driver(&pcf8574_driver);
}
int __init pcf8574_cleanup(void)
static void __exit sm_pcf8574_exit(void)
{
int res;
if (pcf8574_initialized >= 1) {
if ((res = i2c_del_driver(&pcf8574_driver))) {
printk
("pcf8574.o: Driver deregistration failed, module not removed.\n");
return res;
}
pcf8574_initialized--;
}
return 0;
i2c_del_driver(&pcf8574_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Dan Eaton <dan.eaton@rocketlogix.com> and Aurelien Jarno <aurelien@aurel32.net>");
MODULE_DESCRIPTION("PCF8574 driver");
int init_module(void)
{
return sensors_pcf8574_init();
}
int cleanup_module(void)
{
return pcf8574_cleanup();
}
#endif /* MODULE */
module_init(sm_pcf8574_init);
module_exit(sm_pcf8574_exit);
+18 -99
View File
@@ -26,14 +26,6 @@
#include "version.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -78,12 +70,6 @@ SENSORS_INSMOD_1(pcf8591);
#define REG_TO_SIGNED(reg) (reg & 0x80)?(reg - 256):(reg)
/* Convert signed 8 bit value to signed value */
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif
struct pcf8591_data {
struct semaphore lock;
@@ -99,21 +85,12 @@ struct pcf8591_data {
u8 aout;
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_pcf8591_init(void);
static int __init pcf8591_cleanup(void);
static int pcf8591_attach_adapter(struct i2c_adapter *adapter);
static int pcf8591_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int pcf8591_detach_client(struct i2c_client *client);
static int pcf8591_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void pcf8591_inc_use(struct i2c_client *client);
static void pcf8591_dec_use(struct i2c_client *client);
static void pcf8591_update_client(struct i2c_client *client);
static void pcf8591_init_client(struct i2c_client *client);
@@ -130,22 +107,17 @@ static void pcf8591_aout(struct i2c_client *client, int operation,
/* This is the driver that will be inserted */
static struct i2c_driver pcf8591_driver = {
/* name */ "PCF8591 sensor chip driver",
/* id */ I2C_DRIVERID_PCF8591,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &pcf8591_attach_adapter,
/* detach_client */ &pcf8591_detach_client,
/* command */ &pcf8591_command,
/* inc_use */ &pcf8591_inc_use,
/* dec_use */ &pcf8591_dec_use
.owner = THIS_MODULE,
.name = "PCF8591 sensor chip driver",
.id = I2C_DRIVERID_PCF8591,
.flags = I2C_DF_NOTIFY,
.attach_adapter = pcf8591_attach_adapter,
.detach_client = pcf8591_detach_client,
.command = pcf8591_command,
};
/* Used by lm78_init/cleanup */
static int __initdata pcf8591_initialized = 0;
static int pcf8591_id = 0;
/* The /proc/sys entries */
/* These files are created for each detected PCF8591. This is just a template;
though at first sight, you might think we could use a statically
@@ -175,7 +147,7 @@ static ctl_table pcf8591_dir_table_template[] = {
* pcf8591_driver is inserted (when this module is loaded), for each
available adapter
* when a new adapter is inserted (and pcf8591_driver is still present) */
int pcf8591_attach_adapter(struct i2c_adapter *adapter)
static int pcf8591_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, pcf8591_detect);
}
@@ -275,7 +247,7 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address,
return err;
}
int pcf8591_detach_client(struct i2c_client *client)
static int pcf8591_detach_client(struct i2c_client *client)
{
int err;
@@ -299,29 +271,14 @@ int pcf8591_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int pcf8591_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int pcf8591_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void pcf8591_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void pcf8591_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* Called when we have found a new PCF8591. */
void pcf8591_init_client(struct i2c_client *client)
static void pcf8591_init_client(struct i2c_client *client)
{
struct pcf8591_data *data = client->data;
data->control_byte = PCF8591_INIT_CONTROL_BYTE;
@@ -330,7 +287,7 @@ void pcf8591_init_client(struct i2c_client *client)
i2c_smbus_write_byte_data(client, data->control_byte, data->aout);
}
void pcf8591_update_client(struct i2c_client *client)
static void pcf8591_update_client(struct i2c_client *client)
{
struct pcf8591_data *data = client->data;
@@ -487,60 +444,22 @@ void pcf8591_aout(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_pcf8591_init(void)
static int __init sm_pcf8591_init(void)
{
int res;
printk(KERN_INFO "pcf8591.o version %s (%s)\n", LM_VERSION, LM_DATE);
pcf8591_initialized = 0;
if ((res = i2c_add_driver(&pcf8591_driver))) {
printk
(KERN_ERR "pcf8591.o: Driver registration failed, module not inserted.\n");
pcf8591_cleanup();
return res;
}
pcf8591_initialized++;
return 0;
return i2c_add_driver(&pcf8591_driver);
}
int __init pcf8591_cleanup(void)
static void __exit sm_pcf8591_exit(void)
{
int res;
if (pcf8591_initialized >= 1) {
if ((res = i2c_del_driver(&pcf8591_driver))) {
printk
(KERN_ERR "pcf8591.o: Driver deregistration failed, module not removed.\n");
return res;
}
pcf8591_initialized--;
}
return 0;
i2c_del_driver(&pcf8591_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>");
MODULE_DESCRIPTION("PCF8591 driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_pcf8591_init();
}
int cleanup_module(void)
{
return pcf8591_cleanup();
}
#endif /* MODULE */
module_init(sm_pcf8591_init);
module_exit(sm_pcf8591_exit);
+22 -94
View File
@@ -60,18 +60,7 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* If force_addr is set to anything different from 0, we forcibly enable
the device at the given address. */
@@ -174,7 +163,7 @@ static int blacklist[] = {
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -234,11 +223,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define SIS5595_INIT_TEMP_OVER 600
#define SIS5595_INIT_TEMP_HYST 100
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For the SIS5595, we need to keep some data in memory. That
data is pointed to by sis5595_list[NR]->data. The structure itself is
dynamically allocated, at the time when the new sis5595 client is
@@ -267,22 +251,12 @@ struct sis5595_data {
static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_sis5595_init(void);
static int __init sis5595_cleanup(void);
static int sis5595_attach_adapter(struct i2c_adapter *adapter);
static int sis5595_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int sis5595_detach_client(struct i2c_client *client);
static int sis5595_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void sis5595_inc_use(struct i2c_client *client);
static void sis5595_dec_use(struct i2c_client *client);
static int sis5595_read_value(struct i2c_client *client, u8 register);
static int sis5595_write_value(struct i2c_client *client, u8 register,
@@ -308,19 +282,15 @@ static int sis5595_id = 0;
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static struct i2c_driver sis5595_driver = {
/* name */ "SiS 5595",
/* id */ I2C_DRIVERID_SIS5595,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &sis5595_attach_adapter,
/* detach_client */ &sis5595_detach_client,
/* command */ &sis5595_command,
/* inc_use */ &sis5595_inc_use,
/* dec_use */ &sis5595_dec_use
.owner = THIS_MODULE,
.name = "SiS 5595",
.id = I2C_DRIVERID_SIS5595,
.flags = I2C_DF_NOTIFY,
.attach_adapter = sis5595_attach_adapter,
.detach_client = sis5595_detach_client,
.command = sis5595_command,
};
/* Used by sis5595_init/cleanup */
static int __initdata sis5595_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected SIS5595. This is just a template;
though at first sight, you might think we could use a statically
@@ -352,13 +322,13 @@ static ctl_table sis5595_dir_table_template[] = {
};
/* This is called when the module is loaded */
int sis5595_attach_adapter(struct i2c_adapter *adapter)
static int sis5595_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, sis5595_detect);
}
/* Locate SiS bridge and correct base address for SIS5595 */
int sis5595_find_sis(int *address)
static int sis5595_find_sis(int *address)
{
u16 val;
int *i;
@@ -516,7 +486,7 @@ int sis5595_detect(struct i2c_adapter *adapter, int address,
return err;
}
int sis5595_detach_client(struct i2c_client *client)
static int sis5595_detach_client(struct i2c_client *client)
{
int err;
@@ -536,30 +506,17 @@ int sis5595_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int sis5595_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int sis5595_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void sis5595_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void sis5595_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* ISA access must be locked explicitly.
There are some ugly typecasts here, but the good news is - they should
nowhere else be necessary! */
int sis5595_read_value(struct i2c_client *client, u8 reg)
static int sis5595_read_value(struct i2c_client *client, u8 reg)
{
int res;
@@ -570,7 +527,7 @@ int sis5595_read_value(struct i2c_client *client, u8 reg)
return res;
}
int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
static int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
{
down(&(((struct sis5595_data *) (client->data))->lock));
outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET);
@@ -580,7 +537,7 @@ int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
}
/* Called when we have found a new SIS5595. It should set limits, etc. */
void sis5595_init_client(struct i2c_client *client)
static void sis5595_init_client(struct i2c_client *client)
{
struct sis5595_data *data = client->data;
@@ -627,7 +584,7 @@ void sis5595_init_client(struct i2c_client *client)
}
void sis5595_update_client(struct i2c_client *client)
static void sis5595_update_client(struct i2c_client *client)
{
struct sis5595_data *data = client->data;
int i;
@@ -831,12 +788,11 @@ void sis5595_fan_div(struct i2c_client *client, int operation,
}
}
int __init sensors_sis5595_init(void)
static int __init sm_sis5595_init(void)
{
int res, addr;
printk("sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE);
sis5595_initialized = 0;
if (sis5595_find_sis(&addr)) {
printk("sis5595.o: SIS5595 not detected, module not inserted.\n");
@@ -844,46 +800,18 @@ int __init sensors_sis5595_init(void)
}
normal_isa[0] = addr;
if ((res = i2c_add_driver(&sis5595_driver))) {
printk
("sis5595.o: Driver registration failed, module not inserted.\n");
sis5595_cleanup();
return res;
}
sis5595_initialized++;
return 0;
return i2c_add_driver(&sis5595_driver);
}
int __init sis5595_cleanup(void)
static void __exit sm_sis5595_exit(void)
{
int res;
if (sis5595_initialized >= 1) {
if ((res = i2c_del_driver(&sis5595_driver))) {
printk
("sis5595.o: Driver deregistration failed, module not removed.\n");
return res;
}
sis5595_initialized--;
}
return 0;
i2c_del_driver(&sis5595_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>");
MODULE_DESCRIPTION("SiS 5595 Sensor device");
int init_module(void)
{
return sensors_sis5595_init();
}
int cleanup_module(void)
{
return sis5595_cleanup();
}
#endif /* MODULE */
module_init(sm_sis5595_init);
module_exit(sm_sis5595_exit);
+24 -93
View File
@@ -33,14 +33,6 @@
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x0b, SENSORS_I2C_END };
@@ -99,18 +91,6 @@ struct smartbatt_data {
u16 relchg, abschg; /* Register values */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_smartbatt_init(void);
static int __init smartbatt_cleanup(void);
static int smartbatt_attach_adapter(struct i2c_adapter *adapter);
static int smartbatt_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -118,8 +98,7 @@ static void smartbatt_init_client(struct i2c_client *client);
static int smartbatt_detach_client(struct i2c_client *client);
static int smartbatt_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void smartbatt_inc_use(struct i2c_client *client);
static void smartbatt_dec_use(struct i2c_client *client);
static u16 swap_bytes(u16 val);
static int sb_read(struct i2c_client *client, u8 reg);
#if 0
@@ -142,14 +121,13 @@ static void smartbatt_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver smartbatt_driver = {
/* name */ "Smart Battery chip driver",
/* id */ I2C_DRIVERID_SMARTBATT,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &smartbatt_attach_adapter,
/* detach_client */ &smartbatt_detach_client,
/* command */ &smartbatt_command,
/* inc_use */ &smartbatt_inc_use,
/* dec_use */ &smartbatt_dec_use
.owner = THIS_MODULE,
.name = "Smart Battery chip driver",
.id = I2C_DRIVERID_SMARTBATT,
.flags = I2C_DF_NOTIFY,
.attach_adapter = smartbatt_attach_adapter,
.detach_client = smartbatt_detach_client,
.command = smartbatt_command,
};
/* These files are created for each detected SMARTBATT. This is just a template;
@@ -173,12 +151,9 @@ static ctl_table smartbatt_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata smartbatt_initialized = 0;
static int smartbatt_id = 0;
int smartbatt_attach_adapter(struct i2c_adapter *adapter)
static int smartbatt_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, smartbatt_detect);
}
@@ -269,7 +244,7 @@ int smartbatt_detect(struct i2c_adapter *adapter, int address,
return err;
}
int smartbatt_detach_client(struct i2c_client *client)
static int smartbatt_detach_client(struct i2c_client *client)
{
int err;
@@ -295,39 +270,24 @@ int smartbatt_detach_client(struct i2c_client *client)
/* No commands defined yet */
int smartbatt_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int smartbatt_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
/* Nothing here yet */
void smartbatt_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
/* Nothing here yet */
void smartbatt_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u16 swap_bytes(u16 val)
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
int sb_read(struct i2c_client *client, u8 reg)
static int sb_read(struct i2c_client *client, u8 reg)
{
return swap_bytes(i2c_smbus_read_word_data(client, reg));
}
#if 0
int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value)
static int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value)
{
return i2c_smbus_write_word_data(client, reg, swap_bytes(value));
}
@@ -338,7 +298,7 @@ int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value)
all we could do is print this out at startup if we wanted.
*/
int
battery_info(int fd, struct battery_info *info)
static battery_info(int fd, struct battery_info *info)
{
int n;
int val;
@@ -377,12 +337,12 @@ battery_info(int fd, struct battery_info *info)
}
#endif
void smartbatt_init_client(struct i2c_client *client)
static void smartbatt_init_client(struct i2c_client *client)
{
}
void smartbatt_update_client(struct i2c_client *client)
static void smartbatt_update_client(struct i2c_client *client)
{
struct smartbatt_data *data = client->data;
@@ -492,51 +452,22 @@ void smartbatt_charge(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_smartbatt_init(void)
static int __init sm_smartbatt_init(void)
{
int res;
printk("smartbatt.o version %s (%s)\n", LM_VERSION, LM_DATE);
smartbatt_initialized = 0;
if ((res = i2c_add_driver(&smartbatt_driver))) {
printk
("smartbatt.o: Driver registration failed, module not inserted.\n");
smartbatt_cleanup();
return res;
}
smartbatt_initialized++;
return 0;
return i2c_add_driver(&smartbatt_driver);
}
int __init smartbatt_cleanup(void)
static void __exit sm_smartbatt_exit(void)
{
int res;
if (smartbatt_initialized >= 1) {
if ((res = i2c_del_driver(&smartbatt_driver)))
return res;
smartbatt_initialized--;
}
return 0;
i2c_del_driver(&smartbatt_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("M. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("Smart Battery driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_smartbatt_init();
}
int cleanup_module(void)
{
return smartbatt_cleanup();
}
#endif /* MODULE */
module_init(sm_smartbatt_init);
module_exit(sm_smartbatt_exit);
+19 -86
View File
@@ -36,10 +36,6 @@
#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
#define ARP_ADDRESS 0x61
static unsigned short normal_i2c[] = { ARP_ADDRESS, SENSORS_I2C_END };
@@ -115,18 +111,6 @@ struct arp_data {
struct arp_device dev[ARP_MAX_DEVICES];
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_smbusarp_init(void);
static int __init smbusarp_cleanup(void);
static int smbusarp_attach_adapter(struct i2c_adapter *adapter);
static int smbusarp_detect(struct i2c_adapter *adapter, int address,
@@ -135,21 +119,18 @@ static int smbusarp_detach_client(struct i2c_client *client);
static int smbusarp_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void smbusarp_inc_use(struct i2c_client *client);
static void smbusarp_dec_use(struct i2c_client *client);
static int smbusarp_init_client(struct i2c_client *client);
static void smbusarp_contents(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static struct i2c_driver smbusarp_driver = {
/* name */ "SMBUS ARP",
/* id */ I2C_DRIVERID_ARP,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &smbusarp_attach_adapter,
/* detach_client */ &smbusarp_detach_client,
/* command */ &smbusarp_command,
/* inc_use */ &smbusarp_inc_use,
/* dec_use */ &smbusarp_dec_use
.owner = THIS_MODULE,
.name = "SMBUS ARP",
.id = I2C_DRIVERID_ARP,
.flags = I2C_DF_NOTIFY,
.attach_adapter = smbusarp_attach_adapter,
.detach_client = smbusarp_detach_client,
.command = smbusarp_command,
};
static ctl_table smbusarp_dir_table_template[] = {
@@ -172,12 +153,9 @@ static ctl_table smbusarp_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata smbusarp_initialized = 0;
static int smbusarp_id = 0;
int smbusarp_attach_adapter(struct i2c_adapter *adapter)
static int smbusarp_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, smbusarp_detect);
}
@@ -241,7 +219,7 @@ int smbusarp_detect(struct i2c_adapter *adapter, int address,
return err;
}
int smbusarp_detach_client(struct i2c_client *client)
static int smbusarp_detach_client(struct i2c_client *client)
{
int err;
@@ -260,27 +238,13 @@ int smbusarp_detach_client(struct i2c_client *client)
}
int smbusarp_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int smbusarp_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void smbusarp_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void smbusarp_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u8 choose_addr(u8 * pool)
static u8 choose_addr(u8 * pool)
{
int i;
@@ -291,7 +255,7 @@ u8 choose_addr(u8 * pool)
return 0xff;
}
int smbusarp_init_client(struct i2c_client *client)
static int smbusarp_init_client(struct i2c_client *client)
{
int ret = -1;
#ifdef I2C_PEC_SUPPORTED
@@ -483,7 +447,7 @@ void smbusarp_contents(struct i2c_client *client, int operation,
}
}
int __init sensors_smbusarp_init(void)
static int __init sm_smbusarp_init(void)
{
int res;
@@ -491,50 +455,19 @@ int __init sensors_smbusarp_init(void)
/* magic force invocation */
force_arp[0] = -1;
force_arp[1] = ARP_ADDRESS;
smbusarp_initialized = 0;
if ((res = i2c_add_driver(&smbusarp_driver))) {
printk
(KERN_ERR "smbus-arp.o: Driver registration failed, module not inserted.\n");
smbusarp_cleanup();
return res;
}
smbusarp_initialized++;
return 0;
return i2c_add_driver(&smbusarp_driver);
}
int __init smbusarp_cleanup(void)
static void __exit sm_smbusarp_exit(void)
{
int res;
if (smbusarp_initialized >= 1) {
if ((res = i2c_del_driver(&smbusarp_driver))) {
printk
(KERN_ERR "smbus-arp.o: Driver deregistration failed, module not removed.\n");
return res;
}
} else
smbusarp_initialized--;
return 0;
i2c_del_driver(&smbusarp_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("SMBUS ARP Driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_smbusarp_init();
}
int cleanup_module(void)
{
return smbusarp_cleanup();
}
#endif /* MODULE */
module_init(sm_smbusarp_init);
module_exit(sm_smbusarp_exit);
+22 -92
View File
@@ -33,14 +33,6 @@
#include "sensors.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
static int force_addr = 0;
MODULE_PARM(force_addr, "i");
@@ -109,7 +101,7 @@ superio_exit(void)
#define SMSC47M1_REG_FAN(nr) (0x58 + (nr))
#define SMSC47M1_REG_FAN_MIN(nr) (0x5a + (nr))
extern inline u8 MIN_TO_REG(long rpm, int div)
static inline u8 MIN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 0;
@@ -130,11 +122,6 @@ extern inline u8 MIN_TO_REG(long rpm, int div)
#define SMSC47M1_INIT_FAN_MIN_1 3000
#define SMSC47M1_INIT_FAN_MIN_2 3000
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
struct smsc47m1_data {
struct semaphore lock;
int sysctl_id;
@@ -150,13 +137,6 @@ struct smsc47m1_data {
u8 pwm[2]; /* Register value (bit 7 is enable) */
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_smsc47m1_init(void);
static int __init smsc47m1_cleanup(void);
static int smsc47m1_attach_adapter(struct i2c_adapter *adapter);
static int smsc47m1_detect(struct i2c_adapter *adapter, int address,
@@ -164,8 +144,6 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address,
static int smsc47m1_detach_client(struct i2c_client *client);
static int smsc47m1_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void smsc47m1_inc_use(struct i2c_client *client);
static void smsc47m1_dec_use(struct i2c_client *client);
static int smsc47m1_read_value(struct i2c_client *client, u8 register);
static int smsc47m1_write_value(struct i2c_client *client, u8 register,
@@ -187,18 +165,15 @@ static void smsc47m1_pwm(struct i2c_client *client, int operation,
static int smsc47m1_id = 0;
static struct i2c_driver smsc47m1_driver = {
/* name */ "SMSC47M1xx fan driver",
/* id */ I2C_DRIVERID_SMSC47M1,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &smsc47m1_attach_adapter,
/* detach_client */ &smsc47m1_detach_client,
/* command */ &smsc47m1_command,
/* inc_use */ &smsc47m1_inc_use,
/* dec_use */ &smsc47m1_dec_use
.owner = THIS_MODULE,
.name = "SMSC47M1xx fan driver",
.id = I2C_DRIVERID_SMSC47M1,
.flags = I2C_DF_NOTIFY,
.attach_adapter = smsc47m1_attach_adapter,
.detach_client = smsc47m1_detach_client,
.command = smsc47m1_command,
};
static int __initdata smsc47m1_initialized = 0;
static ctl_table smsc47m1_dir_table_template[] = {
{SMSC47M1_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &smsc47m1_fan},
@@ -215,12 +190,12 @@ static ctl_table smsc47m1_dir_table_template[] = {
{0}
};
int smsc47m1_attach_adapter(struct i2c_adapter *adapter)
static int smsc47m1_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, smsc47m1_detect);
}
int smsc47m1_find(int *address)
static int smsc47m1_find(int *address)
{
u16 val;
@@ -320,7 +295,7 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address,
return err;
}
int smsc47m1_detach_client(struct i2c_client *client)
static int smsc47m1_detach_client(struct i2c_client *client)
{
int err;
@@ -339,26 +314,12 @@ int smsc47m1_detach_client(struct i2c_client *client)
return 0;
}
int smsc47m1_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int smsc47m1_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void smsc47m1_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void smsc47m1_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
int smsc47m1_read_value(struct i2c_client *client, u8 reg)
static int smsc47m1_read_value(struct i2c_client *client, u8 reg)
{
int res;
@@ -366,13 +327,13 @@ int smsc47m1_read_value(struct i2c_client *client, u8 reg)
return res;
}
int smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value)
static int smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value)
{
outb_p(value, client->addr + reg);
return 0;
}
void smsc47m1_init_client(struct i2c_client *client)
static void smsc47m1_init_client(struct i2c_client *client)
{
/* configure pins for tach function */
smsc47m1_write_value(client, SMSC47M1_REG_TPIN1, 0x05);
@@ -383,7 +344,7 @@ void smsc47m1_init_client(struct i2c_client *client)
MIN_TO_REG(SMSC47M1_INIT_FAN_MIN_2, 2));
}
void smsc47m1_update_client(struct i2c_client *client)
static void smsc47m1_update_client(struct i2c_client *client)
{
struct smsc47m1_data *data = client->data;
int i;
@@ -516,12 +477,11 @@ void smsc47m1_pwm(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_smsc47m1_init(void)
static int __init sm_smsc47m1_init(void)
{
int res, addr;
printk("smsc47m1.o version %s (%s)\n", LM_VERSION, LM_DATE);
smsc47m1_initialized = 0;
if (smsc47m1_find(&addr)) {
printk("smsc47m1.o: SMSC47M1xx not detected, module not inserted.\n");
@@ -529,49 +489,19 @@ int __init sensors_smsc47m1_init(void)
}
normal_isa[0] = addr;
if ((res = i2c_add_driver(&smsc47m1_driver))) {
printk
("smsc47m1.o: Driver registration failed, module not inserted.\n");
smsc47m1_cleanup();
return res;
}
smsc47m1_initialized++;
return 0;
return i2c_add_driver(&smsc47m1_driver);
}
int __init smsc47m1_cleanup(void)
static void __exit sm_smsc47m1_exit(void)
{
int res;
if (smsc47m1_initialized >= 1) {
if ((res = i2c_del_driver(&smsc47m1_driver))) {
printk
("smsc47m1.o: Driver deregistration failed, module not removed.\n");
return res;
}
smsc47m1_initialized--;
}
return 0;
i2c_del_driver(&smsc47m1_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("SMSC47M110x Fan sensors");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_smsc47m1_init();
}
int cleanup_module(void)
{
return smsc47m1_cleanup();
}
#endif /* MODULE */
module_init(sm_smsc47m1_init);
module_exit(sm_smsc47m1_exit);
+22 -91
View File
@@ -29,18 +29,7 @@
#include "version.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -100,18 +89,6 @@ struct thmc50_data {
inter, inter_mask, die_code, analog_out; /* Register values */
};
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_thmc50_init(void);
static int __init thmc50_cleanup(void);
static int thmc50_attach_adapter(struct i2c_adapter *adapter);
static int thmc50_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
@@ -119,8 +96,7 @@ static void thmc50_init_client(struct i2c_client *client);
static int thmc50_detach_client(struct i2c_client *client);
static int thmc50_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void thmc50_inc_use(struct i2c_client *client);
static void thmc50_dec_use(struct i2c_client *client);
static int thmc50_read_value(struct i2c_client *client, u8 reg);
static int thmc50_write_value(struct i2c_client *client, u8 reg,
u16 value);
@@ -142,14 +118,13 @@ static void thmc50_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver thmc50_driver = {
/* name */ "THMC50 sensor chip driver",
/* id */ I2C_DRIVERID_THMC50,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &thmc50_attach_adapter,
/* detach_client */ &thmc50_detach_client,
/* command */ &thmc50_command,
/* inc_use */ &thmc50_inc_use,
/* dec_use */ &thmc50_dec_use
.owner = THIS_MODULE,
.name = "THMC50 sensor chip driver",
.id = I2C_DRIVERID_THMC50,
.flags = I2C_DF_NOTIFY,
.attach_adapter = thmc50_attach_adapter,
.detach_client = thmc50_detach_client,
.command = thmc50_command,
};
/* These files are created for each detected THMC50. This is just a template;
@@ -173,12 +148,10 @@ static ctl_table thmc50_dir_table_template[] = {
{0}
};
/* Used by init/cleanup */
static int __initdata thmc50_initialized = 0;
static int thmc50_id = 0;
int thmc50_attach_adapter(struct i2c_adapter *adapter)
static int thmc50_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, thmc50_detect);
}
@@ -292,7 +265,7 @@ int thmc50_detect(struct i2c_adapter *adapter, int address,
return err;
}
int thmc50_detach_client(struct i2c_client *client)
static int thmc50_detach_client(struct i2c_client *client)
{
int err;
@@ -312,29 +285,16 @@ int thmc50_detach_client(struct i2c_client *client)
/* No commands defined yet */
int thmc50_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int thmc50_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void thmc50_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void thmc50_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/* All registers are word-sized, except for the configuration register.
THMC50 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int thmc50_read_value(struct i2c_client *client, u8 reg)
static int thmc50_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}
@@ -342,12 +302,12 @@ int thmc50_read_value(struct i2c_client *client, u8 reg)
/* All registers are word-sized, except for the configuration register.
THMC50 uses a high-byte first convention, which is exactly opposite to
the usual practice. */
int thmc50_write_value(struct i2c_client *client, u8 reg, u16 value)
static int thmc50_write_value(struct i2c_client *client, u8 reg, u16 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
void thmc50_init_client(struct i2c_client *client)
static void thmc50_init_client(struct i2c_client *client)
{
/* Initialize the THMC50 chip */
thmc50_write_value(client, THMC50_REG_TEMP_OS,
@@ -357,7 +317,7 @@ void thmc50_init_client(struct i2c_client *client)
thmc50_write_value(client, THMC50_REG_CONF, 1);
}
void thmc50_update_client(struct i2c_client *client)
static void thmc50_update_client(struct i2c_client *client)
{
struct thmc50_data *data = client->data;
@@ -526,54 +486,25 @@ void thmc50_analog_out(struct i2c_client *client, int operation,
int __init sensors_thmc50_init(void)
static int __init sm_thmc50_init(void)
{
int res;
printk("thmc50.o version %s (%s)\n", LM_VERSION, LM_DATE);
thmc50_initialized = 0;
if ((res = i2c_add_driver(&thmc50_driver))) {
printk
("thmc50.o: Driver registration failed, module not inserted.\n");
thmc50_cleanup();
return res;
}
thmc50_initialized++;
return 0;
return i2c_add_driver(&thmc50_driver);
}
int __init thmc50_cleanup(void)
static void __exit sm_thmc50_exit(void)
{
int res;
if (thmc50_initialized >= 1) {
if ((res = i2c_del_driver(&thmc50_driver))) {
printk
("thmc50.o: Driver deregistration failed, module not removed.\n");
return res;
}
thmc50_initialized--;
}
return 0;
i2c_del_driver(&thmc50_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("THMC50 driver");
int init_module(void)
{
return sensors_thmc50_init();
}
int cleanup_module(void)
{
return thmc50_cleanup();
}
#endif /* MODULE */
module_init(sm_thmc50_init);
module_exit(sm_thmc50_exit);
+24 -90
View File
@@ -46,22 +46,12 @@
#include "sensors.h"
#include <linux/init.h>
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#ifndef PCI_DEVICE_ID_VIA_82C686_4
#define PCI_DEVICE_ID_VIA_82C686_4 0x3057
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* If force_addr is set to anything different from 0, we forcibly enable
the device at the given address. */
@@ -149,7 +139,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e };
//
// These get us close, but they don't completely agree with what my BIOS
// says- they are all a bit low. But, it all we have to go on...
extern inline u8 IN_TO_REG(long val, int inNum)
static inline u8 IN_TO_REG(long val, int inNum)
{
// to avoid floating point, we multiply everything by 100.
// val is guaranteed to be positive, so we can achieve the effect of
@@ -174,7 +164,7 @@ extern inline u8 IN_TO_REG(long val, int inNum)
/ 1000, 0, 255);
}
extern inline long IN_FROM_REG(u8 val, int inNum)
static inline long IN_FROM_REG(u8 val, int inNum)
{
// to avoid floating point, we multiply everything by 100.
// val is guaranteed to be positive, so we can achieve the effect of
@@ -194,7 +184,7 @@ extern inline long IN_FROM_REG(u8 val, int inNum)
// Higher register values = slower fans (the fan's strobe gates a counter).
// But this chip saturates back at 0, not at 255 like all the other chips.
// So, 0 means 0 RPM
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 0;
@@ -302,7 +292,7 @@ static const u8 viaLUT[] =
// No interpolation here. Just check the limits and go.
// The +5 effectively rounds off properly and the +50 is because
// the temps start at -50
extern inline u8 TEMP_TO_REG(long val)
static inline u8 TEMP_TO_REG(long val)
{
return (u8)
SENSORS_LIMIT(viaLUT[((val <= -500) ? 0 : (val >= 1100) ? 160 :
@@ -317,7 +307,7 @@ extern inline u8 TEMP_TO_REG(long val)
/* for 10-bit temperature readings */
// You might _think_ this is too long to inline, but's it's really only
// called once...
extern inline long TEMP_FROM_REG10(u16 val)
static inline long TEMP_FROM_REG10(u16 val)
{
// the temp values are already *10, so we don't need to do that.
long temp;
@@ -386,11 +376,6 @@ extern inline long TEMP_FROM_REG10(u16 val)
#define VIA686A_INIT_TEMP_OVER 600
#define VIA686A_INIT_TEMP_HYST 500
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* For the VIA686A, we need to keep some data in memory. That
data is pointed to by via686a_list[NR]->data. The structure itself is
dynamically allocated, at the same time when a new via686a client is
@@ -417,22 +402,12 @@ struct via686a_data {
static struct pci_dev *s_bridge; /* pointer to the (only) via686a */
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_via686a_init(void);
static int __init via686a_cleanup(void);
static int via686a_attach_adapter(struct i2c_adapter *adapter);
static int via686a_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int via686a_detach_client(struct i2c_client *client);
static int via686a_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void via686a_inc_use(struct i2c_client *client);
static void via686a_dec_use(struct i2c_client *client);
static int via686a_read_value(struct i2c_client *client, u8 register);
static void via686a_write_value(struct i2c_client *client, u8 register,
@@ -458,19 +433,15 @@ static int via686a_id = 0;
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static struct i2c_driver via686a_driver = {
/* name */ "VIA 686A",
/* id */ I2C_DRIVERID_VIA686A,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &via686a_attach_adapter,
/* detach_client */ &via686a_detach_client,
/* command */ &via686a_command,
/* inc_use */ &via686a_inc_use,
/* dec_use */ &via686a_dec_use
.owner = THIS_MODULE,
.name = "VIA 686A",
.id = I2C_DRIVERID_VIA686A,
.flags = I2C_DF_NOTIFY,
.attach_adapter = via686a_attach_adapter,
.detach_client = via686a_detach_client,
.command = via686a_command,
};
/* Used by via686a_init/cleanup */
static int __initdata via686a_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected VIA686A. This is just a template;
though at first sight, you might think we could use a statically
@@ -517,13 +488,13 @@ static inline void via686a_write_value(struct i2c_client *client, u8 reg,
}
/* This is called when the module is loaded */
int via686a_attach_adapter(struct i2c_adapter *adapter)
static int via686a_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, via686a_detect);
}
/* Locate chip and get correct base address */
int via686a_find(int *address)
static int via686a_find(int *address)
{
u16 val;
@@ -644,7 +615,7 @@ int via686a_detect(struct i2c_adapter *adapter, int address,
return err;
}
int via686a_detach_client(struct i2c_client *client)
static int via686a_detach_client(struct i2c_client *client)
{
int err;
@@ -664,23 +635,14 @@ int via686a_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int via686a_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int via686a_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void via686a_inc_use(struct i2c_client *client)
{
MOD_INC_USE_COUNT;
}
void via686a_dec_use(struct i2c_client *client)
{
MOD_DEC_USE_COUNT;
}
/* Called when we have found a new VIA686A. Set limits, etc. */
void via686a_init_client(struct i2c_client *client)
static void via686a_init_client(struct i2c_client *client)
{
int i;
@@ -734,7 +696,7 @@ void via686a_init_client(struct i2c_client *client)
!(VIA686A_TEMP_MODE_MASK | VIA686A_TEMP_MODE_CONTINUOUS));
}
void via686a_update_client(struct i2c_client *client)
static void via686a_update_client(struct i2c_client *client)
{
struct via686a_data *data = client->data;
int i;
@@ -939,12 +901,11 @@ void via686a_fan_div(struct i2c_client *client, int operation,
}
}
int __init sensors_via686a_init(void)
static int __init sm_via686a_init(void)
{
int res, addr;
printk("via686a.o version %s (%s)\n", LM_VERSION, LM_DATE);
via686a_initialized = 0;
if (via686a_find(&addr)) {
printk("via686a.o: No Via 686A sensors found.\n");
@@ -952,46 +913,19 @@ int __init sensors_via686a_init(void)
}
normal_isa[0] = addr;
if ((res = i2c_add_driver(&via686a_driver))) {
printk("via686a.o: Driver registration failed.\n");
via686a_cleanup();
return res;
}
via686a_initialized++;
return 0;
return i2c_add_driver(&via686a_driver);
}
int __init via686a_cleanup(void)
static void __exit sm_via686a_exit(void)
{
int res;
if (via686a_initialized >= 1) {
if ((res = i2c_del_driver(&via686a_driver))) {
printk
("via686a.o: Driver deregistration failed.\n");
return res;
}
via686a_initialized--;
}
return 0;
i2c_del_driver(&via686a_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR
("Kyösti Mälkki <kmalkki@cc.hut.fi>, Mark Studebaker <mdsxyz123@yahoo.com>, Bob Dougherty <bobd@stanford.edu>");
MODULE_DESCRIPTION("VIA 686A Sensor device");
int init_module(void)
{
return sensors_via686a_init();
}
int cleanup_module(void)
{
return via686a_cleanup();
}
#endif /* MODULE */
module_init(sm_via686a_init);
module_exit(sm_via686a_exit);
+20 -90
View File
@@ -36,14 +36,6 @@
#include "sensors_vid.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
static int force_addr = 0;
MODULE_PARM(force_addr, "i");
@@ -177,7 +169,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e, 0x2c, 0x2e, 0x30, 0x32 };
/********* FAN RPM CONVERSIONS ********/
/* But this chip saturates back at 0, not at 255 like all the other chips.
So, 0 means 0 RPM */
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 0;
@@ -188,11 +180,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define MIN_TO_REG(a,b) FAN_TO_REG(a,b)
#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1310720/((val)*(div)))
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
struct vt1211_data {
struct semaphore lock;
int sysctl_id;
@@ -218,22 +205,12 @@ struct vt1211_data {
u8 uch_config;
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_vt1211_init(void);
static int __init vt1211_cleanup(void);
static int vt1211_attach_adapter(struct i2c_adapter *adapter);
static int vt1211_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int vt1211_detach_client(struct i2c_client *client);
static int vt1211_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void vt1211_inc_use(struct i2c_client *client);
static void vt1211_dec_use(struct i2c_client *client);
static inline int vt_rdval(struct i2c_client *client, u8 register);
static inline void vt1211_write_value(struct i2c_client *client, u8 register,
@@ -265,18 +242,15 @@ static void vt1211_temp(struct i2c_client *client, int operation,
static int vt1211_id = 0;
static struct i2c_driver vt1211_driver = {
/* name */ "VT1211 sensors driver",
/* id */ I2C_DRIVERID_VT1211,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &vt1211_attach_adapter,
/* detach_client */ &vt1211_detach_client,
/* command */ &vt1211_command,
/* inc_use */ &vt1211_inc_use,
/* dec_use */ &vt1211_dec_use
.owner = THIS_MODULE,
.name = "VT1211 sensors driver",
.id = I2C_DRIVERID_VT1211,
.flags = I2C_DF_NOTIFY,
.attach_adapter = vt1211_attach_adapter,
.detach_client = vt1211_detach_client,
.command = vt1211_command,
};
static int __initdata vt1211_initialized = 0;
static ctl_table vt1211_dir_table_template[] = {
{VT1211_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &vt1211_in},
@@ -327,12 +301,12 @@ static ctl_table vt1211_dir_table_template[] = {
{0}
};
int vt1211_attach_adapter(struct i2c_adapter *adapter)
static int vt1211_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, vt1211_detect);
}
int vt1211_find(int *address)
static int vt1211_find(int *address)
{
u16 val;
@@ -439,7 +413,7 @@ int vt1211_detect(struct i2c_adapter *adapter, int address,
return err;
}
int vt1211_detach_client(struct i2c_client *client)
static int vt1211_detach_client(struct i2c_client *client)
{
int err;
@@ -458,24 +432,11 @@ int vt1211_detach_client(struct i2c_client *client)
return 0;
}
int vt1211_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int vt1211_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void vt1211_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void vt1211_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
static inline int vt_rdval(struct i2c_client *client, u8 reg)
{
@@ -487,7 +448,7 @@ static inline void vt1211_write_value(struct i2c_client *client, u8 reg, u8 valu
outb_p(value, client->addr + reg);
}
void vt1211_init_client(struct i2c_client *client)
static void vt1211_init_client(struct i2c_client *client)
{
struct vt1211_data *data = client->data;
@@ -497,7 +458,7 @@ void vt1211_init_client(struct i2c_client *client)
vt1211_write_value(client, VT1211_REG_TEMP2_CONFIG, 0);
}
void vt1211_update_client(struct i2c_client *client)
static void vt1211_update_client(struct i2c_client *client)
{
struct vt1211_data *data = client->data;
int i, j;
@@ -799,12 +760,11 @@ void vt1211_uch(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_vt1211_init(void)
static int __init sm_vt1211_init(void)
{
int res, addr;
printk("vt1211.o version %s (%s)\n", LM_VERSION, LM_DATE);
vt1211_initialized = 0;
if (vt1211_find(&addr)) {
printk("vt1211.o: VT1211 not detected, module not inserted.\n");
@@ -812,49 +772,19 @@ int __init sensors_vt1211_init(void)
}
normal_isa[0] = addr;
if ((res = i2c_add_driver(&vt1211_driver))) {
printk
("vt1211.o: Driver registration failed, module not inserted.\n");
vt1211_cleanup();
return res;
}
vt1211_initialized++;
return 0;
return i2c_add_driver(&vt1211_driver);
}
int __init vt1211_cleanup(void)
static void __exit sm_vt1211_exit(void)
{
int res;
if (vt1211_initialized >= 1) {
if ((res = i2c_del_driver(&vt1211_driver))) {
printk
("vt1211.o: Driver deregistration failed, module not removed.\n");
return res;
}
vt1211_initialized--;
}
return 0;
i2c_del_driver(&vt1211_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("VT1211 sensors");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_vt1211_init();
}
int cleanup_module(void)
{
return vt1211_cleanup();
}
#endif /* MODULE */
module_init(sm_vt1211_init);
module_exit(sm_vt1211_exit);
+20 -91
View File
@@ -37,14 +37,6 @@
#include "sensors_vid.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
static int force_addr = 0;
MODULE_PARM(force_addr, "i");
@@ -135,7 +127,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e, 0x2c, 0x2e, 0x30, 0x32 };
/********* FAN RPM CONVERSIONS ********/
/* But this chip saturates back at 0, not at 255 like all the other chips.
So, 0 means 0 RPM */
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 0;
@@ -146,11 +138,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define MIN_TO_REG(a,b) FAN_TO_REG(a,b)
#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1310720/((val)*(div)))
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
struct vt8231_data {
struct semaphore lock;
int sysctl_id;
@@ -176,22 +163,12 @@ struct vt8231_data {
u8 uch_config;
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_vt8231_init(void);
static int __init vt8231_cleanup(void);
static int vt8231_attach_adapter(struct i2c_adapter *adapter);
static int vt8231_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int vt8231_detach_client(struct i2c_client *client);
static int vt8231_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void vt8231_inc_use(struct i2c_client *client);
static void vt8231_dec_use(struct i2c_client *client);
static inline int vt_rdval(struct i2c_client *client, u8 register);
static inline void vt8231_write_value(struct i2c_client *client, u8 register,
@@ -223,18 +200,15 @@ static void vt8231_temp(struct i2c_client *client, int operation,
static int vt8231_id = 0;
static struct i2c_driver vt8231_driver = {
/* name */ "VT8231 sensors driver",
/* id */ I2C_DRIVERID_VT8231,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &vt8231_attach_adapter,
/* detach_client */ &vt8231_detach_client,
/* command */ &vt8231_command,
/* inc_use */ &vt8231_inc_use,
/* dec_use */ &vt8231_dec_use
.owner = THIS_MODULE,
.name = "VT8231 sensors driver",
.id = I2C_DRIVERID_VT8231,
.flags = I2C_DF_NOTIFY,
.attach_adapter = vt8231_attach_adapter,
.detach_client = vt8231_detach_client,
.command = vt8231_command,
};
static int __initdata vt8231_initialized = 0;
static ctl_table vt8231_dir_table_template[] = {
{VT8231_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &vt8231_in},
@@ -287,13 +261,13 @@ static ctl_table vt8231_dir_table_template[] = {
static struct pci_dev *s_bridge;
int vt8231_attach_adapter(struct i2c_adapter *adapter)
static int vt8231_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, vt8231_detect);
}
/* Locate chip and get correct base address */
int vt8231_find(int *address)
static int vt8231_find(int *address)
{
u16 val;
@@ -409,7 +383,7 @@ int vt8231_detect(struct i2c_adapter *adapter, int address,
return err;
}
int vt8231_detach_client(struct i2c_client *client)
static int vt8231_detach_client(struct i2c_client *client)
{
int err;
@@ -428,24 +402,11 @@ int vt8231_detach_client(struct i2c_client *client)
return 0;
}
int vt8231_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int vt8231_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void vt8231_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void vt8231_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
static inline int vt_rdval(struct i2c_client *client, u8 reg)
{
@@ -457,7 +418,7 @@ static inline void vt8231_write_value(struct i2c_client *client, u8 reg, u8 valu
outb_p(value, client->addr + reg);
}
void vt8231_init_client(struct i2c_client *client)
static void vt8231_init_client(struct i2c_client *client)
{
struct vt8231_data *data = client->data;
@@ -467,7 +428,7 @@ void vt8231_init_client(struct i2c_client *client)
vt8231_write_value(client, VT8231_REG_TEMP2_CONFIG, 0);
}
void vt8231_update_client(struct i2c_client *client)
static void vt8231_update_client(struct i2c_client *client)
{
struct vt8231_data *data = client->data;
int i, j;
@@ -769,12 +730,11 @@ void vt8231_uch(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_vt8231_init(void)
static int __init sm_vt8231_init(void)
{
int res, addr;
printk("vt8231.o version %s (%s)\n", LM_VERSION, LM_DATE);
vt8231_initialized = 0;
if (vt8231_find(&addr)) {
printk("vt8231.o: VT8231 not detected, module not inserted.\n");
@@ -782,49 +742,18 @@ int __init sensors_vt8231_init(void)
}
normal_isa[0] = addr;
if ((res = i2c_add_driver(&vt8231_driver))) {
printk
("vt8231.o: Driver registration failed, module not inserted.\n");
vt8231_cleanup();
return res;
}
vt8231_initialized++;
return 0;
}
return i2c_add_driver(&vt8231_driver);}
int __init vt8231_cleanup(void)
static void __exit sm_vt8231_exit(void)
{
int res;
if (vt8231_initialized >= 1) {
if ((res = i2c_del_driver(&vt8231_driver))) {
printk
("vt8231.o: Driver deregistration failed, module not removed.\n");
return res;
}
vt8231_initialized--;
}
return 0;
i2c_del_driver(&vt8231_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("VT8231 sensors");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_vt8231_init();
}
int cleanup_module(void)
{
return vt8231_cleanup();
}
#endif /* MODULE */
module_init(sm_vt8231_init);
module_exit(sm_vt8231_exit);
+23 -93
View File
@@ -46,18 +46,11 @@
#include "sensors_vid.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef I2C_DRIVERID_W83627HF
#define I2C_DRIVERID_W83627HF 1038
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
static int force_addr;
MODULE_PARM(force_addr, "i");
@@ -219,7 +212,7 @@ static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -246,7 +239,7 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define DIV_FROM_REG(val) (1 << (val))
extern inline u8 DIV_TO_REG(long val)
static inline u8 DIV_TO_REG(long val)
{
int i;
val = SENSORS_LIMIT(val, 1, 128) >> 1;
@@ -356,11 +349,6 @@ extern inline u8 DIV_TO_REG(long val)
#define W83781D_INIT_TEMP3_OVER 600
#define W83781D_INIT_TEMP3_HYST 500
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* There are some complications in a module like this. First off, W83781D chips
may be both present on the SMBus and the ISA bus, and we have to handle
those cases separately at some places. Second, there might be several
@@ -419,22 +407,12 @@ struct w83627hf_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_w83627hf_init(void);
static int __init w83627hf_cleanup(void);
static int w83627hf_attach_adapter(struct i2c_adapter *adapter);
static int w83627hf_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int w83627hf_detach_client(struct i2c_client *client);
static int w83627hf_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void w83627hf_inc_use(struct i2c_client *client);
static void w83627hf_dec_use(struct i2c_client *client);
static int w83627hf_read_value(struct i2c_client *client, u16 register);
static int w83627hf_write_value(struct i2c_client *client, u16 register,
@@ -469,19 +447,15 @@ static void w83627hf_sens(struct i2c_client *client, int operation,
static int w83627hf_id = 0;
static struct i2c_driver w83627hf_driver = {
/* name */ "W83781D sensor driver",
/* id */ I2C_DRIVERID_W83627HF,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &w83627hf_attach_adapter,
/* detach_client */ &w83627hf_detach_client,
/* command */ &w83627hf_command,
/* inc_use */ &w83627hf_inc_use,
/* dec_use */ &w83627hf_dec_use
.owner = THIS_MODULE,
.name = "W83781D sensor driver",
.id = I2C_DRIVERID_W83627HF,
.flags = I2C_DF_NOTIFY,
.attach_adapter = w83627hf_attach_adapter,
.detach_client = w83627hf_detach_client,
.command = w83627hf_command,
};
/* Used by w83627hf_init/cleanup */
static int __initdata w83627hf_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected chip. This is just a template;
though at first sight, you might think we could use a statically
@@ -594,12 +568,12 @@ static ctl_table w83697hf_dir_table_template[] = {
* w83627hf_driver is inserted (when this module is loaded), for each
available adapter
* when a new adapter is inserted (and w83627hf_driver is still present) */
int w83627hf_attach_adapter(struct i2c_adapter *adapter)
static int w83627hf_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, w83627hf_detect);
}
int w83627hf_find(int *address)
static int w83627hf_find(int *address)
{
u16 val;
@@ -740,7 +714,7 @@ int w83627hf_detect(struct i2c_adapter *adapter, int address,
return err;
}
int w83627hf_detach_client(struct i2c_client *client)
static int w83627hf_detach_client(struct i2c_client *client)
{
int err;
@@ -760,24 +734,11 @@ int w83627hf_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int w83627hf_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int w83627hf_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void w83627hf_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void w83627hf_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
/*
ISA access must always be locked explicitly!
@@ -785,7 +746,7 @@ void w83627hf_dec_use(struct i2c_client *client)
would slow down the W83781D access and should not be necessary.
There are some ugly typecasts here, but the good news is - they should
nowhere else be necessary! */
int w83627hf_read_value(struct i2c_client *client, u16 reg)
static int w83627hf_read_value(struct i2c_client *client, u16 reg)
{
int res, word_sized, bank;
struct i2c_client *cl;
@@ -820,7 +781,7 @@ int w83627hf_read_value(struct i2c_client *client, u16 reg)
return res;
}
int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
static int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
{
int word_sized, bank;
struct i2c_client *cl;
@@ -855,7 +816,7 @@ int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
}
/* Called when we have found a new W83781D. It should set limits, etc. */
void w83627hf_init_client(struct i2c_client *client)
static void w83627hf_init_client(struct i2c_client *client)
{
struct w83627hf_data *data = client->data;
int vid = 0, i;
@@ -1001,7 +962,7 @@ void w83627hf_init_client(struct i2c_client *client)
| 0x01);
}
void w83627hf_update_client(struct i2c_client *client)
static void w83627hf_update_client(struct i2c_client *client)
{
struct w83627hf_data *data = client->data;
int i;
@@ -1455,7 +1416,7 @@ void w83627hf_sens(struct i2c_client *client, int operation, int ctl_name,
}
}
int __init sensors_w83627hf_init(void)
static int __init sm_w83627hf_init(void)
{
int res, addr;
@@ -1466,52 +1427,21 @@ int __init sensors_w83627hf_init(void)
}
normal_isa[0] = addr;
w83627hf_initialized = 0;
if ((res = i2c_add_driver(&w83627hf_driver))) {
printk
(KERN_ERR "w83627hf.o: Driver registration failed, module not inserted.\n");
w83627hf_cleanup();
return res;
}
w83627hf_initialized++;
return 0;
return i2c_add_driver(&w83627hf_driver);
}
int __init w83627hf_cleanup(void)
static void __exit sm_w83627hf_exit(void)
{
int res;
if (w83627hf_initialized >= 1) {
if ((res = i2c_del_driver(&w83627hf_driver))) {
return res;
}
w83627hf_initialized--;
}
return 0;
i2c_del_driver(&w83627hf_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"and Mark Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("W83627HF driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_w83627hf_init();
}
int cleanup_module(void)
{
return w83627hf_cleanup();
}
#endif /* MODULE */
module_init(sm_w83627hf_init);
module_exit(sm_w83627hf_exit);
+23 -99
View File
@@ -49,15 +49,6 @@
#include "sensors_vid.h"
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
#endif
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
/* RT Table support #defined so we can take it out if it gets bothersome */
#define W83781D_RT 1
@@ -169,7 +160,7 @@ static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
extern inline u8 FAN_TO_REG(long rpm, int div)
static inline u8 FAN_TO_REG(long rpm, int div)
{
if (rpm == 0)
return 255;
@@ -203,7 +194,7 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
#define DIV_FROM_REG(val) (1 << (val))
extern inline u8 DIV_TO_REG(long val, enum chips type)
static inline u8 DIV_TO_REG(long val, enum chips type)
{
int i;
val = SENSORS_LIMIT(val, 1,
@@ -314,11 +305,6 @@ extern inline u8 DIV_TO_REG(long val, enum chips type)
#define W83781D_INIT_TEMP3_OVER 600
#define W83781D_INIT_TEMP3_HYST 500
#ifdef MODULE
extern int init_module(void);
extern int cleanup_module(void);
#endif /* MODULE */
/* There are some complications in a module like this. First off, W83781D chips
may be both present on the SMBus and the ISA bus, and we have to handle
those cases separately at some places. Second, there might be several
@@ -380,22 +366,12 @@ struct w83781d_data {
};
#ifdef MODULE
static
#else
extern
#endif
int __init sensors_w83781d_init(void);
static int __init w83781d_cleanup(void);
static int w83781d_attach_adapter(struct i2c_adapter *adapter);
static int w83781d_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind);
static int w83781d_detach_client(struct i2c_client *client);
static int w83781d_command(struct i2c_client *client, unsigned int cmd,
void *arg);
static void w83781d_inc_use(struct i2c_client *client);
static void w83781d_dec_use(struct i2c_client *client);
static int w83781d_read_value(struct i2c_client *client, u16 register);
static int w83781d_write_value(struct i2c_client *client, u16 register,
@@ -435,19 +411,15 @@ static u16 swap_bytes(u16 val);
static int w83781d_id = 0;
static struct i2c_driver w83781d_driver = {
/* name */ "W83781D sensor driver",
/* id */ I2C_DRIVERID_W83781D,
/* flags */ I2C_DF_NOTIFY,
/* attach_adapter */ &w83781d_attach_adapter,
/* detach_client */ &w83781d_detach_client,
/* command */ &w83781d_command,
/* inc_use */ &w83781d_inc_use,
/* dec_use */ &w83781d_dec_use
.owner = THIS_MODULE,
.name = "W83781D sensor driver",
.id = I2C_DRIVERID_W83781D,
.flags = I2C_DF_NOTIFY,
.attach_adapter = w83781d_attach_adapter,
.detach_client = w83781d_detach_client,
.command = w83781d_command,
};
/* Used by w83781d_init/cleanup */
static int __initdata w83781d_initialized = 0;
/* The /proc/sys entries */
/* These files are created for each detected chip. This is just a template;
though at first sight, you might think we could use a statically
@@ -756,7 +728,7 @@ static ctl_table w83697hf_dir_table_template[] = {
* w83781d_driver is inserted (when this module is loaded), for each
available adapter
* when a new adapter is inserted (and w83781d_driver is still present) */
int w83781d_attach_adapter(struct i2c_adapter *adapter)
static int w83781d_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_detect(adapter, &addr_data, w83781d_detect);
}
@@ -1065,7 +1037,7 @@ int w83781d_detect(struct i2c_adapter *adapter, int address,
return err;
}
int w83781d_detach_client(struct i2c_client *client)
static int w83781d_detach_client(struct i2c_client *client)
{
int err;
@@ -1098,26 +1070,13 @@ int w83781d_detach_client(struct i2c_client *client)
}
/* No commands defined yet */
int w83781d_command(struct i2c_client *client, unsigned int cmd, void *arg)
static int w83781d_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
void w83781d_inc_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
}
void w83781d_dec_use(struct i2c_client *client)
{
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
}
u16 swap_bytes(u16 val)
static u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
}
@@ -1128,7 +1087,7 @@ u16 swap_bytes(u16 val)
would slow down the W83781D access and should not be necessary.
There are some ugly typecasts here, but the good news is - they should
nowhere else be necessary! */
int w83781d_read_value(struct i2c_client *client, u16 reg)
static int w83781d_read_value(struct i2c_client *client, u16 reg)
{
int res, word_sized, bank;
struct i2c_client *cl;
@@ -1204,7 +1163,7 @@ int w83781d_read_value(struct i2c_client *client, u16 reg)
return res;
}
int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
static int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
{
int word_sized, bank;
struct i2c_client *cl;
@@ -1273,7 +1232,7 @@ int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
}
/* Called when we have found a new W83781D. It should set limits, etc. */
void w83781d_init_client(struct i2c_client *client)
static void w83781d_init_client(struct i2c_client *client)
{
struct w83781d_data *data = client->data;
int vid = 0, i, p;
@@ -1477,7 +1436,7 @@ void w83781d_init_client(struct i2c_client *client)
| 0x01);
}
void w83781d_update_client(struct i2c_client *client)
static void w83781d_update_client(struct i2c_client *client)
{
struct w83781d_data *data = client->data;
int i, j;
@@ -2043,59 +2002,24 @@ void w83781d_rt(struct i2c_client *client, int operation, int ctl_name,
}
#endif
int __init sensors_w83781d_init(void)
static int __init sm_w83781d_init(void)
{
int res;
printk(KERN_INFO "w83781d.o version %s (%s)\n", LM_VERSION, LM_DATE);
w83781d_initialized = 0;
if ((res = i2c_add_driver(&w83781d_driver))) {
printk
(KERN_ERR "w83781d.o: Driver registration failed, module not inserted.\n");
w83781d_cleanup();
return res;
}
w83781d_initialized++;
return 0;
return i2c_add_driver(&w83781d_driver);
}
int __init w83781d_cleanup(void)
static void __exit sm_w83781d_exit(void)
{
int res;
if (w83781d_initialized >= 1) {
if ((res = i2c_del_driver(&w83781d_driver))) {
printk
(KERN_ERR "w83781d.o: Driver deregistration failed, module not removed.\n");
return res;
}
w83781d_initialized--;
}
return 0;
i2c_del_driver(&w83781d_driver);
}
EXPORT_NO_SYMBOLS;
#ifdef MODULE
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"and Mark Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("W83781D driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
int init_module(void)
{
return sensors_w83781d_init();
}
int cleanup_module(void)
{
return w83781d_cleanup();
}
#endif /* MODULE */
module_init(sm_w83781d_init);
module_exit(sm_w83781d_exit);