Skip to content

Commit

Permalink
USB: typec: no opencoding FIELD_GET
Browse files Browse the repository at this point in the history
We have a macro. It should be used.

Signed-off-by: Oliver Neukum <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
oneukum authored and gregkh committed Mar 2, 2024
1 parent 73473b3 commit a74c0c9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/linux/usb/typec_tbt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define __USB_TYPEC_TBT_H

#include <linux/usb/typec_altmode.h>
#include <linux/bitfield.h>

#define USB_TYPEC_VENDOR_INTEL 0x8087
/* Alias for convenience */
Expand All @@ -25,7 +26,7 @@ struct typec_thunderbolt_data {

/* TBT3 Device Discover Mode VDO bits */
#define TBT_MODE BIT(0)
#define TBT_ADAPTER(_vdo_) (((_vdo_) & BIT(16)) >> 16)
#define TBT_ADAPTER(_vdo_) FIELD_GET(BIT(16), _vdo_)
#define TBT_ADAPTER_LEGACY 0
#define TBT_ADAPTER_TBT3 1
#define TBT_INTEL_SPECIFIC_B0 BIT(26)
Expand All @@ -35,12 +36,12 @@ struct typec_thunderbolt_data {
#define TBT_SET_ADAPTER(a) (((a) & 1) << 16)

/* TBT3 Cable Discover Mode VDO bits */
#define TBT_CABLE_SPEED(_vdo_) (((_vdo_) & GENMASK(18, 16)) >> 16)
#define TBT_CABLE_SPEED(_vdo_) FIELD_GET(GENMASK(18, 16), _vdo_)
#define TBT_CABLE_USB3_GEN1 1
#define TBT_CABLE_USB3_PASSIVE 2
#define TBT_CABLE_10_AND_20GBPS 3
#define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \
(((_vdo_) & GENMASK(20, 19)) >> 19)
#define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) FIELD_GET(GENMASK(20, 19), _vdo_)

#define TBT_GEN3_NON_ROUNDED 0
#define TBT_GEN3_GEN4_ROUNDED_NON_ROUNDED 1
#define TBT_CABLE_OPTICAL BIT(21)
Expand Down

0 comments on commit a74c0c9

Please sign in to comment.