diff options
Diffstat (limited to 'drivers/video/serdes/fpd3_i2c_adap.c')
-rw-r--r-- | drivers/video/serdes/fpd3_i2c_adap.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/video/serdes/fpd3_i2c_adap.c b/drivers/video/serdes/fpd3_i2c_adap.c index d43de5a43c06..8cc866fc1221 100644 --- a/drivers/video/serdes/fpd3_i2c_adap.c +++ b/drivers/video/serdes/fpd3_i2c_adap.c | |||
@@ -100,8 +100,10 @@ static int fpd3_serdes_setup_aliases(struct i2c_client *client) | |||
100 | count++; | 100 | count++; |
101 | } | 101 | } |
102 | 102 | ||
103 | if (count >= FPD3_MAX_POLL_COUNT) | 103 | if (count >= FPD3_MAX_POLL_COUNT) { |
104 | dev_err(&client->dev, "Unable to sync with remote slave"); | ||
104 | return -EIO; | 105 | return -EIO; |
106 | } | ||
105 | 107 | ||
106 | dev_dbg(&client->dev, "Remote signal detected"); | 108 | dev_dbg(&client->dev, "Remote signal detected"); |
107 | return 0; | 109 | return 0; |
@@ -197,7 +199,7 @@ static int fpd3_master_xfer(struct i2c_adapter *adap, | |||
197 | struct i2c_msg msgs[], int num) | 199 | struct i2c_msg msgs[], int num) |
198 | { | 200 | { |
199 | struct i2c_adapter *alias_adap; | 201 | struct i2c_adapter *alias_adap; |
200 | struct i2c_msg new_msg; | 202 | struct i2c_msg *new_msg; |
201 | u8 alias_addr; | 203 | u8 alias_addr; |
202 | int i, ret = 0; | 204 | int i, ret = 0; |
203 | 205 | ||
@@ -206,22 +208,26 @@ static int fpd3_master_xfer(struct i2c_adapter *adap, | |||
206 | 208 | ||
207 | alias_adap = __get_alias_adapter(adap); | 209 | alias_adap = __get_alias_adapter(adap); |
208 | 210 | ||
211 | new_msg = kcalloc(num, sizeof(*new_msg), GFP_KERNEL); | ||
212 | |||
209 | for (i = 0; i < num; i++) { | 213 | for (i = 0; i < num; i++) { |
210 | alias_addr = __get_alias_addr(adap, msgs[i].addr); | 214 | alias_addr = __get_alias_addr(adap, msgs[i].addr); |
211 | if (alias_addr == 0) { | 215 | if (alias_addr == 0) { |
212 | ret = -EINVAL; | 216 | ret = -EINVAL; |
213 | break; | 217 | goto cleanup; |
214 | } | 218 | } |
215 | 219 | ||
216 | /* Copy the i2c_msgs into temporary buffer; xlate address */ | 220 | /* Copy the i2c_msgs into temporary buffer; xlate address */ |
217 | new_msg = msgs[i]; | 221 | new_msg[i] = msgs[i]; |
218 | new_msg.addr = alias_addr; | 222 | new_msg[i].addr = alias_addr; |
219 | /* Issue the messages on the alias adapter */ | ||
220 | ret = i2c_transfer(alias_adap, &new_msg, 1); | ||
221 | if (ret) | ||
222 | break; | ||
223 | } | 223 | } |
224 | 224 | ||
225 | /* Issue the messages on the alias adapter */ | ||
226 | ret = i2c_transfer(alias_adap, new_msg, num); | ||
227 | |||
228 | cleanup: | ||
229 | kfree(new_msg); | ||
230 | |||
225 | return ret; | 231 | return ret; |
226 | } | 232 | } |
227 | 233 | ||