Skip to content

Commit c030a41

Browse files
fengwei0328Andi Shyti
authored andcommitted
i2c: mlxbf: Use str_read_write() helper
Remove hard-coded strings by using the str_read_write() helper. Signed-off-by: Feng Wei <feng.wei8@zte.com.cn> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Link: https://lore.kernel.org/r/20250401192603311H5OxuFmUSbPc4VnQQkhZr@zte.com.cn Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent 8ae92c6 commit c030a41

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/i2c/busses/i2c-mlxbf.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/of.h>
2020
#include <linux/platform_device.h>
2121
#include <linux/string.h>
22+
#include <linux/string_choices.h>
2223

2324
/* Defines what functionality is present. */
2425
#define MLXBF_I2C_FUNC_SMBUS_BLOCK \
@@ -2038,37 +2039,37 @@ static s32 mlxbf_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
20382039
read ? &data->byte : &command, read,
20392040
pec);
20402041
dev_dbg(&adap->dev, "smbus %s byte, slave 0x%02x.\n",
2041-
read ? "read" : "write", addr);
2042+
str_read_write(read), addr);
20422043
break;
20432044

20442045
case I2C_SMBUS_BYTE_DATA:
20452046
mlxbf_i2c_smbus_data_byte_func(&request, &command, &data->byte,
20462047
read, pec);
20472048
dev_dbg(&adap->dev, "smbus %s byte data at 0x%02x, slave 0x%02x.\n",
2048-
read ? "read" : "write", command, addr);
2049+
str_read_write(read), command, addr);
20492050
break;
20502051

20512052
case I2C_SMBUS_WORD_DATA:
20522053
mlxbf_i2c_smbus_data_word_func(&request, &command,
20532054
(u8 *)&data->word, read, pec);
20542055
dev_dbg(&adap->dev, "smbus %s word data at 0x%02x, slave 0x%02x.\n",
2055-
read ? "read" : "write", command, addr);
2056+
str_read_write(read), command, addr);
20562057
break;
20572058

20582059
case I2C_SMBUS_I2C_BLOCK_DATA:
20592060
byte_cnt = data->block[0];
20602061
mlxbf_i2c_smbus_i2c_block_func(&request, &command, data->block,
20612062
&byte_cnt, read, pec);
20622063
dev_dbg(&adap->dev, "i2c %s block data, %d bytes at 0x%02x, slave 0x%02x.\n",
2063-
read ? "read" : "write", byte_cnt, command, addr);
2064+
str_read_write(read), byte_cnt, command, addr);
20642065
break;
20652066

20662067
case I2C_SMBUS_BLOCK_DATA:
20672068
byte_cnt = read ? I2C_SMBUS_BLOCK_MAX : data->block[0];
20682069
mlxbf_i2c_smbus_block_func(&request, &command, data->block,
20692070
&byte_cnt, read, pec);
20702071
dev_dbg(&adap->dev, "smbus %s block data, %d bytes at 0x%02x, slave 0x%02x.\n",
2071-
read ? "read" : "write", byte_cnt, command, addr);
2072+
str_read_write(read), byte_cnt, command, addr);
20722073
break;
20732074

20742075
case I2C_FUNC_SMBUS_PROC_CALL:

0 commit comments

Comments
 (0)