Skip to content

Commit 4a3983d

Browse files
andy-shevBenjamin Tissoires
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 81e4fc6 commit 4a3983d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/hid/hid-cp2112.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/i2c.h>
2525
#include <linux/module.h>
2626
#include <linux/nls.h>
27+
#include <linux/string_choices.h>
2728
#include <linux/usb/ch9.h>
2829
#include "hid-ids.h"
2930

@@ -532,15 +533,13 @@ static int cp2112_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
532533
hid_dbg(hdev, "I2C %d messages\n", num);
533534

534535
if (num == 1) {
536+
hid_dbg(hdev, "I2C %s %#04x len %d\n",
537+
str_read_write(msgs->flags & I2C_M_RD), msgs->addr, msgs->len);
535538
if (msgs->flags & I2C_M_RD) {
536-
hid_dbg(hdev, "I2C read %#04x len %d\n",
537-
msgs->addr, msgs->len);
538539
read_length = msgs->len;
539540
read_buf = msgs->buf;
540541
count = cp2112_read_req(buf, msgs->addr, msgs->len);
541542
} else {
542-
hid_dbg(hdev, "I2C write %#04x len %d\n",
543-
msgs->addr, msgs->len);
544543
count = cp2112_i2c_write_req(buf, msgs->addr,
545544
msgs->buf, msgs->len);
546545
}
@@ -648,7 +647,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
648647
int ret;
649648

650649
hid_dbg(hdev, "%s addr 0x%x flags 0x%x cmd 0x%x size %d\n",
651-
read_write == I2C_SMBUS_WRITE ? "write" : "read",
650+
str_write_read(read_write == I2C_SMBUS_WRITE),
652651
addr, flags, command, size);
653652

654653
switch (size) {

0 commit comments

Comments
 (0)