Skip to contentSkip to conversation

I2C: *write_block* doesn't modify the data - mark as const

PATCH In review Krzysztof Halasa 2 participants 2 messages Jun 6, 2006 I2C

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 I2C: *write_block* doesn't modify the data - mark as const

The attached patch marks i2c_smbus_write_block_data() and i2c_smbus_write_i2c_block_data() buffers as const.

Signed-off-by Krzysztof Halasa <khc at pm.waw.pl>
drivers/i2c/i2c-core.c +2 -2
@@ -916,6 +916,6 @@ s32 i2c_smbus_write_word_data(struct i2c
 }
 
 s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
-			       u8 length, u8 *values)
+			       u8 length, const u8 *values)
 {
 	union i2c_smbus_data data;
@@ -947,7 +947,7 @@ s32 i2c_smbus_read_i2c_block_data(struct
 }
 
 s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,
-				   u8 length, u8 *values)
+				   u8 length, const u8 *values)
 {
 	union i2c_smbus_data data;
 
include/linux/i2c.h +3 -4
@@ -94,15 +94,14 @@ extern s32 i2c_smbus_write_byte_data(str
 extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
 extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
                                      u8 command, u16 value);
-extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
-				      u8 command, u8 length,
-				      u8 *values);
+extern s32 i2c_smbus_write_block_data(struct i2c_client * client, u8 command,
+				      u8 length, const u8 *values);
 /* Returns the number of read bytes */
 extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
 					 u8 command, u8 *values);
 extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
 					  u8 command, u8 length,
-					  u8 *values);
+					  const u8 *values);
 
 /*
  * A driver is capable of handling one or more physical devices present on
#1 lore raw

Hi Krzysztof,

Quoted 4 lines

The attached patch marks i2c_smbus_write_block_data() and i2c_smbus_write_i2c_block_data() buffers as const.

Signed-off-by Krzysztof Halasa <khc at pm.waw.pl>

That's right. Applied, thanks.

Signature · 1 line
Jean Delvare