(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

+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);