diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-07-03 20:52:12 +0200 |
---|---|---|
committer | Benjamin Tissoires <bentiss@kernel.org> | 2023-07-28 17:05:47 +0200 |
commit | 4a3983d749a1cd2bd71c01a7ea6c4fc63f9df87a (patch) | |
tree | 217bcfed4b3a48283063069bcc8a111b1ad49080 /drivers/hid | |
parent | lib/string_choices: Add str_write_read() helper (diff) | |
download | linux-4a3983d749a1cd2bd71c01a7ea6c4fc63f9df87a.tar.xz linux-4a3983d749a1cd2bd71c01a7ea6c4fc63f9df87a.zip |
HID: cp2112: Use str_write_read() and str_read_write()
Use str_write_read() and str_read_write() from string_choices.h.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230703185222.50554-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-cp2112.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 27cadadda7c9..37ccf4714ad1 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -24,6 +24,7 @@ #include <linux/i2c.h> #include <linux/module.h> #include <linux/nls.h> +#include <linux/string_choices.h> #include <linux/usb/ch9.h> #include "hid-ids.h" @@ -532,15 +533,13 @@ static int cp2112_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, hid_dbg(hdev, "I2C %d messages\n", num); if (num == 1) { + hid_dbg(hdev, "I2C %s %#04x len %d\n", + str_read_write(msgs->flags & I2C_M_RD), msgs->addr, msgs->len); if (msgs->flags & I2C_M_RD) { - hid_dbg(hdev, "I2C read %#04x len %d\n", - msgs->addr, msgs->len); read_length = msgs->len; read_buf = msgs->buf; count = cp2112_read_req(buf, msgs->addr, msgs->len); } else { - hid_dbg(hdev, "I2C write %#04x len %d\n", - msgs->addr, msgs->len); count = cp2112_i2c_write_req(buf, msgs->addr, msgs->buf, msgs->len); } @@ -648,7 +647,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, int ret; hid_dbg(hdev, "%s addr 0x%x flags 0x%x cmd 0x%x size %d\n", - read_write == I2C_SMBUS_WRITE ? "write" : "read", + str_write_read(read_write == I2C_SMBUS_WRITE), addr, flags, command, size); switch (size) { |