[i2c] [patch 2.6.23-rc5 1/2] i2c-gpio bugfix

David Brownell david-b at pacbell.net
Wed Sep 5 18:28:29 CEST 2007


It turns out that platform_device.id is a "u32" so testing it for being
nonnegative is useless when setting up an i2c bitbang device.  Instead,
do what the platform_bus code does and test it against the value "-1". 

Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>

---
This resolves a bug in a patch merged earlier in the 2.6.23 series.

 drivers/i2c/busses/i2c-gpio.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- at91.orig/drivers/i2c/busses/i2c-gpio.c	2007-09-05 09:08:38.000000000 -0700
+++ at91/drivers/i2c/busses/i2c-gpio.c	2007-09-05 09:08:41.000000000 -0700
@@ -147,7 +147,7 @@ static int __init i2c_gpio_probe(struct 
 	 * The reason to do so is to avoid sysfs names that only make
 	 * sense when there are multiple adapters.
 	 */
-	adap->nr = pdev->id >= 0 ? pdev->id : 0;
+	adap->nr = (pdev->id != -1) ? pdev->id : 0;
 	ret = i2c_bit_add_numbered_bus(adap);
 	if (ret)
 		goto err_add_bus;



More information about the i2c mailing list