]> err.no Git - linux-2.6/blobdiff - drivers/hwmon/lm78.c
V4L/DVB (3500): Ringbuffer: don't reset pointers to zero
[linux-2.6] / drivers / hwmon / lm78.c
index 51c0b37c4990e1284f4304917fc3cf714776231e..e404001e20daaee2b8f9e9aaaa387f170c6df389 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
 #include <linux/hwmon.h>
+#include <linux/hwmon-vid.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
@@ -106,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
@@ -170,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,
 };
@@ -457,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);
 
@@ -486,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;
@@ -503,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;
                }
@@ -546,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)
@@ -732,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);