drivers: misc: therm_est: Add timer trip support
[linux-2.6.git] / drivers / misc / bmp085.c
index 5f898cb..76c3064 100644 (file)
@@ -87,7 +87,7 @@ struct bmp085_data {
        u32 raw_temperature;
        u32 raw_pressure;
        unsigned char oversampling_setting;
-       u32 last_temp_measurement;
+       unsigned long last_temp_measurement;
        s32 b6; /* calculated temperature correction coefficient */
 };
 
@@ -216,7 +216,7 @@ static s32 bmp085_get_temperature(struct bmp085_data *data, int *temperature)
                *temperature = (x1+x2+8) >> 4;
 
 exit:
-       return status;;
+       return status;
 }
 
 /*
@@ -234,7 +234,8 @@ static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure)
        int status;
 
        /* alt least every second force an update of the ambient temperature */
-       if (data->last_temp_measurement + 1*HZ < jiffies) {
+       if (data->last_temp_measurement == 0 ||
+                       time_is_before_jiffies(data->last_temp_measurement + 1*HZ)) {
                status = bmp085_get_temperature(data, NULL);
                if (status != 0)
                        goto exit;
@@ -464,20 +465,8 @@ static struct i2c_driver bmp085_driver = {
        .address_list   = normal_i2c
 };
 
-static int __init bmp085_init(void)
-{
-       return i2c_add_driver(&bmp085_driver);
-}
-
-static void __exit bmp085_exit(void)
-{
-       i2c_del_driver(&bmp085_driver);
-}
-
+module_i2c_driver(bmp085_driver);
 
 MODULE_AUTHOR("Christoph Mair <christoph.mair@gmail.com");
 MODULE_DESCRIPTION("BMP085 driver");
 MODULE_LICENSE("GPL");
-
-module_init(bmp085_init);
-module_exit(bmp085_exit);