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.

xhci: use BIT macro

We have the macro. Use it.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260402131342.2628648-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Oliver Neukum and committed by
Greg Kroah-Hartman
abe93f27 74a22872

+61 -60
+61 -60
drivers/usb/host/xhci.h
··· 12 12 #ifndef __LINUX_XHCI_HCD_H 13 13 #define __LINUX_XHCI_HCD_H 14 14 15 + #include <linux/bits.h> 15 16 #include <linux/usb.h> 16 17 #include <linux/timer.h> 17 18 #include <linux/kernel.h> ··· 126 125 * PCI config regs). HC does NOT drive a USB reset on the downstream ports. 127 126 * The xHCI driver must reinitialize the xHC after setting this bit. 128 127 */ 129 - #define CMD_RESET (1 << 1) 128 + #define CMD_RESET BIT(1) 130 129 /* Event Interrupt Enable - a '1' allows interrupts from the host controller */ 131 130 #define CMD_EIE XHCI_CMD_EIE 132 131 /* Host System Error Interrupt Enable - get out-of-band signal for HC errors */ 133 132 #define CMD_HSEIE XHCI_CMD_HSEIE 134 133 /* bits 4:6 are reserved (and should be preserved on writes). */ 135 134 /* light reset (port status stays unchanged) - reset completed when this is 0 */ 136 - #define CMD_LRESET (1 << 7) 135 + #define CMD_LRESET BIT(7) 137 136 /* host controller save/restore state. */ 138 - #define CMD_CSS (1 << 8) 139 - #define CMD_CRS (1 << 9) 137 + #define CMD_CSS BIT(8) 138 + #define CMD_CRS BIT(9) 140 139 /* Enable Wrap Event - '1' means xHC generates an event when MFINDEX wraps. */ 141 140 #define CMD_EWE XHCI_CMD_EWE 142 141 /* MFINDEX power management - '1' means xHC can stop MFINDEX counter if all root ··· 144 143 * '0' means the xHC can power it off if all ports are in the disconnect, 145 144 * disabled, or powered-off state. 146 145 */ 147 - #define CMD_PM_INDEX (1 << 11) 146 + #define CMD_PM_INDEX BIT(11) 148 147 /* bit 14 Extended TBC Enable, changes Isoc TRB fields to support larger TBC */ 149 - #define CMD_ETE (1 << 14) 148 + #define CMD_ETE BIT(14) 150 149 /* bits 15:31 are reserved (and should be preserved on writes). */ 151 150 152 151 #define XHCI_RESET_LONG_USEC (10 * 1000 * 1000) ··· 156 155 /* HC not running - set to 1 when run/stop bit is cleared. */ 157 156 #define STS_HALT XHCI_STS_HALT 158 157 /* serious error, e.g. PCI parity error. The HC will clear the run/stop bit. */ 159 - #define STS_FATAL (1 << 2) 158 + #define STS_FATAL BIT(2) 160 159 /* event interrupt - clear this prior to clearing any IP flags in IR set*/ 161 - #define STS_EINT (1 << 3) 160 + #define STS_EINT BIT(3) 162 161 /* port change detect */ 163 - #define STS_PORT (1 << 4) 162 + #define STS_PORT BIT(4) 164 163 /* bits 5:7 reserved and zeroed */ 165 164 /* save state status - '1' means xHC is saving state */ 166 - #define STS_SAVE (1 << 8) 165 + #define STS_SAVE BIT(8) 167 166 /* restore state status - '1' means xHC is restoring state */ 168 - #define STS_RESTORE (1 << 9) 167 + #define STS_RESTORE BIT(9) 169 168 /* true: save or restore error */ 170 - #define STS_SRE (1 << 10) 169 + #define STS_SRE BIT(10) 171 170 /* true: Controller Not Ready to accept doorbell or op reg writes after reset */ 172 171 #define STS_CNR XHCI_STS_CNR 173 172 /* true: internal Host Controller Error - SW needs to reset and reinitialize */ 174 - #define STS_HCE (1 << 12) 173 + #define STS_HCE BIT(12) 175 174 /* bits 13:31 reserved and should be preserved */ 176 175 177 176 /* ··· 183 182 /* Most of the device notification types should only be used for debug. 184 183 * SW does need to pay attention to function wake notifications. 185 184 */ 186 - #define DEV_NOTE_FWAKE (1 << 1) 185 + #define DEV_NOTE_FWAKE BIT(1) 187 186 188 187 /* CRCR - Command Ring Control Register - cmd_ring bitmasks */ 189 188 /* bit 0 - Cycle bit indicates the ownership of the command ring */ 190 - #define CMD_RING_CYCLE (1 << 0) 189 + #define CMD_RING_CYCLE BIT(0) 191 190 /* stop ring operation after completion of the currently executing command */ 192 - #define CMD_RING_PAUSE (1 << 1) 191 + #define CMD_RING_PAUSE BIT(1) 193 192 /* stop ring immediately - abort the currently executing command */ 194 - #define CMD_RING_ABORT (1 << 2) 193 + #define CMD_RING_ABORT BIT(2) 195 194 /* true: command ring is running */ 196 - #define CMD_RING_RUNNING (1 << 3) 195 + #define CMD_RING_RUNNING BIT(3) 197 196 /* bits 63:6 - Command Ring pointer */ 198 197 #define CMD_RING_PTR_MASK GENMASK_ULL(63, 6) 199 198 ··· 201 200 /* bits 0:7 - maximum number of device slots enabled (NumSlotsEn) */ 202 201 #define MAX_DEVS(p) ((p) & 0xff) 203 202 /* bit 8: U3 Entry Enabled, assert PLC when root port enters U3, xhci 1.1 */ 204 - #define CONFIG_U3E (1 << 8) 203 + #define CONFIG_U3E BIT(8) 205 204 /* bit 9: Configuration Information Enable, xhci 1.1 */ 206 - #define CONFIG_CIE (1 << 9) 205 + #define CONFIG_CIE BIT(9) 207 206 /* bits 10:31 - reserved and should be preserved */ 208 207 209 208 /* bits 15:0 - HCD page shift bit */ ··· 236 235 237 236 /* iman bitmasks */ 238 237 /* bit 0 - Interrupt Pending (IP), whether there is an interrupt pending. Write-1-to-clear. */ 239 - #define IMAN_IP (1 << 0) 238 + #define IMAN_IP BIT(0) 240 239 /* bit 1 - Interrupt Enable (IE), whether the interrupter is capable of generating an interrupt */ 241 - #define IMAN_IE (1 << 1) 240 + #define IMAN_IE BIT(1) 242 241 243 242 /* imod bitmasks */ 244 243 /* ··· 268 267 * bit 3 - Event Handler Busy (EHB), whether the event ring is scheduled to be serviced by 269 268 * a work queue (or delayed service routine)? 270 269 */ 271 - #define ERST_EHB (1 << 3) 270 + #define ERST_EHB BIT(3) 272 271 /* bits 63:4 - Event Ring Dequeue Pointer */ 273 272 #define ERST_PTR_MASK GENMASK_ULL(63, 4) 274 273 ··· 357 356 #define GET_DEV_SPEED(n) (((n) & DEV_SPEED) >> 20) 358 357 /* bit 24 reserved */ 359 358 /* Is this LS/FS device connected through a HS hub? - bit 25 */ 360 - #define DEV_MTT (0x1 << 25) 359 + #define DEV_MTT BIT(25) 361 360 /* Set if the device is a hub - bit 26 */ 362 - #define DEV_HUB (0x1 << 26) 361 + #define DEV_HUB BIT(26) 363 362 /* Index of the last valid endpoint context in this device context - 27:31 */ 364 363 #define LAST_CTX_MASK (0x1f << 27) 365 364 #define LAST_CTX(p) ((p) << 27) 366 365 #define LAST_CTX_TO_EP_NUM(p) (((p) >> 27) - 1) 367 - #define SLOT_FLAG (1 << 0) 368 - #define EP0_FLAG (1 << 1) 366 + #define SLOT_FLAG BIT(0) 367 + #define EP0_FLAG BIT(1) 369 368 370 369 /* dev_info2 bitmasks */ 371 370 /* Max Exit Latency (ms) - worst case time to wake up all links in dev path */ ··· 464 463 #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) 465 464 #define CTX_TO_EP_MAXPSTREAMS(p) (((p) & EP_MAXPSTREAMS_MASK) >> 10) 466 465 /* Endpoint is set up with a Linear Stream Array (vs. Secondary Stream Array) */ 467 - #define EP_HAS_LSA (1 << 15) 466 + #define EP_HAS_LSA BIT(15) 468 467 /* hosts with LEC=1 use bits 31:24 as ESIT high bits. */ 469 468 #define CTX_TO_MAX_ESIT_PAYLOAD_HI(p) (((p) >> 24) & 0xff) 470 469 ··· 499 498 #define CTX_TO_MAX_ESIT_PAYLOAD(p) (((p) >> 16) & 0xffff) 500 499 501 500 /* deq bitmasks */ 502 - #define EP_CTX_CYCLE_MASK (1 << 0) 501 + #define EP_CTX_CYCLE_MASK BIT(0) 503 502 /* bits 63:4 - TR Dequeue Pointer */ 504 503 #define TR_DEQ_PTR_MASK GENMASK_ULL(63, 4) 505 504 ··· 662 661 struct xhci_ring *new_ring; 663 662 unsigned int err_count; 664 663 unsigned int ep_state; 665 - #define SET_DEQ_PENDING (1 << 0) 666 - #define EP_HALTED (1 << 1) /* For stall handling */ 667 - #define EP_STOP_CMD_PENDING (1 << 2) /* For URB cancellation */ 664 + #define SET_DEQ_PENDING BIT(0) 665 + #define EP_HALTED BIT(1) /* For stall handling */ 666 + #define EP_STOP_CMD_PENDING BIT(2) /* For URB cancellation */ 668 667 /* Transitioning the endpoint to using streams, don't enqueue URBs */ 669 - #define EP_GETTING_STREAMS (1 << 3) 670 - #define EP_HAS_STREAMS (1 << 4) 668 + #define EP_GETTING_STREAMS BIT(3) 669 + #define EP_HAS_STREAMS BIT(4) 671 670 /* Transitioning the endpoint to not using streams, don't enqueue URBs */ 672 - #define EP_GETTING_NO_STREAMS (1 << 5) 673 - #define EP_HARD_CLEAR_TOGGLE (1 << 6) 674 - #define EP_SOFT_CLEAR_TOGGLE (1 << 7) 671 + #define EP_GETTING_NO_STREAMS BIT(5) 672 + #define EP_HARD_CLEAR_TOGGLE BIT(6) 673 + #define EP_SOFT_CLEAR_TOGGLE BIT(7) 675 674 /* usb_hub_clear_tt_buffer is in progress */ 676 - #define EP_CLEARING_TT (1 << 8) 675 + #define EP_CLEARING_TT BIT(8) 677 676 /* ---- Related to URB cancellation ---- */ 678 677 struct list_head cancelled_td_list; 679 678 struct xhci_hcd *xhci; ··· 955 954 }; 956 955 957 956 /* control bitfields */ 958 - #define LINK_TOGGLE (0x1<<1) 957 + #define LINK_TOGGLE BIT(1) 959 958 960 959 /* Command completion event TRB */ 961 960 struct xhci_event_cmd { ··· 969 968 #define COMP_PARAM(p) ((p) & 0xffffff) /* Command Completion Parameter */ 970 969 971 970 /* Address device - disable SetAddress */ 972 - #define TRB_BSR (1<<9) 971 + #define TRB_BSR BIT(9) 973 972 974 973 /* Configure Endpoint - Deconfigure */ 975 - #define TRB_DC (1<<9) 974 + #define TRB_DC BIT(9) 976 975 977 976 /* Stop Ring - Transfer State Preserve */ 978 - #define TRB_TSP (1<<9) 977 + #define TRB_TSP BIT(9) 979 978 980 979 enum xhci_ep_reset_type { 981 980 EP_HARD_RESET, ··· 1018 1017 #define SCT_FOR_TRB(p) (((p) & 0x7) << 1) 1019 1018 1020 1019 /* Link TRB specific fields */ 1021 - #define TRB_TC (1<<1) 1020 + #define TRB_TC BIT(1) 1022 1021 1023 1022 /* Port Status Change Event TRB fields */ 1024 1023 /* Port ID - bits 31:24 */ 1025 1024 #define GET_PORT_ID(p) (((p) & (0xff << 24)) >> 24) 1026 1025 1027 - #define EVENT_DATA (1 << 2) 1026 + #define EVENT_DATA BIT(2) 1028 1027 1029 1028 /* Normal TRB fields */ 1030 1029 /* transfer_len bitmasks - bits 0:16 */ ··· 1039 1038 #define GET_INTR_TARGET(p) (((p) >> 22) & 0x3ff) 1040 1039 1041 1040 /* Cycle bit - indicates TRB ownership by HC or HCD */ 1042 - #define TRB_CYCLE (1<<0) 1041 + #define TRB_CYCLE BIT(0) 1043 1042 /* 1044 1043 * Force next event data TRB to be evaluated before task switch. 1045 1044 * Used to pass OS data back after a TD completes. 1046 1045 */ 1047 - #define TRB_ENT (1<<1) 1046 + #define TRB_ENT BIT(1) 1048 1047 /* Interrupt on short packet */ 1049 - #define TRB_ISP (1<<2) 1048 + #define TRB_ISP BIT(2) 1050 1049 /* Set PCIe no snoop attribute */ 1051 - #define TRB_NO_SNOOP (1<<3) 1050 + #define TRB_NO_SNOOP BIT(3) 1052 1051 /* Chain multiple TRBs into a TD */ 1053 - #define TRB_CHAIN (1<<4) 1052 + #define TRB_CHAIN BIT(4) 1054 1053 /* Interrupt on completion */ 1055 - #define TRB_IOC (1<<5) 1054 + #define TRB_IOC BIT(5) 1056 1055 /* The buffer pointer contains immediate data */ 1057 - #define TRB_IDT (1<<6) 1056 + #define TRB_IDT BIT(6) 1058 1057 /* TDs smaller than this might use IDT */ 1059 1058 #define TRB_IDT_MAX_SIZE 8 1060 1059 1061 1060 /* Block Event Interrupt */ 1062 - #define TRB_BEI (1<<9) 1061 + #define TRB_BEI BIT(9) 1063 1062 1064 1063 /* Control transfer TRB specific fields */ 1065 - #define TRB_DIR_IN (1<<16) 1064 + #define TRB_DIR_IN BIT(16) 1066 1065 #define TRB_TX_TYPE(p) ((p) << 16) 1067 1066 #define TRB_DATA_OUT 2 1068 1067 #define TRB_DATA_IN 3 1069 1068 1070 1069 /* Isochronous TRB specific fields */ 1071 - #define TRB_SIA (1<<31) 1070 + #define TRB_SIA BIT(31) 1072 1071 #define TRB_FRAME_ID(p) (((p) & 0x7ff) << 20) 1073 1072 #define GET_FRAME_ID(p) (((p) >> 20) & 0x7ff) 1074 1073 /* Total burst count field, Rsvdz on xhci 1.1 with Extended TBC enabled (ETE) */ ··· 1536 1535 struct xhci_interrupter **interrupters; 1537 1536 struct xhci_ring *cmd_ring; 1538 1537 unsigned int cmd_ring_state; 1539 - #define CMD_RING_STATE_RUNNING (1 << 0) 1540 - #define CMD_RING_STATE_ABORTED (1 << 1) 1541 - #define CMD_RING_STATE_STOPPED (1 << 2) 1538 + #define CMD_RING_STATE_RUNNING BIT(0) 1539 + #define CMD_RING_STATE_ABORTED BIT(1) 1540 + #define CMD_RING_STATE_STOPPED BIT(2) 1542 1541 struct list_head cmd_list; 1543 1542 unsigned int cmd_ring_reserved_trbs; 1544 1543 struct delayed_work cmd_timer; ··· 1579 1578 * 1580 1579 * There are no reports of xHCI host controllers that display this issue. 1581 1580 */ 1582 - #define XHCI_STATE_DYING (1 << 0) 1583 - #define XHCI_STATE_HALTED (1 << 1) 1584 - #define XHCI_STATE_REMOVING (1 << 2) 1581 + #define XHCI_STATE_DYING BIT(0) 1582 + #define XHCI_STATE_HALTED BIT(1) 1583 + #define XHCI_STATE_REMOVING BIT(2) 1585 1584 unsigned long long quirks; 1586 1585 #define XHCI_LINK_TRB_QUIRK BIT_ULL(0) 1587 1586 #define XHCI_RESET_EP_QUIRK BIT_ULL(1) /* Deprecated */