vserver 1.9.5.x5
[linux-2.6.git] / drivers / i2c / chips / lm78.c
index b3cab5f..640aa01 100644 (file)
 #include <asm/io.h>
 
 /* Addresses to scan */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { 0x20, 0x2f, I2C_CLIENT_END };
+static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24,
+                                       0x25, 0x26, 0x27, 0x28, 0x29,
+                                       0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
+                                       0x2f, I2C_CLIENT_END };
 static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
-static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_3(lm78, lm78j, lm79);
@@ -229,29 +230,29 @@ static ssize_t set_in_max(struct device *dev, const char *buf,
 static ssize_t                                                 \
        show_in##offset (struct device *dev, char *buf)         \
 {                                                              \
-       return show_in(dev, buf, 0x##offset);                   \
+       return show_in(dev, buf, offset);                       \
 }                                                              \
 static DEVICE_ATTR(in##offset##_input, S_IRUGO,                \
                show_in##offset, NULL);                         \
 static ssize_t                                                 \
        show_in##offset##_min (struct device *dev, char *buf)   \
 {                                                              \
-       return show_in_min(dev, buf, 0x##offset);               \
+       return show_in_min(dev, buf, offset);                   \
 }                                                              \
 static ssize_t                                                 \
        show_in##offset##_max (struct device *dev, char *buf)   \
 {                                                              \
-       return show_in_max(dev, buf, 0x##offset);               \
+       return show_in_max(dev, buf, offset);                   \
 }                                                              \
 static ssize_t set_in##offset##_min (struct device *dev,       \
                const char *buf, size_t count)                  \
 {                                                              \
-       return set_in_min(dev, buf, count, 0x##offset);         \
+       return set_in_min(dev, buf, count, offset);             \
 }                                                              \
 static ssize_t set_in##offset##_max (struct device *dev,       \
                const char *buf, size_t count)                  \
 {                                                              \
-       return set_in_max(dev, buf, count, 0x##offset);         \
+       return set_in_max(dev, buf, count, offset);             \
 }                                                              \
 static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR,                \
                show_in##offset##_min, set_in##offset##_min);   \
@@ -375,20 +376,20 @@ static ssize_t set_fan_div(struct device *dev, const char *buf,
 #define show_fan_offset(offset)                                                \
 static ssize_t show_fan_##offset (struct device *dev, char *buf)       \
 {                                                                      \
-       return show_fan(dev, buf, 0x##offset - 1);                      \
+       return show_fan(dev, buf, offset - 1);                          \
 }                                                                      \
 static ssize_t show_fan_##offset##_min (struct device *dev, char *buf)  \
 {                                                                      \
-       return show_fan_min(dev, buf, 0x##offset - 1);                  \
+       return show_fan_min(dev, buf, offset - 1);                      \
 }                                                                      \
 static ssize_t show_fan_##offset##_div (struct device *dev, char *buf)  \
 {                                                                      \
-       return show_fan_div(dev, buf, 0x##offset - 1);                  \
+       return show_fan_div(dev, buf, offset - 1);                      \
 }                                                                      \
 static ssize_t set_fan_##offset##_min (struct device *dev,             \
                const char *buf, size_t count)                          \
 {                                                                      \
-       return set_fan_min(dev, buf, count, 0x##offset - 1);            \
+       return set_fan_min(dev, buf, count, offset - 1);                \
 }                                                                      \
 static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL);\
 static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR,               \
@@ -461,7 +462,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")) {
+               if (!request_region(address, LM78_EXTENT, lm78_driver.name)) {
                        err = -EBUSY;
                        goto ERROR0;
                }
@@ -692,26 +693,12 @@ static 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. */
 static void lm78_init_client(struct i2c_client *client)
 {
-       struct lm78_data *data = i2c_get_clientdata(client);
-       int vid;
-
-       /* Reset all except Watchdog values and last conversion values
-          This sets fan-divs to 2, among others */
-       lm78_write_value(client, LM78_REG_CONFIG, 0x80);
-
-       vid = lm78_read_value(client, LM78_REG_VID_FANDIV) & 0x0f;
-       if (data->type == lm79)
-               vid |=
-                   (lm78_read_value(client, LM78_REG_CHIPID) & 0x01) << 4;
-       else
-               vid |= 0x10;
-       vid = VID_FROM_REG(vid);
+       u8 config = lm78_read_value(client, LM78_REG_CONFIG);
 
        /* Start monitoring */
-       lm78_write_value(client, LM78_REG_CONFIG,
-                        (lm78_read_value(client, LM78_REG_CONFIG) & 0xf7)
-                        | 0x01);
-
+       if (!(config & 0x01))
+               lm78_write_value(client, LM78_REG_CONFIG,
+                                (config & 0xf7) | 0x01);
 }
 
 static struct lm78_data *lm78_update_device(struct device *dev)