Skip to content

Commit 1bddab7

Browse files
jdelvareJean Delvare
authored and
Jean Delvare
committed
i2c-algo-bit: Let user test buses without failing
Always failing to register I2C buses when the line testing fails is a little harsh. While such a failure is definitely a bug in the driver that exposes the affected I2C bus, things may still work fine if the missing initialization steps are done later, before the I2C bus is used. So it seems a better debugging tool to just report the test failure by default. I introduce bit_test=2 if anyone really misses the original behavior of bit_test=1. Signed-off-by: Jean Delvare <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
1 parent 6fcf84a commit 1bddab7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/i2c/algos/i2c-algo-bit.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
/* ----- global variables --------------------------------------------- */
4848

4949
static int bit_test; /* see if the line-setting functions work */
50-
module_param(bit_test, bool, 0);
51-
MODULE_PARM_DESC(bit_test, "Test the lines of the bus to see if it is stuck");
50+
module_param(bit_test, int, S_IRUGO);
51+
MODULE_PARM_DESC(bit_test, "lines testing - 0 off; 1 report; 2 fail if stuck");
5252

5353
#ifdef DEBUG
5454
static int i2c_debug = 1;
@@ -624,7 +624,7 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap,
624624

625625
if (bit_test) {
626626
ret = test_bus(adap);
627-
if (ret < 0)
627+
if (bit_test >= 2 && ret < 0)
628628
return -ENODEV;
629629
}
630630

0 commit comments

Comments
 (0)