[linux] 04/04: [x86] i2c: i801: Use wait_event_timeout to wait for interrupts (Closes: #799786)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Tue Sep 22 19:19:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch jessie
in repository linux.

commit b6915c19a3c86d16452f405341cf15e1765c4fbd
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Tue Sep 22 21:18:56 2015 +0200

    [x86] i2c: i801: Use wait_event_timeout to wait for interrupts (Closes: #799786)
---
 debian/changelog                                   |  2 +
 ...e-wait_event_timeout-to-wait-for-interrup.patch | 85 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 88 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2b769f4..4dcbe38 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -716,6 +716,8 @@ linux (3.16.7-ckt17-1) UNRELEASED; urgency=medium
   * [armel,sh4] linux-image: Recommend u-boot-tools rather than the obsolete
     uboot-mkimage package (Closes: #793608)
   * linux-source: Depend on xz-utils, not bzip2 (Closes: #796940)
+  * [x86] i2c: i801: Use wait_event_timeout to wait for interrupts
+    (Closes: #799786)
 
   [ Ian Campbell ]
   * [xen] xen-netback: return correct ethtool stats (Closes: #786936)
diff --git a/debian/patches/bugfix/x86/i2c-i801-Use-wait_event_timeout-to-wait-for-interrup.patch b/debian/patches/bugfix/x86/i2c-i801-Use-wait_event_timeout-to-wait-for-interrup.patch
new file mode 100644
index 0000000..b3366d8
--- /dev/null
+++ b/debian/patches/bugfix/x86/i2c-i801-Use-wait_event_timeout-to-wait-for-interrup.patch
@@ -0,0 +1,85 @@
+From: Jean Delvare <jdelvare at suse.de>
+Date: Wed, 12 Nov 2014 10:20:40 +0100
+Subject: i2c: i801: Use wait_event_timeout to wait for interrupts
+Origin: https://git.kernel.org/linus/b3b8df97723d84c826d7419bf727a711a4efa068
+Bug-Debian: https://bugs.debian.org/799786
+
+Some systems have been reported to have trouble with interrupts. Use
+wait_event_timeout() instead of wait_event() so we don't get stuck in
+that case, and log the problem.
+
+Signed-off-by: Jean Delvare <jdelvare at suse.de>
+Signed-off-by: Wolfram Sang <wsa at the-dreams.de>
+---
+ drivers/i2c/busses/i2c-i801.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-i801.c
++++ b/drivers/i2c/busses/i2c-i801.c
+@@ -2,7 +2,7 @@
+     Copyright (c) 1998 - 2002  Frodo Looijaard <frodol at dds.nl>,
+     Philip Edelbrock <phil at netroedge.com>, and Mark D. Studebaker
+     <mdsxyz123 at yahoo.com>
+-    Copyright (C) 2007 - 2012  Jean Delvare <jdelvare at suse.de>
++    Copyright (C) 2007 - 2014  Jean Delvare <jdelvare at suse.de>
+     Copyright (C) 2010         Intel Corporation,
+                                David Woodhouse <dwmw2 at infradead.org>
+ 
+@@ -370,6 +370,7 @@ static int i801_transaction(struct i801_
+ {
+ 	int status;
+ 	int result;
++	const struct i2c_adapter *adap = &priv->adapter;
+ 
+ 	result = i801_check_pre(priv);
+ 	if (result < 0)
+@@ -378,7 +379,14 @@ static int i801_transaction(struct i801_
+ 	if (priv->features & FEATURE_IRQ) {
+ 		outb_p(xact | SMBHSTCNT_INTREN | SMBHSTCNT_START,
+ 		       SMBHSTCNT(priv));
+-		wait_event(priv->waitq, (status = priv->status));
++		result = wait_event_timeout(priv->waitq,
++					    (status = priv->status),
++					    adap->timeout);
++		if (!result) {
++			status = -ETIMEDOUT;
++			dev_warn(&priv->pci_dev->dev,
++				 "Timeout waiting for interrupt!\n");
++		}
+ 		priv->status = 0;
+ 		return i801_check_post(priv, status);
+ 	}
+@@ -526,6 +534,7 @@ static int i801_block_transaction_byte_b
+ 	int smbcmd;
+ 	int status;
+ 	int result;
++	const struct i2c_adapter *adap = &priv->adapter;
+ 
+ 	result = i801_check_pre(priv);
+ 	if (result < 0)
+@@ -554,7 +563,14 @@ static int i801_block_transaction_byte_b
+ 		priv->data = &data->block[1];
+ 
+ 		outb_p(priv->cmd | SMBHSTCNT_START, SMBHSTCNT(priv));
+-		wait_event(priv->waitq, (status = priv->status));
++		result = wait_event_timeout(priv->waitq,
++					    (status = priv->status),
++					    adap->timeout);
++		if (!result) {
++			status = -ETIMEDOUT;
++			dev_warn(&priv->pci_dev->dev,
++				 "Timeout waiting for interrupt!\n");
++		}
+ 		priv->status = 0;
+ 		return i801_check_post(priv, status);
+ 	}
+@@ -1208,6 +1224,9 @@ static int i801_probe(struct pci_dev *de
+ 		outb_p(inb_p(SMBAUXCTL(priv)) &
+ 		       ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), SMBAUXCTL(priv));
+ 
++	/* Default timeout in interrupt mode: 200 ms */
++	priv->adapter.timeout = HZ / 5;
++
+ 	if (priv->features & FEATURE_IRQ) {
+ 		init_waitqueue_head(&priv->waitq);
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 0a440de..4de3e82 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -636,3 +636,4 @@ bugfix/all/rds-verify-the-underlying-transport-exists-before-cr.patch
 bugfix/all/namei-lift-open-coded-terminate_walk-in-follow_dotdo.patch
 bugfix/all/dcache-handle-escaped-paths-in-prepend_path.patch
 bugfix/all/vfs-test-for-and-handle-paths-that-are-unreachable-f.patch
+bugfix/x86/i2c-i801-Use-wait_event_timeout-to-wait-for-interrup.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list