diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-07-12 14:12:29 +0200 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-07-12 14:12:29 +0200 |
commit | 4b2643d7d9bdcd776749e17f73c168ddf02e93cb (patch) | |
tree | 1642900ea1c196cc27d120f0af4de44fff30633e /Documentation/i2c/chips | |
parent | ba7fbb723f50ab2607989a282af655fb0fab0492 (diff) | |
download | linux-3.10-4b2643d7d9bdcd776749e17f73c168ddf02e93cb.tar.gz linux-3.10-4b2643d7d9bdcd776749e17f73c168ddf02e93cb.tar.bz2 linux-3.10-4b2643d7d9bdcd776749e17f73c168ddf02e93cb.zip |
i2c: Fix the i2c_smbus_read_i2c_block_data() prototype
Let the drivers specify how many bytes they want to read with
i2c_smbus_read_i2c_block_data(). So far, the block count was
hard-coded to I2C_SMBUS_BLOCK_MAX (32), which did not make much sense.
Many driver authors complained about this before, and I believe it's
about time to fix it. Right now, authors have to do technically stupid
things, such as individual byte reads or full-fledged I2C messaging,
to work around the problem. We do not want to encourage that.
I even found that some bus drivers (e.g. i2c-amd8111) already
implemented I2C block read the "right" way, that is, they didn't
follow the old, broken standard. The fact that it was never noticed
before just shows how little i2c_smbus_read_i2c_block_data() was used,
which isn't that surprising given how broken its prototype was so far.
There are some obvious compatiblity considerations:
* This changes the i2c_smbus_read_i2c_block_data() prototype. Users
outside the kernel tree will notice at compilation time, and will
have to update their code.
* User-space has access to i2c_smbus_xfer() directly using i2c-dev, so
the changed expectations would affect tools such as i2cdump. In order
to preserve binary compatibility, we give I2C_SMBUS_I2C_BLOCK_DATA
a new numeric value, and define I2C_SMBUS_I2C_BLOCK_BROKEN with the
old numeric value. When i2c-dev receives a transaction with the
old value, it can convert it to the new format on the fly.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'Documentation/i2c/chips')
-rw-r--r-- | Documentation/i2c/chips/max6875 | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Documentation/i2c/chips/max6875 b/Documentation/i2c/chips/max6875 index 96fec562a8e..a0cd8af2f40 100644 --- a/Documentation/i2c/chips/max6875 +++ b/Documentation/i2c/chips/max6875 @@ -99,7 +99,7 @@ And then read the data or - count = i2c_smbus_read_i2c_block_data(fd, 0x84, buffer); + count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer); The block read should read 16 bytes. 0x84 is the block read command. |