]> err.no Git - linux-2.6/blobdiff - drivers/hwmon/lm78.c
[PATCH] sky2: transmit recovery
[linux-2.6] / drivers / hwmon / lm78.c
index 008fd9310061762978d647954f0e8368ae39322e..e404001e20daaee2b8f9e9aaaa387f170c6df389 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
+#include <linux/hwmon-vid.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
@@ -37,7 +37,7 @@ static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24,
 static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
-SENSORS_INSMOD_2(lm78, lm79);
+I2C_CLIENT_INSMOD_2(lm78, lm79);
 
 /* Many LM78 constants specified below */
 
@@ -107,13 +107,6 @@ static inline int TEMP_FROM_REG(s8 val)
        return val * 1000;
 }
 
-/* VID: mV
-   REG: (see doc/vid) */
-static inline int VID_FROM_REG(u8 val)
-{
-       return val==0x1f ? 0 : val>=0x10 ? 5100-val*100 : 2050-val*50;
-}
-
 #define DIV_FROM_REG(val) (1 << (val))
 
 /* There are some complications in a module like this. First off, LM78 chips
@@ -171,17 +164,18 @@ static void lm78_init_client(struct i2c_client *client);
 
 
 static struct i2c_driver lm78_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "lm78",
+       .driver = {
+               .name   = "lm78",
+       },
        .id             = I2C_DRIVERID_LM78,
-       .flags          = I2C_DF_NOTIFY,
        .attach_adapter = lm78_attach_adapter,
        .detach_client  = lm78_detach_client,
 };
 
 static struct i2c_driver lm78_isa_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "lm78-isa",
+       .driver = {
+               .name   = "lm78-isa",
+       },
        .attach_adapter = lm78_isa_attach_adapter,
        .detach_client  = lm78_detach_client,
 };
@@ -458,7 +452,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL);
 static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct lm78_data *data = lm78_update_device(dev);
-       return sprintf(buf, "%d\n", VID_FROM_REG(data->vid));
+       return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82));
 }
 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
 
@@ -487,7 +481,7 @@ static int lm78_isa_attach_adapter(struct i2c_adapter *adapter)
 }
 
 /* This function is called by i2c_probe */
-int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
+static int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
 {
        int i, err;
        struct i2c_client *new_client;
@@ -504,7 +498,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
        /* Reserve the ISA region */
        if (is_isa)
                if (!request_region(address, LM78_EXTENT,
-                                   lm78_isa_driver.name)) {
+                                   lm78_isa_driver.driver.name)) {
                        err = -EBUSY;
                        goto ERROR0;
                }
@@ -547,11 +541,10 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
           client structure, even though we cannot fill it completely yet.
           But it allows us to access lm78_{read,write}_value. */
 
-       if (!(data = kmalloc(sizeof(struct lm78_data), GFP_KERNEL))) {
+       if (!(data = kzalloc(sizeof(struct lm78_data), GFP_KERNEL))) {
                err = -ENOMEM;
                goto ERROR1;
        }
-       memset(data, 0, sizeof(struct lm78_data));
 
        new_client = &data->client;
        if (is_isa)
@@ -733,7 +726,6 @@ static int lm78_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 LM78. It should set limits, etc. */
 static void lm78_init_client(struct i2c_client *client)
 {
        u8 config = lm78_read_value(client, LM78_REG_CONFIG);