lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 13 Oct 2010 16:45:09 +0300
From:	Samu Onkalo <samu.p.onkalo@...ia.com>
To:	khali@...ux-fr.org, tony@...mide.com
Cc:	linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] drivers: i2c-core: Add a flag to allow short timeout

A flag for i2c-messages to allow short time out. Some chips causes
time out always with certain kind of operations (like sw-reset commands).
There is no point of waiting full timeout in that case.
When I2C message is send with I2C_M_SHORT_TIME out flag, adapter is allowed
to use shorter timeout and release the bus faster.

Signed-off-by: Samu Onkalo <samu.p.onkalo@...ia.com>
---
 drivers/i2c/i2c-core.c |    2 +-
 include/linux/i2c.h    |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6649176..8c0e443 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -2077,7 +2077,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags,
 	int try;
 	s32 res;
 
-	flags &= I2C_M_TEN | I2C_CLIENT_PEC;
+	flags &= I2C_M_TEN | I2C_CLIENT_PEC | I2C_M_SHORT_TIMEOUT;
 
 	if (adapter->algo->smbus_xfer) {
 		i2c_lock_adapter(adapter);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 4bae0b7..5fc016a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -514,6 +514,7 @@ struct i2c_msg {
 #define I2C_M_IGNORE_NAK	0x1000	/* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_NO_RD_ACK		0x0800	/* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_RECV_LEN		0x0400	/* length will be first received byte */
+#define I2C_M_SHORT_TIMEOUT	0x0200	/* Use with known timeout cases */
 	__u16 len;		/* msg length				*/
 	__u8 *buf;		/* pointer to msg data			*/
 };
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ