hwmon: Use i2c_smbus_{read,write}_word_swapped
[platform/upstream/kernel-adaptation-pc.git] / drivers / hwmon / lm73.c
index 24be176..9e64d96 100644 (file)
@@ -34,7 +34,7 @@ static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4c,
 #define LM73_REG_CTRL          0x04
 #define LM73_REG_ID            0x07
 
-#define LM73_ID                        0x9001 /* or 0x190 after a swab16() */
+#define LM73_ID                        0x9001  /* 0x0190, byte-swapped */
 #define DRVNAME                        "lm73"
 #define LM73_TEMP_MIN          (-40)
 #define LM73_TEMP_MAX          150
@@ -57,7 +57,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
        /* Write value */
        value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4),
                (LM73_TEMP_MAX*4)) << 5;
-       i2c_smbus_write_word_data(client, attr->index, swab16(value));
+       i2c_smbus_write_word_swapped(client, attr->index, value);
        return count;
 }
 
@@ -68,8 +68,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,
        struct i2c_client *client = to_i2c_client(dev);
        /* use integer division instead of equivalent right shift to
           guarantee arithmetic shift and preserve the sign */
-       int temp = ((s16) (swab16(i2c_smbus_read_word_data(client,
-               attr->index)))*250) / 32;
+       int temp = ((s16) (i2c_smbus_read_word_swapped(client,
+                   attr->index))*250) / 32;
        return sprintf(buf, "%d\n", temp);
 }