i2c: smbus: add unlocked __i2c_smbus_xfer variant
authorPeter Rosin <peda@axentia.se>
Wed, 20 Jun 2018 08:51:53 +0000 (10:51 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 20 Jul 2018 21:51:37 +0000 (23:51 +0200)
commiteef5ba1aa148ca5e6deb1e0aa1de797fa4e12cb7
tree761daeacbe94170a1438066f24fea11f1ac5c0d1
parent021c91791a5e7e85c567452f1be3e4c2c6cb6063
i2c: smbus: add unlocked __i2c_smbus_xfer variant

Removes all locking from i2c_smbus_xfer and renames it to __i2c_smbus_xfer,
then adds a new i2c_smbus_xfer function that simply grabs the lock while
calling the unlocked variant.

This is not perfectly equivalent, since i2c_smbus_xfer was callable from
atomic/irq context if you happened to end up emulating SMBus with an I2C
transfer, and that is no longer the case with this patch. It is unknown
(to me) if anything depends on that quirk, but it seems fragile enough to
simply break those cases and require them to call i2c_transfer directly
instead.

While at it, for consistency rename the 2nd to last argument (size) of
the i2c_smbus_xfer declaration to protocol and remove the surplus extern
marker.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core-smbus.c
include/linux/i2c.h