linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] PCI: mvebu: Cleanups
@ 2016-10-12 12:55 Bjorn Helgaas
  2016-10-12 12:55 ` [PATCH v2 1/2] PCI: mvebu: Add local struct device pointers Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 12:55 UTC (permalink / raw)
  To: Jason Cooper; +Cc: linux-pci

  - Add local "dev" pointers to reduce repetition of things like
    "&pdev->dev".

  - Tidy up usage of of_node pointer

Nothing here should change the behavior of the driver.

Changes from v1:
  Added of_node cleanup
  Dropped "PCI: mvebu: Swap order of mvebu_writel() reg/val arguments"

---

Bjorn Helgaas (2):
      PCI: mvebu: Add local struct device pointers
      PCI: mvebu: Use existing of_node pointer


 drivers/pci/host/pci-mvebu.c |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] PCI: mvebu: Add local struct device pointers
  2016-10-12 12:55 [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas
@ 2016-10-12 12:55 ` Bjorn Helgaas
  2016-10-12 12:56 ` [PATCH v2 2/2] PCI: mvebu: Use existing of_node pointer Bjorn Helgaas
  2016-10-12 16:01 ` [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 12:55 UTC (permalink / raw)
  To: Jason Cooper; +Cc: linux-pci

Use a local "struct device *dev" for brevity and consistency with other
drivers.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pci-mvebu.c |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 307f81d..2515200 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1190,13 +1190,13 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
 
 static int mvebu_pcie_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct mvebu_pcie *pcie;
-	struct device_node *np = pdev->dev.of_node;
+	struct device_node *np = dev->of_node;
 	struct device_node *child;
 	int num, i, ret;
 
-	pcie = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pcie),
-			    GFP_KERNEL);
+	pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
 	if (!pcie)
 		return -ENOMEM;
 
@@ -1206,7 +1206,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 	/* Get the PCIe memory and I/O aperture */
 	mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
 	if (resource_size(&pcie->mem) == 0) {
-		dev_err(&pdev->dev, "invalid memory aperture size\n");
+		dev_err(dev, "invalid memory aperture size\n");
 		return -EINVAL;
 	}
 
@@ -1224,20 +1224,18 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 	/* Get the bus range */
 	ret = of_pci_parse_bus_range(np, &pcie->busn);
 	if (ret) {
-		dev_err(&pdev->dev, "failed to parse bus-range property: %d\n",
-			ret);
+		dev_err(dev, "failed to parse bus-range property: %d\n", ret);
 		return ret;
 	}
 
-	num = of_get_available_child_count(pdev->dev.of_node);
+	num = of_get_available_child_count(dev->of_node);
 
-	pcie->ports = devm_kcalloc(&pdev->dev, num, sizeof(*pcie->ports),
-				   GFP_KERNEL);
+	pcie->ports = devm_kcalloc(dev, num, sizeof(*pcie->ports), GFP_KERNEL);
 	if (!pcie->ports)
 		return -ENOMEM;
 
 	i = 0;
-	for_each_available_child_of_node(pdev->dev.of_node, child) {
+	for_each_available_child_of_node(dev->of_node, child) {
 		struct mvebu_pcie_port *port = &pcie->ports[i];
 
 		ret = mvebu_pcie_parse_port(pcie, port, child);
@@ -1266,8 +1264,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 
 		port->base = mvebu_pcie_map_registers(pdev, child, port);
 		if (IS_ERR(port->base)) {
-			dev_err(&pdev->dev, "%s: cannot map registers\n",
-				port->name);
+			dev_err(dev, "%s: cannot map registers\n", port->name);
 			port->base = NULL;
 			mvebu_pcie_powerdown(port);
 			continue;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] PCI: mvebu: Use existing of_node pointer
  2016-10-12 12:55 [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas
  2016-10-12 12:55 ` [PATCH v2 1/2] PCI: mvebu: Add local struct device pointers Bjorn Helgaas
@ 2016-10-12 12:56 ` Bjorn Helgaas
  2016-10-12 16:01 ` [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 12:56 UTC (permalink / raw)
  To: Jason Cooper; +Cc: linux-pci

Use the existing "np" pointer instead of looking up dev->of_node again.  No
functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pci-mvebu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 2515200..45a89d9 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1228,14 +1228,14 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	num = of_get_available_child_count(dev->of_node);
+	num = of_get_available_child_count(np);
 
 	pcie->ports = devm_kcalloc(dev, num, sizeof(*pcie->ports), GFP_KERNEL);
 	if (!pcie->ports)
 		return -ENOMEM;
 
 	i = 0;
-	for_each_available_child_of_node(dev->of_node, child) {
+	for_each_available_child_of_node(np, child) {
 		struct mvebu_pcie_port *port = &pcie->ports[i];
 
 		ret = mvebu_pcie_parse_port(pcie, port, child);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] PCI: mvebu: Cleanups
  2016-10-12 12:55 [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas
  2016-10-12 12:55 ` [PATCH v2 1/2] PCI: mvebu: Add local struct device pointers Bjorn Helgaas
  2016-10-12 12:56 ` [PATCH v2 2/2] PCI: mvebu: Use existing of_node pointer Bjorn Helgaas
@ 2016-10-12 16:01 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 16:01 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Jason Cooper, linux-pci

On Wed, Oct 12, 2016 at 07:55:50AM -0500, Bjorn Helgaas wrote:
>   - Add local "dev" pointers to reduce repetition of things like
>     "&pdev->dev".
> 
>   - Tidy up usage of of_node pointer
> 
> Nothing here should change the behavior of the driver.
> 
> Changes from v1:
>   Added of_node cleanup
>   Dropped "PCI: mvebu: Swap order of mvebu_writel() reg/val arguments"
> 
> ---
> 
> Bjorn Helgaas (2):
>       PCI: mvebu: Add local struct device pointers
>       PCI: mvebu: Use existing of_node pointer

I applied these to pci/host-mvebu for v4.9.  I hope to ask Linus to
pull them tomorrow, so if you see any issues, let me know soon.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-12 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 12:55 [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas
2016-10-12 12:55 ` [PATCH v2 1/2] PCI: mvebu: Add local struct device pointers Bjorn Helgaas
2016-10-12 12:56 ` [PATCH v2 2/2] PCI: mvebu: Use existing of_node pointer Bjorn Helgaas
2016-10-12 16:01 ` [PATCH v2 0/2] PCI: mvebu: Cleanups Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).