diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-10-07 18:15:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 17:02:10 -0400 |
commit | 30dac7469741906436b50f9413dccd446366d371 (patch) | |
tree | b5285192cd8b4274781d2dabd3bf89ceefadba82 | |
parent | d3554b4a2fb0e2229eb0d3fa9ece5b2f0b906d3e (diff) |
[PATCH] i2c: Drop I2C_SMBUS_I2C_BLOCK_MAX
Drop I2C_SMBUS_I2C_BLOCK_MAX, use I2C_SMBUS_BLOCK_MAX instead.
I2C_SMBUS_I2C_BLOCK_MAX has always been defined to the same value as
I2C_SMBUS_BLOCK_MAX, and this will never change: setting it to a lower
value would make no sense, setting it to a higher value would break
i2c_smbus_data compatibility. There is no point in changing
i2c_smbus_data to support larger block transactions in SMBus mode, as
no SMBus hardware supports more than 32 byte blocks. Thus, for larger
transactions, direct I2C transfers are the way to go.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/i2c/chips/eeprom.c | 4 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 8 | ||||
-rw-r--r-- | include/linux/i2c.h | 1 |
3 files changed, 6 insertions, 7 deletions
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index d58403a47908..7fb739c43935 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -88,8 +88,8 @@ static void eeprom_update_client(struct i2c_client *client, u8 slice) | |||
88 | dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); | 88 | dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); |
89 | 89 | ||
90 | if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { | 90 | if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { |
91 | for (i = slice << 5; i < (slice + 1) << 5; i += I2C_SMBUS_I2C_BLOCK_MAX) | 91 | for (i = slice << 5; i < (slice + 1) << 5; i += I2C_SMBUS_BLOCK_MAX) |
92 | if (i2c_smbus_read_i2c_block_data(client, i, data->data + i) != I2C_SMBUS_I2C_BLOCK_MAX) | 92 | if (i2c_smbus_read_i2c_block_data(client, i, data->data + i) != I2C_SMBUS_BLOCK_MAX) |
93 | goto exit; | 93 | goto exit; |
94 | } else { | 94 | } else { |
95 | if (i2c_smbus_write_byte(client, slice << 5)) { | 95 | if (i2c_smbus_write_byte(client, slice << 5)) { |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 9583a54ce16b..15354176ff63 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1108,10 +1108,10 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1108 | return -1; | 1108 | return -1; |
1109 | case I2C_SMBUS_I2C_BLOCK_DATA: | 1109 | case I2C_SMBUS_I2C_BLOCK_DATA: |
1110 | if (read_write == I2C_SMBUS_READ) { | 1110 | if (read_write == I2C_SMBUS_READ) { |
1111 | msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; | 1111 | msg[1].len = I2C_SMBUS_BLOCK_MAX; |
1112 | } else { | 1112 | } else { |
1113 | msg[0].len = data->block[0] + 1; | 1113 | msg[0].len = data->block[0] + 1; |
1114 | if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { | 1114 | if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 1) { |
1115 | dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " | 1115 | dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " |
1116 | "invalid block write size (%d)\n", | 1116 | "invalid block write size (%d)\n", |
1117 | data->block[0]); | 1117 | data->block[0]); |
@@ -1144,8 +1144,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1144 | break; | 1144 | break; |
1145 | case I2C_SMBUS_I2C_BLOCK_DATA: | 1145 | case I2C_SMBUS_I2C_BLOCK_DATA: |
1146 | /* fixed at 32 for now */ | 1146 | /* fixed at 32 for now */ |
1147 | data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; | 1147 | data->block[0] = I2C_SMBUS_BLOCK_MAX; |
1148 | for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) | 1148 | for (i = 0; i < I2C_SMBUS_BLOCK_MAX; i++) |
1149 | data->block[i+1] = msgbuf1[i]; | 1149 | data->block[i+1] = msgbuf1[i]; |
1150 | break; | 1150 | break; |
1151 | } | 1151 | } |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 74103d0a8cd2..64c13c042f9d 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -448,7 +448,6 @@ struct i2c_msg { | |||
448 | * Data for SMBus Messages | 448 | * Data for SMBus Messages |
449 | */ | 449 | */ |
450 | #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ | 450 | #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ |
451 | #define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */ | ||
452 | union i2c_smbus_data { | 451 | union i2c_smbus_data { |
453 | __u8 byte; | 452 | __u8 byte; |
454 | __u16 word; | 453 | __u16 word; |