[i2c] [PATCH] i2c-pca9539: fix force option
Jean Delvare
khali at linux-fr.org
Thu Jun 29 22:51:55 CEST 2006
Hi Ben,
> The pca9539 driver doesn't honor the force parameter; it always does detection.
> This patch will skip detection if forced.
> --- linux-2.6.17-mm3.orig/drivers/i2c/chips/pca9539.c
> +++ linux-2.6.17-mm3/drivers/i2c/chips/pca9539.c
> @@ -134,11 +134,14 @@ static int pca9539_detect(struct i2c_ada
> new_client->driver = &pca9539_driver;
> new_client->flags = 0;
>
> - /* Detection: the pca9539 only has 8 registers (0-7).
> - A read of 7 should succeed, but a read of 8 should fail. */
> - if ((i2c_smbus_read_byte_data(new_client, 7) < 0) ||
> - (i2c_smbus_read_byte_data(new_client, 8) >= 0))
> - goto exit_kfree;
> + if (kind < 0)
> + {
Coding style, Ben!
> + /* Detection: the pca9539 only has 8 registers (0-7).
> + A read of 7 should succeed, but a read of 8 should fail. */
> + if ((i2c_smbus_read_byte_data(new_client, 7) < 0) ||
> + (i2c_smbus_read_byte_data(new_client, 8) >= 0))
> + goto exit_kfree;
> + }
>
> strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE);
Anyway, applied. I guess you had a need for this parameter? If so,
maybe the detection routine should be improved so that you no more need
to skip it?
Thanks,
--
Jean Delvare
More information about the i2c
mailing list