i2c: Make sure i2c_algo_bit_data.timeout is HZ-independent
Subsystems (2)
PATCH 1/1 i2c: Make sure i2c_algo_bit_data.timeout is HZ-independent
i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers should use set this value in terms of HZ.
Ultimately I think this field should be discarded in favor of i2c_adapter.timeout, but that's left for a future patch.
--- drivers/i2c/busses/i2c-acorn.c | 2 +- drivers/i2c/busses/i2c-ixp2000.c | 2 +- drivers/i2c/busses/scx200_i2c.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/scx200_i2c.c +1 -1
@@ -76,7 +76,7 @@ static struct i2c_algo_bit_data scx200_i .getsda = scx200_i2c_getsda, .getscl = scx200_i2c_getscl, .udelay = 10, - .timeout = 100, + .timeout = HZ, };static struct i2c_adapter scx200_i2c_ops = {
drivers/i2c/busses/i2c-acorn.c +1 -1
@@ -79,7 +79,7 @@ static struct i2c_algo_bit_data ioc_data .getsda = ioc_getsda, .getscl = ioc_getscl, .udelay = 80, - .timeout = 100 + .timeout = HZ, };static struct i2c_adapter ioc_ops = {
drivers/i2c/busses/i2c-ixp2000.c +1 -1
@@ -114,7 +114,7 @@ static int ixp2000_i2c_probe(struct plat drv_data->algo_data.getsda = ixp2000_bit_getsda; drv_data->algo_data.getscl = ixp2000_bit_getscl; drv_data->algo_data.udelay =6 ; - drv_data->algo_data.timeout =100 ; + drv_data->algo_data.timeout =HZ ;strlcpy (drv_data->adapter.name, plat_dev->dev.driver->name,sizeof (drv_data->adapter.name));
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Lennert Buytenhek
Acked-byQuoted 10 lines · Jean Delvare
i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers should use set this value in terms of HZ.
Ultimately I think this field should be discarded in favor of i2c_adapter.timeout, but that's left for a future patch.
Signed-off-by Jean Delvare <[email protected]>Cc Russell King <rmk+kernel-lFZ/[email protected]>Cc Lennert Buytenhek <kernel-OLH4Qvv75CYX/[email protected]>Cc Len Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/[email protected]>
Quoted 5 lines
--- drivers/i2c/busses/i2c-acorn.c | 2 +- drivers/i2c/busses/i2c-ixp2000.c | 2 +- drivers/i2c/busses/scx200_i2c.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
For the drivers/i2c/busses/i2c-ixp2000.c part:
Thanks.
Russell King
Acked-byQuoted 7 lines · Jean Delvare
i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers should use set this value in terms of HZ.
Ultimately I think this field should be discarded in favor of i2c_adapter.timeout, but that's left for a future patch.
Signed-off-by Jean Delvare <[email protected]>
Thanks.
Quoted 45 lines
Cc Lennert Buytenhek <kernel-OLH4Qvv75CYX/[email protected]>Cc Len Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/[email protected]>--- drivers/i2c/busses/i2c-acorn.c | 2 +- drivers/i2c/busses/i2c-ixp2000.c | 2 +- drivers/i2c/busses/scx200_i2c.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/i2c/busses/scx200_i2c.c +1
-1@@ -76,7 +76,7 @@ static struct i2c_algo_bit_data scx200_i .getsda = scx200_i2c_getsda, .getscl = scx200_i2c_getscl, .udelay = 10, - .timeout = 100, + .timeout = HZ, };static struct i2c_adapter scx200_i2c_ops = {drivers/i2c/busses/i2c-acorn.c +1
-1@@ -79,7 +79,7 @@ static struct i2c_algo_bit_data ioc_data .getsda = ioc_getsda, .getscl = ioc_getscl, .udelay = 80, - .timeout = 100 + .timeout = HZ, };static struct i2c_adapter ioc_ops = {drivers/i2c/busses/i2c-ixp2000.c +1
-1@@ -114,7 +114,7 @@ static int ixp2000_i2c_probe(struct plat drv_data->algo_data.getsda = ixp2000_bit_getsda; drv_data->algo_data.getscl = ixp2000_bit_getscl; drv_data->algo_data.udelay =6 ; - drv_data->algo_data.timeout =100 ; + drv_data->algo_data.timeout =HZ ;strlcpy (drv_data->adapter.name, plat_dev->dev.driver->name,sizeof (drv_data->adapter.name));Signature · 2 lines
-- Jean Delvare
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 19 lines · Jean Delvare
i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers should use set this value in terms of HZ.
Ultimately I think this field should be discarded in favor of i2c_adapter.timeout, but that's left for a future patch.
Signed-off-by Jean Delvare <[email protected]>Cc Russell King <rmk+kernel-lFZ/[email protected]>Cc Lennert Buytenhek <kernel-OLH4Qvv75CYX/[email protected]>Cc Len Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/[email protected]>--- drivers/i2c/busses/i2c-acorn.c | 2 +- drivers/i2c/busses/i2c-ixp2000.c | 2 +- drivers/i2c/busses/scx200_i2c.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/scx200_i2c.c static struct i2c_algo_bit_data scx200_i · line 80
Quoted 6 lines
drivers/i2c/busses/scx200_i2c.c +1
-1@@ -76,7 +76,7 @@ static struct i2c_algo_bit_data scx200_i .getsda = scx200_i2c_getsda, .getscl = scx200_i2c_getscl, .udelay = 10, - .timeout = 100, + .timeout = HZ, };
OK. Well I know the driver has worked for me with both HZ=100 and now HZ=1000, so making it consistent sounds good to me. I think a lot of people thought it was in microseconds or miliseconds.
Signature · 1 line
Len Sorensen
A message that is not in the archive (sent off-list or not yet received): 20090223150012.GD23244-1wCw9BSqJbv44Nm34jS7GywD8/[email protected]
Quoted 17 lines · Lennart Sorensen
Quoted 16 lines · Jean Delvare
i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers should use set this value in terms of HZ.
Ultimately I think this field should be discarded in favor of i2c_adapter.timeout, but that's left for a future patch.
Signed-off-by Jean Delvare <[email protected]>Cc Russell King <rmk+kernel-lFZ/[email protected]>Cc Lennert Buytenhek <kernel-OLH4Qvv75CYX/[email protected]>Cc Len Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/[email protected]>--- drivers/i2c/busses/i2c-acorn.c | 2 +- drivers/i2c/busses/i2c-ixp2000.c | 2 +- drivers/i2c/busses/scx200_i2c.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 13 lines
drivers/i2c/busses/scx200_i2c.c static struct i2c_algo_bit_data scx200_i · line 80
Quoted 9 lines
drivers/i2c/busses/scx200_i2c.c +1
-1@@ -76,7 +76,7 @@ static struct i2c_algo_bit_data scx200_i .getsda = scx200_i2c_getsda, .getscl = scx200_i2c_getscl, .udelay = 10, - .timeout = 100, + .timeout = HZ, };OK. Well I know the driver has worked for me with both HZ=100 and now HZ=1000, so making it consistent sounds good to me. I think a lot of people thought it was in microseconds or miliseconds.
It was clarified in i2c-algo-bit.h in kernel version 2.5.54, that's quite a while ago. The problem is that i2c-algo-bit.c itself had it wrong.
At HZ=1000, 100 jiffies is 100 ms, that's already a reasonably long timeout. And not that many slaves actually stretch the I2C clock.
Signature · 1 line
Jean Delvare