]> www.infradead.org Git - users/willy/linux.git/commit
usb: typec: tcpci: use GENMASK() for TCPC_ROLE_CTRL_CC[12]
authorAndré Draszik <andre.draszik@linaro.org>
Wed, 10 Jul 2024 10:36:11 +0000 (11:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Aug 2024 10:49:30 +0000 (12:49 +0200)
commit83b254c13ac093810e1058d9cb1bbb4b7ef9c246
treed1880bea97e0a6fb408a6268b91f5bfbc455d120
parentf523aa6d72598bcd2946c7e02d29f33f94806a15
usb: typec: tcpci: use GENMASK() for TCPC_ROLE_CTRL_CC[12]

All this open-coded shifting and masking is quite hard to read, in
particular the if-statement in tcpci_apply_rc().

Declare TCPC_ROLE_CTRL_CC[12] using GENMASK() which allows using
FIELD_GET() and FIELD_PREP() to arguably make the code more legible.

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-4-0ec1f41f4263@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/anx7411.c
drivers/usb/typec/tcpm/tcpci.c
drivers/usb/typec/tcpm/tcpci_rt1711h.c
include/linux/usb/tcpci.h