Re: [PATCH] regmap: Fix i2c word access when using SMBus access functions

From: Lars-Peter Clausen
Date: Mon Feb 02 2015 - 05:26:45 EST


On 02/02/2015 12:48 AM, Guenter Roeck wrote:
[...]
static int regmap_i2c_write(void *context, const void *data, size_t count)
{
struct device *dev = context;
@@ -180,7 +216,10 @@ static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
else if (config->val_bits == 16 && config->reg_bits == 8 &&
i2c_check_functionality(i2c->adapter,
I2C_FUNC_SMBUS_WORD_DATA))
- return &regmap_smbus_word;
+ if (config->val_format_endian == REGMAP_ENDIAN_LITTLE)

This should probably use regmap_get_val_endian() and maybe also handle REGMAP_ENDIAN_NATIVE.

+ return &regmap_smbus_word;
+ else
+ return &regmap_smbus_word_swapped;
else if (config->val_bits == 8 && config->reg_bits == 8 &&
i2c_check_functionality(i2c->adapter,
I2C_FUNC_SMBUS_BYTE_DATA))


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/