Skip to content

Commit 00c78a3

Browse files
committed
Merge branch 'pci/controller/dwc-ep'
- Use FIELD_GET() to simplify extracting register values (Hans Zhang) * pci/controller/dwc-ep: PCI: dwc: ep: Fix errno typo PCI: dwc: ep: Use FIELD_GET() where applicable
2 parents 2027962 + 1d79596 commit 00c78a3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ static unsigned int dw_pcie_ep_get_rebar_offset(struct dw_pcie *pci,
256256
return offset;
257257

258258
reg = dw_pcie_readl_dbi(pci, offset + PCI_REBAR_CTRL);
259-
nbars = (reg & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT;
259+
nbars = FIELD_GET(PCI_REBAR_CTRL_NBAR_MASK, reg);
260260

261261
for (i = 0; i < nbars; i++, offset += PCI_REBAR_CTRL) {
262262
reg = dw_pcie_readl_dbi(pci, offset + PCI_REBAR_CTRL);
263-
bar_index = reg & PCI_REBAR_CTRL_BAR_IDX;
263+
bar_index = FIELD_GET(PCI_REBAR_CTRL_BAR_IDX, reg);
264264
if (bar_index == bar)
265265
return offset;
266266
}
@@ -672,7 +672,7 @@ static const struct pci_epc_ops epc_ops = {
672672
* @ep: DWC EP device
673673
* @func_no: Function number of the endpoint
674674
*
675-
* Return: 0 if success, errono otherwise.
675+
* Return: 0 if success, errno otherwise.
676676
*/
677677
int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no)
678678
{
@@ -691,7 +691,7 @@ EXPORT_SYMBOL_GPL(dw_pcie_ep_raise_intx_irq);
691691
* @func_no: Function number of the endpoint
692692
* @interrupt_num: Interrupt number to be raised
693693
*
694-
* Return: 0 if success, errono otherwise.
694+
* Return: 0 if success, errno otherwise.
695695
*/
696696
int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
697697
u8 interrupt_num)
@@ -876,8 +876,7 @@ static void dw_pcie_ep_init_non_sticky_registers(struct dw_pcie *pci)
876876

877877
if (offset) {
878878
reg = dw_pcie_readl_dbi(pci, offset + PCI_REBAR_CTRL);
879-
nbars = (reg & PCI_REBAR_CTRL_NBAR_MASK) >>
880-
PCI_REBAR_CTRL_NBAR_SHIFT;
879+
nbars = FIELD_GET(PCI_REBAR_CTRL_NBAR_MASK, reg);
881880

882881
/*
883882
* PCIe r6.0, sec 7.8.6.2 require us to support at least one
@@ -898,7 +897,7 @@ static void dw_pcie_ep_init_non_sticky_registers(struct dw_pcie *pci)
898897
* is why RESBAR_CAP_REG is written here.
899898
*/
900899
val = dw_pcie_readl_dbi(pci, offset + PCI_REBAR_CTRL);
901-
bar = val & PCI_REBAR_CTRL_BAR_IDX;
900+
bar = FIELD_GET(PCI_REBAR_CTRL_BAR_IDX, val);
902901
if (ep->epf_bar[bar])
903902
pci_epc_bar_size_to_rebar_cap(ep->epf_bar[bar]->size, &val);
904903
else

0 commit comments

Comments
 (0)