Skip to content

Commit b71ed5c

Browse files
author
Phil Elwell
committed
pcie-brcmstb: Eliminate arch_dma_ops error message
The driver attempts to set the dma_ops for the root complex, but doing so causes an error message and only the end points need it. Fix the error by making the code specific to the end point case. Also copy some cosmetic tidy-ups from 5.5.y. Signed-off-by: Phil Elwell <[email protected]>
1 parent 805439c commit b71ed5c

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -633,24 +633,24 @@ static int brcmstb_platform_notifier(struct notifier_block *nb,
633633

634634
switch (event) {
635635
case BUS_NOTIFY_ADD_DEVICE:
636-
if (max_pfn > (bounce_threshold/PAGE_SIZE) &&
637-
strcmp(dev->kobj.name, rc_name)) {
638-
639-
ret = brcm_pcie_bounce_register_dev(dev);
640-
if (ret) {
641-
dev_err(dev,
642-
"brcm_pcie_bounce_register_dev() failed: %d\n",
643-
ret);
644-
return ret;
636+
if (strcmp(dev->kobj.name, rc_name)) {
637+
if (max_pfn > (bounce_threshold/PAGE_SIZE)) {
638+
ret = brcm_pcie_bounce_register_dev(dev);
639+
if (ret) {
640+
dev_err(dev,
641+
"brcm_pcie_bounce_register_dev() failed: %d\n",
642+
ret);
643+
return ret;
644+
}
645645
}
646+
brcm_set_dma_ops(dev);
646647
} else if (IS_ENABLED(CONFIG_ARM64)) {
647648
ret = of_dma_configure(dev, dev->of_node, true);
648649
if (ret) {
649650
dev_err(dev, "of_dma_configure() failed: %d\n", ret);
650651
return ret;
651652
}
652653
}
653-
brcm_set_dma_ops(dev);
654654
return NOTIFY_OK;
655655

656656
case BUS_NOTIFY_DEL_DEVICE:
@@ -1685,7 +1685,8 @@ MODULE_DEVICE_TABLE(of, brcm_pcie_match);
16851685

16861686
static int brcm_pcie_probe(struct platform_device *pdev)
16871687
{
1688-
struct device_node *dn = pdev->dev.of_node, *msi_dn;
1688+
struct device *dev = &pdev->dev;
1689+
struct device_node *dn = dev->of_node, *msi_dn;
16891690
const struct of_device_id *of_id;
16901691
const struct pcie_cfg_data *data;
16911692
int ret;
@@ -1696,7 +1697,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
16961697
struct pci_bus *child;
16971698
extern unsigned long max_pfn;
16981699

1699-
bridge = devm_pci_alloc_host_bridge(&pdev->dev, sizeof(*pcie));
1700+
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
17001701
if (!bridge)
17011702
return -ENOMEM;
17021703

@@ -1705,7 +1706,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17051706

17061707
of_id = of_match_node(brcm_pcie_match, dn);
17071708
if (!of_id) {
1708-
dev_err(&pdev->dev, "failed to look up compatible string\n");
1709+
dev_err(dev, "failed to look up compatible string\n");
17091710
return -EINVAL;
17101711
}
17111712

@@ -1715,7 +1716,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17151716
pcie->max_burst_size = data->max_burst_size;
17161717
pcie->type = data->type;
17171718
pcie->dn = dn;
1718-
pcie->dev = &pdev->dev;
1719+
pcie->dev = dev;
17191720

17201721
/* We use the domain number as our controller number */
17211722
pcie->id = of_get_pci_domain_nr(dn);
@@ -1726,18 +1727,18 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17261727
if (!res)
17271728
return -EINVAL;
17281729

1729-
base = devm_ioremap_resource(&pdev->dev, res);
1730+
base = devm_ioremap_resource(dev, res);
17301731
if (IS_ERR(base))
17311732
return PTR_ERR(base);
17321733

17331734
/* To Do: Add hardware check if this ever gets fixed */
17341735
if (max_pfn > (bounce_threshold/PAGE_SIZE)) {
17351736
int ret;
1736-
ret = brcm_pcie_bounce_init(&pdev->dev, bounce_buffer,
1737+
ret = brcm_pcie_bounce_init(dev, bounce_buffer,
17371738
(dma_addr_t)bounce_threshold);
17381739
if (ret) {
17391740
if (ret != -EPROBE_DEFER)
1740-
dev_err(&pdev->dev,
1741+
dev_err(dev,
17411742
"could not init bounce buffers: %d\n",
17421743
ret);
17431744
return ret;
@@ -1746,7 +1747,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17461747

17471748
pcie->clk = of_clk_get_by_name(dn, "sw_pcie");
17481749
if (IS_ERR(pcie->clk)) {
1749-
dev_warn(&pdev->dev, "could not get clock\n");
1750+
dev_warn(dev, "could not get clock\n");
17501751
pcie->clk = NULL;
17511752
}
17521753
pcie->base = base;
@@ -1756,7 +1757,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17561757

17571758
pcie->ssc = of_property_read_bool(dn, "brcm,enable-ssc");
17581759

1759-
ret = irq_of_parse_and_map(pdev->dev.of_node, 0);
1760+
ret = irq_of_parse_and_map(dev->of_node, 0);
17601761
if (ret == 0)
17611762
/* keep going, as we don't use this intr yet */
17621763
dev_warn(pcie->dev, "cannot get PCIe interrupt\n");
@@ -1770,7 +1771,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17701771
ret = clk_prepare_enable(pcie->clk);
17711772
if (ret) {
17721773
if (ret != -EPROBE_DEFER)
1773-
dev_err(&pdev->dev, "could not enable clock\n");
1774+
dev_err(dev, "could not enable clock\n");
17741775
return ret;
17751776
}
17761777

@@ -1797,7 +1798,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
17971798
}
17981799

17991800
list_splice_init(&pcie->resources, &bridge->windows);
1800-
bridge->dev.parent = &pdev->dev;
1801+
bridge->dev.parent = dev;
18011802
bridge->busnr = 0;
18021803
bridge->ops = &brcm_pcie_ops;
18031804
bridge->sysdata = pcie;

0 commit comments

Comments
 (0)