History

usb: typec: tcpci: use GENMASK() for TCPC_MSG_HDR_INFO_REV

Convert field TCPC_MSG_HDR_INFO_REV from register TCPC_MSG_HDR_INFO to using GENMASK() and FIELD_PREP() so as to keep using a similar approach for all fields.

André Draszik committed 2 years ago

Commit aee45681 parent 46b1e0f2 files · +2 −3Browse files

Unified · Split

2 files
  1. drivers/usb/typec/tcpm/tcpci.c +1 −1
  2. include/linux/usb/tcpci.h +1 −2
drivers/usb/typec/tcpm/tcpci.c+1−1
@@ -456,7 +456,7 @@ static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached, · 455 unmodified lines
456456 unsigned int reg;
457457 int ret;
458458
459− reg = PD_REV20 << TCPC_MSG_HDR_INFO_REV_SHIFT;
459+ reg = FIELD_PREP(TCPC_MSG_HDR_INFO_REV, PD_REV20);
460460 if (role == TYPEC_SOURCE)
461461 reg |= TCPC_MSG_HDR_INFO_PWR_ROLE;
462462 if (data == TYPEC_HOST)
include/linux/usb/tcpci.h+1−2
@@ -129,9 +129,8 @@ · 128 unmodified lines
129129
130130 #define TCPC_MSG_HDR_INFO 0x2e
131131 #define TCPC_MSG_HDR_INFO_DATA_ROLE BIT(3)
132+#define TCPC_MSG_HDR_INFO_REV GENMASK(2, 1)
132133 #define TCPC_MSG_HDR_INFO_PWR_ROLE BIT(0)
133−#define TCPC_MSG_HDR_INFO_REV_SHIFT 1
134−#define TCPC_MSG_HDR_INFO_REV_MASK 0x3
135134
136135 #define TCPC_RX_DETECT 0x2f
137136 #define TCPC_RX_DETECT_HARD_RESET BIT(5)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t