kernel: update kernel 4.4 to 4.4.52
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.9 / 0112-i2c-bcm2835-Support-i2c-dev-ioctl-I2C_TIMEOUT.patch
1 From d42e4206e0e273b195881614a317688830fc56a2 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Fri, 23 Sep 2016 04:57:17 +0200
4 Subject: [PATCH] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Use i2c_adapter->timeout for the completion timeout value. The core
10 default is 1 second.
11
12 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
13 Reviewed-by: Eric Anholt <eric@anholt.net>
14 ---
15 drivers/i2c/busses/i2c-bcm2835.c | 4 +---
16 1 file changed, 1 insertion(+), 3 deletions(-)
17
18 --- a/drivers/i2c/busses/i2c-bcm2835.c
19 +++ b/drivers/i2c/busses/i2c-bcm2835.c
20 @@ -53,8 +53,6 @@
21 #define BCM2835_I2C_CDIV_MIN 0x0002
22 #define BCM2835_I2C_CDIV_MAX 0xFFFE
23
24 -#define BCM2835_I2C_TIMEOUT (msecs_to_jiffies(1000))
25 -
26 struct bcm2835_i2c_dev {
27 struct device *dev;
28 void __iomem *regs;
29 @@ -242,7 +240,7 @@ static int bcm2835_i2c_xfer(struct i2c_a
30 bcm2835_i2c_start_transfer(i2c_dev);
31
32 time_left = wait_for_completion_timeout(&i2c_dev->completion,
33 - BCM2835_I2C_TIMEOUT);
34 + adap->timeout);
35 if (!time_left) {
36 bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C,
37 BCM2835_I2C_C_CLEAR);