diff options
Diffstat (limited to 'drivers/rtc/rtc-isl1208.c')
| -rw-r--r-- | drivers/rtc/rtc-isl1208.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index ec5ef518a09b..37ab3e1d25f5 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c | |||
| @@ -84,29 +84,13 @@ static int | |||
| 84 | isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], | 84 | isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], |
| 85 | unsigned len) | 85 | unsigned len) |
| 86 | { | 86 | { |
| 87 | u8 reg_addr[1] = { reg }; | ||
| 88 | struct i2c_msg msgs[2] = { | ||
| 89 | { | ||
| 90 | .addr = client->addr, | ||
| 91 | .len = sizeof(reg_addr), | ||
| 92 | .buf = reg_addr | ||
| 93 | }, | ||
| 94 | { | ||
| 95 | .addr = client->addr, | ||
| 96 | .flags = I2C_M_RD, | ||
| 97 | .len = len, | ||
| 98 | .buf = buf | ||
| 99 | } | ||
| 100 | }; | ||
| 101 | int ret; | 87 | int ret; |
| 102 | 88 | ||
| 103 | WARN_ON(reg > ISL1219_REG_YRT); | 89 | WARN_ON(reg > ISL1219_REG_YRT); |
| 104 | WARN_ON(reg + len > ISL1219_REG_YRT + 1); | 90 | WARN_ON(reg + len > ISL1219_REG_YRT + 1); |
| 105 | 91 | ||
| 106 | ret = i2c_transfer(client->adapter, msgs, 2); | 92 | ret = i2c_smbus_read_i2c_block_data(client, reg, len, buf); |
| 107 | if (ret > 0) | 93 | return (ret < 0) ? ret : 0; |
| 108 | ret = 0; | ||
| 109 | return ret; | ||
| 110 | } | 94 | } |
| 111 | 95 | ||
| 112 | /* block write */ | 96 | /* block write */ |
| @@ -114,26 +98,13 @@ static int | |||
| 114 | isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], | 98 | isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], |
| 115 | unsigned len) | 99 | unsigned len) |
| 116 | { | 100 | { |
| 117 | u8 i2c_buf[ISL1208_REG_USR2 + 2]; | ||
| 118 | struct i2c_msg msgs[1] = { | ||
| 119 | { | ||
| 120 | .addr = client->addr, | ||
| 121 | .len = len + 1, | ||
| 122 | .buf = i2c_buf | ||
| 123 | } | ||
| 124 | }; | ||
| 125 | int ret; | 101 | int ret; |
| 126 | 102 | ||
| 127 | WARN_ON(reg > ISL1219_REG_YRT); | 103 | WARN_ON(reg > ISL1219_REG_YRT); |
| 128 | WARN_ON(reg + len > ISL1219_REG_YRT + 1); | 104 | WARN_ON(reg + len > ISL1219_REG_YRT + 1); |
| 129 | 105 | ||
| 130 | i2c_buf[0] = reg; | 106 | ret = i2c_smbus_write_i2c_block_data(client, reg, len, buf); |
| 131 | memcpy(&i2c_buf[1], &buf[0], len); | 107 | return (ret < 0) ? ret : 0; |
| 132 | |||
| 133 | ret = i2c_transfer(client->adapter, msgs, 1); | ||
| 134 | if (ret > 0) | ||
| 135 | ret = 0; | ||
| 136 | return ret; | ||
| 137 | } | 108 | } |
| 138 | 109 | ||
| 139 | /* simple check to see whether we have a isl1208 */ | 110 | /* simple check to see whether we have a isl1208 */ |
