vserver 2.0 rc7
[linux-2.6.git] / drivers / i2c / chips / eeprom.c
index 53dddf0..cbdfa2d 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -86,8 +87,7 @@ static void eeprom_update_client(struct i2c_client *client, u8 slice)
        down(&data->update_lock);
 
        if (!(data->valid & (1 << slice)) ||
-           (jiffies - data->last_updated[slice] > 300 * HZ) ||
-           (jiffies < data->last_updated[slice])) {
+           time_after(jiffies, data->last_updated[slice] + 300 * HZ)) {
                dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice);
 
                if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
@@ -210,10 +210,11 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
                if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P'
                 && i2c_smbus_read_byte(new_client) == 'C'
                 && i2c_smbus_read_byte(new_client) == 'G'
-                && i2c_smbus_read_byte(new_client) == '-')
+                && i2c_smbus_read_byte(new_client) == '-') {
                        dev_info(&new_client->dev, "Vaio EEPROM detected, "
                                "enabling password protection\n");
                        data->nature = VAIO;
+               }
        }
 
        /* create the sysfs eeprom file */