adt74{62, 70, 73}: Use DIV_ROUND_CLOSEST for rounded division
[pandora-kernel.git] / drivers / hwmon / adt7473.c
index 18aa308..0a6ce23 100644 (file)
@@ -129,8 +129,6 @@ I2C_CLIENT_INSMOD_1(adt7473);
 #define FAN_PERIOD_INVALID     65535
 #define FAN_DATA_VALID(x)      ((x) && (x) != FAN_PERIOD_INVALID)
 
-#define ROUND_DIV(x, divisor)  (((x) + ((divisor) / 2)) / (divisor))
-
 struct adt7473_data {
        struct device           *hwmon_dev;
        struct attribute_group  attrs;
@@ -459,7 +457,7 @@ static ssize_t set_temp_min(struct device *dev,
        if (strict_strtol(buf, 10, &temp))
                return -EINVAL;
 
-       temp = ROUND_DIV(temp, 1000);
+       temp = DIV_ROUND_CLOSEST(temp, 1000);
        temp = encode_temp(data->temp_twos_complement, temp);
 
        mutex_lock(&data->lock);
@@ -495,7 +493,7 @@ static ssize_t set_temp_max(struct device *dev,
        if (strict_strtol(buf, 10, &temp))
                return -EINVAL;
 
-       temp = ROUND_DIV(temp, 1000);
+       temp = DIV_ROUND_CLOSEST(temp, 1000);
        temp = encode_temp(data->temp_twos_complement, temp);
 
        mutex_lock(&data->lock);
@@ -720,7 +718,7 @@ static ssize_t set_temp_tmax(struct device *dev,
        if (strict_strtol(buf, 10, &temp))
                return -EINVAL;
 
-       temp = ROUND_DIV(temp, 1000);
+       temp = DIV_ROUND_CLOSEST(temp, 1000);
        temp = encode_temp(data->temp_twos_complement, temp);
 
        mutex_lock(&data->lock);
@@ -756,7 +754,7 @@ static ssize_t set_temp_tmin(struct device *dev,
        if (strict_strtol(buf, 10, &temp))
                return -EINVAL;
 
-       temp = ROUND_DIV(temp, 1000);
+       temp = DIV_ROUND_CLOSEST(temp, 1000);
        temp = encode_temp(data->temp_twos_complement, temp);
 
        mutex_lock(&data->lock);