|
6 | 6 | * Author: Alex Williamson <[email protected]>
|
7 | 7 | */
|
8 | 8 |
|
| 9 | +#include <linux/bitfield.h> |
9 | 10 | #include <linux/device.h>
|
10 | 11 | #include <linux/kernel.h>
|
11 | 12 | #include <linux/module.h>
|
@@ -201,9 +202,9 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
|
201 | 202 | /* Extended VC Count (not counting VC0) */
|
202 | 203 | evcc = cap1 & PCI_VC_CAP1_EVCC;
|
203 | 204 | /* Low Priority Extended VC Count (not counting VC0) */
|
204 |
| - lpevcc = (cap1 & PCI_VC_CAP1_LPEVCC) >> 4; |
| 205 | + lpevcc = FIELD_GET(PCI_VC_CAP1_LPEVCC, cap1); |
205 | 206 | /* Port Arbitration Table Entry Size (bits) */
|
206 |
| - parb_size = 1 << ((cap1 & PCI_VC_CAP1_ARB_SIZE) >> 10); |
| 207 | + parb_size = 1 << FIELD_GET(PCI_VC_CAP1_ARB_SIZE, cap1); |
207 | 208 |
|
208 | 209 | /*
|
209 | 210 | * Port VC Control Register contains VC Arbitration Select, which
|
@@ -231,7 +232,7 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
|
231 | 232 | int vcarb_offset;
|
232 | 233 |
|
233 | 234 | pci_read_config_dword(dev, pos + PCI_VC_PORT_CAP2, &cap2);
|
234 |
| - vcarb_offset = ((cap2 & PCI_VC_CAP2_ARB_OFF) >> 24) * 16; |
| 235 | + vcarb_offset = FIELD_GET(PCI_VC_CAP2_ARB_OFF, cap2) * 16; |
235 | 236 |
|
236 | 237 | if (vcarb_offset) {
|
237 | 238 | int size, vcarb_phases = 0;
|
@@ -277,7 +278,7 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
|
277 | 278 |
|
278 | 279 | pci_read_config_dword(dev, pos + PCI_VC_RES_CAP +
|
279 | 280 | (i * PCI_CAP_VC_PER_VC_SIZEOF), &cap);
|
280 |
| - parb_offset = ((cap & PCI_VC_RES_CAP_ARB_OFF) >> 24) * 16; |
| 281 | + parb_offset = FIELD_GET(PCI_VC_RES_CAP_ARB_OFF, cap) * 16; |
281 | 282 | if (parb_offset) {
|
282 | 283 | int size, parb_phases = 0;
|
283 | 284 |
|
|
0 commit comments