]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: mlxbf: Use str_read_write() helper
authorFeng Wei <feng.wei8@zte.com.cn>
Tue, 1 Apr 2025 11:26:03 +0000 (19:26 +0800)
committerAndi Shyti <andi@smida.it>
Mon, 19 May 2025 20:23:58 +0000 (22:23 +0200)
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>
drivers/i2c/busses/i2c-mlxbf.c

index 280dde53d7f3b655088bafb2b8baa754c1cd338c..2e8291e9632309fad5ddc6b8093215b522f5eb8c 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
+#include <linux/string_choices.h>
 
 /* Defines what functionality is present. */
 #define MLXBF_I2C_FUNC_SMBUS_BLOCK \
@@ -2038,21 +2039,21 @@ static s32 mlxbf_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
                                          read ? &data->byte : &command, read,
                                          pec);
                dev_dbg(&adap->dev, "smbus %s byte, slave 0x%02x.\n",
-                       read ? "read" : "write", addr);
+                       str_read_write(read), addr);
                break;
 
        case I2C_SMBUS_BYTE_DATA:
                mlxbf_i2c_smbus_data_byte_func(&request, &command, &data->byte,
                                               read, pec);
                dev_dbg(&adap->dev, "smbus %s byte data at 0x%02x, slave 0x%02x.\n",
-                       read ? "read" : "write", command, addr);
+                       str_read_write(read), command, addr);
                break;
 
        case I2C_SMBUS_WORD_DATA:
                mlxbf_i2c_smbus_data_word_func(&request, &command,
                                               (u8 *)&data->word, read, pec);
                dev_dbg(&adap->dev, "smbus %s word data at 0x%02x, slave 0x%02x.\n",
-                       read ? "read" : "write", command, addr);
+                       str_read_write(read), command, addr);
                break;
 
        case I2C_SMBUS_I2C_BLOCK_DATA:
@@ -2060,7 +2061,7 @@ static s32 mlxbf_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
                mlxbf_i2c_smbus_i2c_block_func(&request, &command, data->block,
                                               &byte_cnt, read, pec);
                dev_dbg(&adap->dev, "i2c %s block data, %d bytes at 0x%02x, slave 0x%02x.\n",
-                       read ? "read" : "write", byte_cnt, command, addr);
+                       str_read_write(read), byte_cnt, command, addr);
                break;
 
        case I2C_SMBUS_BLOCK_DATA:
@@ -2068,7 +2069,7 @@ static s32 mlxbf_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
                mlxbf_i2c_smbus_block_func(&request, &command, data->block,
                                           &byte_cnt, read, pec);
                dev_dbg(&adap->dev, "smbus %s block data, %d bytes at 0x%02x, slave 0x%02x.\n",
-                       read ? "read" : "write", byte_cnt, command, addr);
+                       str_read_write(read), byte_cnt, command, addr);
                break;
 
        case I2C_FUNC_SMBUS_PROC_CALL: