Skip to content

Commit

Permalink
i2c-gpio: Fix adapter number
Browse files Browse the repository at this point in the history
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@users.sourceforge.net>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
David Brownell authored and Jean Delvare committed Sep 9, 2007
1 parent b21010e commit 9a3180e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
* 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;
Expand Down

0 comments on commit 9a3180e

Please sign in to comment.