提交 bd42f310 编写于 作者: S Serge Semin 提交者: Bjorn Helgaas

PCI: dwc: Reuse local pointer to the resource data

dw_pcie_host_init() has two instances of the resource structure pointers
used in unrelated places. It's pointless to have two different local
storages for them since the corresponding code is small and having
resource-specific names doesn't make it more readable.

Convert these parts of the function to use a common pointer to the
resource structure instance.

Link: https://lore.kernel.org/r/20220624143428.8334-13-Sergey.Semin@baikalelectronics.ruSigned-off-by: NSerge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NRob Herring <robh@kernel.org>
Reviewed-by: NManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
上级 60a4352f
...@@ -293,17 +293,17 @@ int dw_pcie_host_init(struct pcie_port *pp) ...@@ -293,17 +293,17 @@ int dw_pcie_host_init(struct pcie_port *pp)
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct resource_entry *win; struct resource_entry *win;
struct pci_host_bridge *bridge; struct pci_host_bridge *bridge;
struct resource *cfg_res; struct resource *res;
int ret; int ret;
raw_spin_lock_init(&pp->lock); raw_spin_lock_init(&pp->lock);
cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
if (cfg_res) { if (res) {
pp->cfg0_size = resource_size(cfg_res); pp->cfg0_size = resource_size(res);
pp->cfg0_base = cfg_res->start; pp->cfg0_base = res->start;
pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, cfg_res); pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res);
if (IS_ERR(pp->va_cfg0_base)) if (IS_ERR(pp->va_cfg0_base))
return PTR_ERR(pp->va_cfg0_base); return PTR_ERR(pp->va_cfg0_base);
} else { } else {
...@@ -312,8 +312,8 @@ int dw_pcie_host_init(struct pcie_port *pp) ...@@ -312,8 +312,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
} }
if (!pci->dbi_base) { if (!pci->dbi_base) {
struct resource *dbi_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_res); pci->dbi_base = devm_pci_remap_cfg_resource(dev, res);
if (IS_ERR(pci->dbi_base)) if (IS_ERR(pci->dbi_base))
return PTR_ERR(pci->dbi_base); return PTR_ERR(pci->dbi_base);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册