linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Russell King <linux@arm.linux.org.uk>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH 2/9] PCI: mvebu: increment nports only for registered ports
Date: Tue, 13 Aug 2013 11:23:58 +0200	[thread overview]
Message-ID: <5209FB2E.5020808@gmail.com> (raw)
In-Reply-To: <20130813091539.20d4b6a3@skate>

On 08/13/13 09:15, Thomas Petazzoni wrote:
> Dear Sebastian Hesselbarth,
>
> On Mon, 12 Aug 2013 20:46:48 +0200, Sebastian Hesselbarth wrote:
>
>> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
>> index d5fe674..0a359d7 100644
>> --- a/drivers/pci/host/pci-mvebu.c
>> +++ b/drivers/pci/host/pci-mvebu.c
>> @@ -842,21 +842,21 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
>>   		return ret;
>>   	}
>>
>> +	i = 0;
>>   	for_each_child_of_node(pdev->dev.of_node, child) {
>>   		if (!of_device_is_available(child))
>>   			continue;
>> -		pcie->nports++;
>> +		i++;
>>   	}
>>
>> -	pcie->ports = devm_kzalloc(&pdev->dev, pcie->nports *
>> +	pcie->ports = devm_kzalloc(&pdev->dev, i *
>>   				   sizeof(struct mvebu_pcie_port),
>>   				   GFP_KERNEL);
>>   	if (!pcie->ports)
>>   		return -ENOMEM;
>>
>> -	i = 0;
>>   	for_each_child_of_node(pdev->dev.of_node, child) {
>> -		struct mvebu_pcie_port *port = &pcie->ports[i];
>> +		struct mvebu_pcie_port *port = &pcie->ports[pcie->nports];
>>
>>   		if (!of_device_is_available(child))
>>   			continue;
>> @@ -929,7 +929,7 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
>>   		port->dn = child;
>>   		spin_lock_init(&port->conf_lock);
>>   		mvebu_sw_pci_bridge_init(port);
>> -		i++;
>> +		pcie->nports++;
>>   	}
>
> I think I'd prefer using 'i' in this loop, and then after the loop have
> a:
>
> 	pcie->nports = i;
>
> assignment. That's nitpicking, but I don't like the fact that within
> the loop 'pcie->nports' doesn't mean "Number of enabled PCIe ports",
> but means "Last enabled PCIe port".

Ok, I'll use 'i' in both loops and assign it like you suggested.

Sebastian

  reply	other threads:[~2013-08-13  9:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 18:46 [PATCH 0/9] ARM: dove: DT PCIe support Sebastian Hesselbarth
2013-08-12 18:46 ` [PATCH 1/9] PCI: mvebu: move clock enable before register access Sebastian Hesselbarth
2013-08-13  7:11   ` Thomas Petazzoni
2013-08-13  9:22     ` Sebastian Hesselbarth
2013-08-13  7:58   ` Thierry Reding
2013-08-12 18:46 ` [PATCH 2/9] PCI: mvebu: increment nports only for registered ports Sebastian Hesselbarth
2013-08-13  7:15   ` Thomas Petazzoni
2013-08-13  9:23     ` Sebastian Hesselbarth [this message]
2013-08-12 18:46 ` [PATCH 3/9] PCI: mvebu: remove subsys_initcall Sebastian Hesselbarth
2013-08-13  7:19   ` Thomas Petazzoni
2013-08-13  8:06     ` Thierry Reding
2013-08-13  9:25       ` Sebastian Hesselbarth
2013-08-12 18:46 ` [PATCH 4/9] PCI: mvebu: add support for reset on GPIO Sebastian Hesselbarth
2013-08-13  0:56   ` Kumar Gala
2013-08-13  9:19     ` Sebastian Hesselbarth
2013-08-13  8:09   ` Thierry Reding
2013-08-13  8:30     ` Thomas Petazzoni
2013-08-13  9:59       ` Sascha Hauer
2013-08-13 10:03       ` Thierry Reding
2013-08-13 10:40         ` Sebastian Hesselbarth
2013-08-13 10:59           ` Philipp Zabel
2013-08-12 18:46 ` [PATCH 5/9] PCI: mvebu: add support for Marvell Dove SoCs Sebastian Hesselbarth
2013-08-12 20:54 ` [PATCH 0/9] ARM: dove: DT PCIe support Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5209FB2E.5020808@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).