mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
usb: typec: Use FIELD_MODIFY()
Use FIELD_MODIFY() to remove open-coded bit manipulation. No functional change intended. Signed-off-by: Hans Zhang <18255117159@163.com> Link: https://patch.msgid.link/20260430163919.47372-7-18255117159@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bcb5da7a9f
commit
dfb128920f
|
|
@ -141,13 +141,10 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc)
|
|||
}
|
||||
|
||||
if (vconn_pres) {
|
||||
if (polarity == TYPEC_POLARITY_CC2) {
|
||||
reg &= ~TCPC_ROLE_CTRL_CC1;
|
||||
reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC1, TCPC_ROLE_CTRL_CC_OPEN);
|
||||
} else {
|
||||
reg &= ~TCPC_ROLE_CTRL_CC2;
|
||||
reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC2, TCPC_ROLE_CTRL_CC_OPEN);
|
||||
}
|
||||
if (polarity == TYPEC_POLARITY_CC2)
|
||||
FIELD_MODIFY(TCPC_ROLE_CTRL_CC1, ®, TCPC_ROLE_CTRL_CC_OPEN);
|
||||
else
|
||||
FIELD_MODIFY(TCPC_ROLE_CTRL_CC2, ®, TCPC_ROLE_CTRL_CC_OPEN);
|
||||
}
|
||||
|
||||
ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user