aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/chips/eeprom.c4
-rw-r--r--drivers/i2c/i2c-core.c8
-rw-r--r--include/linux/i2c.h1
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 */
452union i2c_smbus_data { 451union i2c_smbus_data {
453 __u8 byte; 452 __u8 byte;
454 __u16 word; 453 __u16 word;