hwmon: Use i2c_smbus_{read,write}_word_swapped
Make use of the new i2c_smbus_{read,write}_word_swapped functions. This makes the driver code more compact and readable. It also ensures proper error handling. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Dirk Eibach <eibach@gdsys.de> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com>
此提交包含在:
@@ -829,17 +829,17 @@ static int asb100_read_value(struct i2c_client *client, u16 reg)
|
||||
/* convert from ISA to LM75 I2C addresses */
|
||||
switch (reg & 0xff) {
|
||||
case 0x50: /* TEMP */
|
||||
res = swab16(i2c_smbus_read_word_data(cl, 0));
|
||||
res = i2c_smbus_read_word_swapped(cl, 0);
|
||||
break;
|
||||
case 0x52: /* CONFIG */
|
||||
res = i2c_smbus_read_byte_data(cl, 1);
|
||||
break;
|
||||
case 0x53: /* HYST */
|
||||
res = swab16(i2c_smbus_read_word_data(cl, 2));
|
||||
res = i2c_smbus_read_word_swapped(cl, 2);
|
||||
break;
|
||||
case 0x55: /* MAX */
|
||||
default:
|
||||
res = swab16(i2c_smbus_read_word_data(cl, 3));
|
||||
res = i2c_smbus_read_word_swapped(cl, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -877,10 +877,10 @@ static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
i2c_smbus_write_byte_data(cl, 1, value & 0xff);
|
||||
break;
|
||||
case 0x53: /* HYST */
|
||||
i2c_smbus_write_word_data(cl, 2, swab16(value));
|
||||
i2c_smbus_write_word_swapped(cl, 2, value);
|
||||
break;
|
||||
case 0x55: /* MAX */
|
||||
i2c_smbus_write_word_data(cl, 3, swab16(value));
|
||||
i2c_smbus_write_word_swapped(cl, 3, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
新增問題並參考
封鎖使用者