diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 22:03:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 22:03:41 -0400 |
commit | 6df419e45d71b8d9a0de8e92a1212bbea460f0e0 (patch) | |
tree | c0902a96353391400818fe8b7adf11493b56935a /drivers/i2c/i2c-core.c | |
parent | 27c1ee3f929555b71fa39ec0d81a7e7185de1b16 (diff) | |
parent | c893e7c64e36087dceb4662917976a81d1754fc0 (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
"This is the first part of the media patches for v3.6.
This patch series contain:
- new DVB frontend: rtl2832
- new video drivers: adv7393
- some unused files got removed
- a selection API cleanup between V4L2 and V4L2 subdev API's
- a major redesign at v4l-ioctl2, in order to clean it up
- several driver fixes and improvements."
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (174 commits)
v4l: Export v4l2-common.h in include/linux/Kbuild
media: Revert "[media] Terratec Cinergy S2 USB HD Rev.2"
[media] media: Use pr_info not homegrown pr_reg macro
[media] Terratec Cinergy S2 USB HD Rev.2
[media] v4l: Correct conflicting V4L2 subdev selection API documentation
[media] Feature removal: V4L2 selections API target and flag definitions
[media] v4l: Unify selection flags documentation
[media] v4l: Unify selection flags
[media] v4l: Common documentation for selection targets
[media] v4l: Unify selection targets across V4L2 and V4L2 subdev interfaces
[media] v4l: Remove "_ACTUAL" from subdev selection API target definition names
[media] V4L: Remove "_ACTIVE" from the selection target name definitions
[media] media: dvb-usb: print mac address via native %pM
[media] s5p-tv: Use module_i2c_driver in sii9234_drv.c file
[media] media: gpio-ir-recv: add allowed_protos for platform data
[media] s5p-jpeg: Use module_platform_driver in jpeg-core.c file
[media] saa7134: fix spelling of detach in label
[media] cx88-blackbird: replace ioctl by unlocked_ioctl
[media] cx88: don't use current_norm
[media] cx88: fix a number of v4l2-compliance violations
...
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 26488aa893d5..2efa56c5ff2c 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1312,6 +1312,37 @@ module_exit(i2c_exit); | |||
1312 | */ | 1312 | */ |
1313 | 1313 | ||
1314 | /** | 1314 | /** |
1315 | * __i2c_transfer - unlocked flavor of i2c_transfer | ||
1316 | * @adap: Handle to I2C bus | ||
1317 | * @msgs: One or more messages to execute before STOP is issued to | ||
1318 | * terminate the operation; each message begins with a START. | ||
1319 | * @num: Number of messages to be executed. | ||
1320 | * | ||
1321 | * Returns negative errno, else the number of messages executed. | ||
1322 | * | ||
1323 | * Adapter lock must be held when calling this function. No debug logging | ||
1324 | * takes place. adap->algo->master_xfer existence isn't checked. | ||
1325 | */ | ||
1326 | int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | ||
1327 | { | ||
1328 | unsigned long orig_jiffies; | ||
1329 | int ret, try; | ||
1330 | |||
1331 | /* Retry automatically on arbitration loss */ | ||
1332 | orig_jiffies = jiffies; | ||
1333 | for (ret = 0, try = 0; try <= adap->retries; try++) { | ||
1334 | ret = adap->algo->master_xfer(adap, msgs, num); | ||
1335 | if (ret != -EAGAIN) | ||
1336 | break; | ||
1337 | if (time_after(jiffies, orig_jiffies + adap->timeout)) | ||
1338 | break; | ||
1339 | } | ||
1340 | |||
1341 | return ret; | ||
1342 | } | ||
1343 | EXPORT_SYMBOL(__i2c_transfer); | ||
1344 | |||
1345 | /** | ||
1315 | * i2c_transfer - execute a single or combined I2C message | 1346 | * i2c_transfer - execute a single or combined I2C message |
1316 | * @adap: Handle to I2C bus | 1347 | * @adap: Handle to I2C bus |
1317 | * @msgs: One or more messages to execute before STOP is issued to | 1348 | * @msgs: One or more messages to execute before STOP is issued to |
@@ -1325,8 +1356,7 @@ module_exit(i2c_exit); | |||
1325 | */ | 1356 | */ |
1326 | int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | 1357 | int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
1327 | { | 1358 | { |
1328 | unsigned long orig_jiffies; | 1359 | int ret; |
1329 | int ret, try; | ||
1330 | 1360 | ||
1331 | /* REVISIT the fault reporting model here is weak: | 1361 | /* REVISIT the fault reporting model here is weak: |
1332 | * | 1362 | * |
@@ -1364,15 +1394,7 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
1364 | i2c_lock_adapter(adap); | 1394 | i2c_lock_adapter(adap); |
1365 | } | 1395 | } |
1366 | 1396 | ||
1367 | /* Retry automatically on arbitration loss */ | 1397 | ret = __i2c_transfer(adap, msgs, num); |
1368 | orig_jiffies = jiffies; | ||
1369 | for (ret = 0, try = 0; try <= adap->retries; try++) { | ||
1370 | ret = adap->algo->master_xfer(adap, msgs, num); | ||
1371 | if (ret != -EAGAIN) | ||
1372 | break; | ||
1373 | if (time_after(jiffies, orig_jiffies + adap->timeout)) | ||
1374 | break; | ||
1375 | } | ||
1376 | i2c_unlock_adapter(adap); | 1398 | i2c_unlock_adapter(adap); |
1377 | 1399 | ||
1378 | return ret; | 1400 | return ret; |