|
3 | 3 | // Cadence PCIe endpoint controller driver.
|
4 | 4 | // Author: Cyrille Pitchen <[email protected]>
|
5 | 5 |
|
| 6 | +#include <linux/bitfield.h> |
6 | 7 | #include <linux/delay.h>
|
7 | 8 | #include <linux/kernel.h>
|
8 | 9 | #include <linux/of.h>
|
@@ -262,7 +263,7 @@ static int cdns_pcie_ep_get_msi(struct pci_epc *epc, u8 fn, u8 vfn)
|
262 | 263 | * Get the Multiple Message Enable bitfield from the Message Control
|
263 | 264 | * register.
|
264 | 265 | */
|
265 |
| - mme = (flags & PCI_MSI_FLAGS_QSIZE) >> 4; |
| 266 | + mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags); |
266 | 267 |
|
267 | 268 | return mme;
|
268 | 269 | }
|
@@ -394,7 +395,7 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn,
|
394 | 395 | return -EINVAL;
|
395 | 396 |
|
396 | 397 | /* Get the number of enabled MSIs */
|
397 |
| - mme = (flags & PCI_MSI_FLAGS_QSIZE) >> 4; |
| 398 | + mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags); |
398 | 399 | msi_count = 1 << mme;
|
399 | 400 | if (!interrupt_num || interrupt_num > msi_count)
|
400 | 401 | return -EINVAL;
|
@@ -449,7 +450,7 @@ static int cdns_pcie_ep_map_msi_irq(struct pci_epc *epc, u8 fn, u8 vfn,
|
449 | 450 | return -EINVAL;
|
450 | 451 |
|
451 | 452 | /* Get the number of enabled MSIs */
|
452 |
| - mme = (flags & PCI_MSI_FLAGS_QSIZE) >> 4; |
| 453 | + mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags); |
453 | 454 | msi_count = 1 << mme;
|
454 | 455 | if (!interrupt_num || interrupt_num > msi_count)
|
455 | 456 | return -EINVAL;
|
@@ -506,7 +507,7 @@ static int cdns_pcie_ep_send_msix_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn,
|
506 | 507 |
|
507 | 508 | reg = cap + PCI_MSIX_TABLE;
|
508 | 509 | tbl_offset = cdns_pcie_ep_fn_readl(pcie, fn, reg);
|
509 |
| - bir = tbl_offset & PCI_MSIX_TABLE_BIR; |
| 510 | + bir = FIELD_GET(PCI_MSIX_TABLE_BIR, tbl_offset); |
510 | 511 | tbl_offset &= PCI_MSIX_TABLE_OFFSET;
|
511 | 512 |
|
512 | 513 | msix_tbl = epf->epf_bar[bir]->addr + tbl_offset;
|
|
0 commit comments