diff options
| -rw-r--r-- | drivers/hid/hid-cp2112.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 68cdc962265b..271f31461da4 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c | |||
| @@ -696,8 +696,16 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, | |||
| 696 | (u8 *)&word, 2); | 696 | (u8 *)&word, 2); |
| 697 | break; | 697 | break; |
| 698 | case I2C_SMBUS_I2C_BLOCK_DATA: | 698 | case I2C_SMBUS_I2C_BLOCK_DATA: |
| 699 | size = I2C_SMBUS_BLOCK_DATA; | 699 | if (read_write == I2C_SMBUS_READ) { |
| 700 | /* fallthrough */ | 700 | read_length = data->block[0]; |
| 701 | count = cp2112_write_read_req(buf, addr, read_length, | ||
| 702 | command, NULL, 0); | ||
| 703 | } else { | ||
| 704 | count = cp2112_write_req(buf, addr, command, | ||
| 705 | data->block + 1, | ||
| 706 | data->block[0]); | ||
| 707 | } | ||
| 708 | break; | ||
| 701 | case I2C_SMBUS_BLOCK_DATA: | 709 | case I2C_SMBUS_BLOCK_DATA: |
| 702 | if (I2C_SMBUS_READ == read_write) { | 710 | if (I2C_SMBUS_READ == read_write) { |
| 703 | count = cp2112_write_read_req(buf, addr, | 711 | count = cp2112_write_read_req(buf, addr, |
| @@ -785,6 +793,9 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, | |||
| 785 | case I2C_SMBUS_WORD_DATA: | 793 | case I2C_SMBUS_WORD_DATA: |
| 786 | data->word = le16_to_cpup((__le16 *)buf); | 794 | data->word = le16_to_cpup((__le16 *)buf); |
| 787 | break; | 795 | break; |
| 796 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
| 797 | memcpy(data->block + 1, buf, read_length); | ||
| 798 | break; | ||
| 788 | case I2C_SMBUS_BLOCK_DATA: | 799 | case I2C_SMBUS_BLOCK_DATA: |
| 789 | if (read_length > I2C_SMBUS_BLOCK_MAX) { | 800 | if (read_length > I2C_SMBUS_BLOCK_MAX) { |
| 790 | ret = -EPROTO; | 801 | ret = -EPROTO; |
