diff options
author | Peter Rosin <peda@axentia.se> | 2018-06-20 10:51:56 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-07-03 22:57:47 +0200 |
commit | 1bcb852f5bff7ae9b94777b4d844818f07b02bcd (patch) | |
tree | ea1e5f02003f549119ea58c1195292d4a6e7809b /drivers/i2c/muxes/i2c-mux-pca954x.c | |
parent | i2c: mux: pca9541: make use of __i2c_smbus_xfer (diff) | |
download | linux-1bcb852f5bff7ae9b94777b4d844818f07b02bcd.tar.xz linux-1bcb852f5bff7ae9b94777b4d844818f07b02bcd.zip |
i2c: mux: pca954x: make use of __i2c_smbus_xfer
This simplifies the code, and you get retries for free if the adapter
does not support ->master_xfer.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/muxes/i2c-mux-pca954x.c')
-rw-r--r-- | drivers/i2c/muxes/i2c-mux-pca954x.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index fbc748027087..0e9a0e66e92f 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -220,30 +220,11 @@ MODULE_DEVICE_TABLE(of, pca954x_of_match); static int pca954x_reg_write(struct i2c_adapter *adap, struct i2c_client *client, u8 val) { - int ret = -ENODEV; - - if (adap->algo->master_xfer) { - struct i2c_msg msg; - char buf[1]; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = 1; - buf[0] = val; - msg.buf = buf; - ret = __i2c_transfer(adap, &msg, 1); - - if (ret >= 0 && ret != 1) - ret = -EREMOTEIO; - } else { - union i2c_smbus_data data; - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_WRITE, - val, I2C_SMBUS_BYTE, &data); - } + union i2c_smbus_data dummy; - return ret; + return __i2c_smbus_xfer(adap, client->addr, client->flags, + I2C_SMBUS_WRITE, val, + I2C_SMBUS_BYTE, &dummy); } static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) |