]> git.ipfire.org Git - thirdparty/linux.git/commit
usb: typec: tcpci: use GENMASK() for TCPC_CC_STATUS_CC[12]
authorAndré Draszik <andre.draszik@linaro.org>
Wed, 10 Jul 2024 10:36:10 +0000 (11:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Aug 2024 10:49:30 +0000 (12:49 +0200)
commitf523aa6d72598bcd2946c7e02d29f33f94806a15
tree7b646b0f3b14c9f805a87095910b31f7983113cf
parent0943ce2b764310efeffc58fbc09a9105cf02a8ea
usb: typec: tcpci: use GENMASK() for TCPC_CC_STATUS_CC[12]

The existing code here, particularly in maxim_contaminant.c, is
arguably quite hard to read due to the open-coded masking and shifting
spanning multiple lines.

Use GENMASK() and FIELD_GET() instead, which arguably make the code
much easier to follow.

While at it, use the symbolic name TCPC_CC_STATE_SRC_OPEN for one
instance of open-coded 0x0.

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