Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240710-tcpc-cleanup-v1-6-0ec1f41f4263@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

André Draszik and committed by
Greg Kroah-Hartman
aee4568f 46b1e0f8

+2 -3
+1 -1
drivers/usb/typec/tcpm/tcpci.c
··· 456 456 unsigned int reg; 457 457 int ret; 458 458 459 - reg = PD_REV20 << TCPC_MSG_HDR_INFO_REV_SHIFT; 459 + reg = FIELD_PREP(TCPC_MSG_HDR_INFO_REV, PD_REV20); 460 460 if (role == TYPEC_SOURCE) 461 461 reg |= TCPC_MSG_HDR_INFO_PWR_ROLE; 462 462 if (data == TYPEC_HOST)
+1 -2
include/linux/usb/tcpci.h
··· 129 129 130 130 #define TCPC_MSG_HDR_INFO 0x2e 131 131 #define TCPC_MSG_HDR_INFO_DATA_ROLE BIT(3) 132 + #define TCPC_MSG_HDR_INFO_REV GENMASK(2, 1) 132 133 #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 135 134 136 135 #define TCPC_RX_DETECT 0x2f 137 136 #define TCPC_RX_DETECT_HARD_RESET BIT(5)