* [PATCH 0/6] use list_for_each_entry() for bus->devices traversal
@ 2011-12-16 22:31 Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 1/6] frv/PCI: " Bjorn Helgaas
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:31 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci
These are pretty trivial; just replacing open-coded or list_for_each()
traversals with list_for_each_entry().
Most don't change any behavior, but parisc had what looks like a bug:
it enabled FBB/PERR/SERR repeatedly on the same device instead of on all
devices on the bus.
I finally built some cross-compilers, so these have all been compiled.
---
Bjorn Helgaas (6):
frv/PCI: use list_for_each_entry() for bus->devices traversal
MIPS: PCI: use list_for_each_entry() for bus->devices traversal
sh/PCI: use list_for_each_entry() for bus->devices traversal
sunhme/PCI: use list_for_each_entry() for bus->devices traversal
de4x5/PCI: use list_for_each_entry() for bus->devices traversal
parisc/PCI: use list_for_each_entry() for bus->devices traversal
arch/frv/mb93090-mb00/pci-vdk.c | 4 +---
arch/mips/pci/pci.c | 5 +----
arch/mips/pmc-sierra/yosemite/ht-irq.c | 10 ----------
arch/sh/drivers/pci/pci.c | 5 +----
drivers/net/ethernet/dec/tulip/de4x5.c | 9 ++-------
drivers/net/ethernet/sun/sunhme.c | 9 ++-------
drivers/parisc/dino.c | 6 ++----
drivers/parisc/lba_pci.c | 7 +++----
8 files changed, 12 insertions(+), 43 deletions(-)
--
Bjorn
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/6] frv/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
@ 2011-12-16 22:31 ` Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 2/6] MIPS: PCI: " Bjorn Helgaas
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:31 UTC (permalink / raw)
To: Jesse Barnes; +Cc: David Howells, linux-pci
Replace open-coded list traversal with list_for_each_entry().
CC: David Howells <dhowells@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/frv/mb93090-mb00/pci-vdk.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index 6b0b82f..37b5285 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -330,10 +330,8 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
pci_read_bridge_bases(bus);
if (bus->number == 0) {
- struct list_head *ln;
struct pci_dev *dev;
- for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
- dev = pci_dev_b(ln);
+ list_for_each_entry(dev, &bus->devices, bus_list) {
if (dev->devfn == 0) {
dev->resource[0].start = 0;
dev->resource[0].end = 0;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] MIPS: PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 1/6] frv/PCI: " Bjorn Helgaas
@ 2011-12-16 22:31 ` Bjorn Helgaas
2012-01-16 16:25 ` Ralf Baechle
2011-12-16 22:31 ` [PATCH 3/6] sh/PCI: " Bjorn Helgaas
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:31 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, Ralf Baechle, linux-mips
Replace open-coded list traversal with list_for_each_entry().
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/mips/pci/pci.c | 5 +----
arch/mips/pmc-sierra/yosemite/ht-irq.c | 10 ----------
2 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 934862c..ae5e423 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -273,7 +273,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
{
/* Propagate hose info into the subordinate devices. */
- struct list_head *ln;
struct pci_dev *dev = bus->self;
if (pci_probe_only && dev &&
@@ -282,9 +281,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
pcibios_fixup_device_resources(dev, bus);
}
- for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
- dev = pci_dev_b(ln);
-
+ list_for_each_entry(dev, &bus->devices, bus_list) {
if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
pcibios_fixup_device_resources(dev, bus);
}
diff --git a/arch/mips/pmc-sierra/yosemite/ht-irq.c b/arch/mips/pmc-sierra/yosemite/ht-irq.c
index 86b98e9..62ead66 100644
--- a/arch/mips/pmc-sierra/yosemite/ht-irq.c
+++ b/arch/mips/pmc-sierra/yosemite/ht-irq.c
@@ -35,16 +35,6 @@
*/
void __init titan_ht_pcibios_fixup_bus(struct pci_bus *bus)
{
- struct pci_bus *current_bus = bus;
- struct pci_dev *devices;
- struct list_head *devices_link;
-
- list_for_each(devices_link, &(current_bus->devices)) {
- devices = pci_dev_b(devices_link);
- if (devices == NULL)
- continue;
- }
-
/*
* PLX and SPKT related changes go here
*/
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/6] sh/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 1/6] frv/PCI: " Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 2/6] MIPS: PCI: " Bjorn Helgaas
@ 2011-12-16 22:31 ` Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 4/6] sunhme/PCI: " Bjorn Helgaas
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:31 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, Paul Mundt, linux-sh
Replace open-coded list traversal with list_for_each_entry().
CC: Paul Mundt <lethal@linux-sh.org>
CC: linux-sh@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/sh/drivers/pci/pci.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index af9246d..e425b08 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -171,11 +171,8 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev,
void __devinit pcibios_fixup_bus(struct pci_bus *bus)
{
struct pci_dev *dev;
- struct list_head *ln;
-
- for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
- dev = pci_dev_b(ln);
+ list_for_each_entry(dev, &bus->devices, bus_list) {
if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
pcibios_fixup_device_resources(dev, bus);
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] sunhme/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
` (2 preceding siblings ...)
2011-12-16 22:31 ` [PATCH 3/6] sh/PCI: " Bjorn Helgaas
@ 2011-12-16 22:31 ` Bjorn Helgaas
2011-12-19 21:13 ` David Miller
2011-12-16 22:31 ` [PATCH 5/6] de4x5/PCI: " Bjorn Helgaas
2011-12-16 22:32 ` [PATCH 6/6] parisc/PCI: " Bjorn Helgaas
5 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:31 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, David S. Miller, netdev
Replace open-coded list traversal with list_for_each_entry().
CC: David S. Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/net/ethernet/sun/sunhme.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index cf14ab9..1d00a4c 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2849,7 +2849,7 @@ err_out:
static int is_quattro_p(struct pci_dev *pdev)
{
struct pci_dev *busdev = pdev->bus->self;
- struct list_head *tmp;
+ struct pci_dev *this_pdev;
int n_hmes;
if (busdev == NULL ||
@@ -2858,15 +2858,10 @@ static int is_quattro_p(struct pci_dev *pdev)
return 0;
n_hmes = 0;
- tmp = pdev->bus->devices.next;
- while (tmp != &pdev->bus->devices) {
- struct pci_dev *this_pdev = pci_dev_b(tmp);
-
+ list_for_each_entry(this_pdev, &pdev->bus->devices, bus_list) {
if (this_pdev->vendor == PCI_VENDOR_ID_SUN &&
this_pdev->device == PCI_DEVICE_ID_SUN_HAPPYMEAL)
n_hmes++;
-
- tmp = tmp->next;
}
if (n_hmes != 4)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/6] de4x5/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
` (3 preceding siblings ...)
2011-12-16 22:31 ` [PATCH 4/6] sunhme/PCI: " Bjorn Helgaas
@ 2011-12-16 22:31 ` Bjorn Helgaas
2011-12-16 22:34 ` Grant Grundler
2011-12-19 21:13 ` David Miller
2011-12-16 22:32 ` [PATCH 6/6] parisc/PCI: " Bjorn Helgaas
5 siblings, 2 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:31 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, Grant Grundler, netdev
Replace open-coded list traversal with list_for_each_entry().
CC: Grant Grundler <grundler@parisc-linux.org>
CC: netdev@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/net/ethernet/dec/tulip/de4x5.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
index 871bcaa..3f5d3b9 100644
--- a/drivers/net/ethernet/dec/tulip/de4x5.c
+++ b/drivers/net/ethernet/dec/tulip/de4x5.c
@@ -2127,14 +2127,9 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
u_long iobase = 0; /* Clear upper 32 bits in Alphas */
int i, j;
struct de4x5_private *lp = netdev_priv(dev);
- struct list_head *walk;
-
- list_for_each(walk, &pdev->bus_list) {
- struct pci_dev *this_dev = pci_dev_b(walk);
-
- /* Skip the pci_bus list entry */
- if (list_entry(walk, struct pci_bus, devices) == pdev->bus) continue;
+ struct pci_dev *this_dev;
+ list_for_each_entry(this_dev, &pdev->bus->devices, bus_list) {
vendor = this_dev->vendor;
device = this_dev->device << 8;
if (!(is_DC21040 || is_DC21041 || is_DC21140 || is_DC2114x)) continue;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/6] parisc/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
` (4 preceding siblings ...)
2011-12-16 22:31 ` [PATCH 5/6] de4x5/PCI: " Bjorn Helgaas
@ 2011-12-16 22:32 ` Bjorn Helgaas
5 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2011-12-16 22:32 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, linux-parisc
Replace open-coded list traversal with list_for_each_entry().
Note that parisc lba_fixup_bus() previously enabled FBB/PERR/SERR
repeatedly on the same device instead of doing it on all devices on
the bus.
CC: linux-parisc@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/parisc/dino.c | 6 ++----
drivers/parisc/lba_pci.c | 7 +++----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index 7ff10c1..6f5bf3e 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -478,14 +478,12 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr)
if (ccio_allocate_resource(dino_dev->hba.dev, res, _8MB,
F_EXTEND(0xf0000000UL) | _8MB,
F_EXTEND(0xffffffffUL) &~ _8MB, _8MB) < 0) {
- struct list_head *ln, *tmp_ln;
+ struct pci_dev *dev, *tmp;
printk(KERN_ERR "Dino: cannot attach bus %s\n",
dev_name(bus->bridge));
/* kill the bus, we can't do anything with it */
- list_for_each_safe(ln, tmp_ln, &bus->devices) {
- struct pci_dev *dev = pci_dev_b(ln);
-
+ list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
list_del(&dev->bus_list);
}
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index d5f3d75..f0b00f8 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -630,7 +630,7 @@ truncate_pat_collision(struct resource *root, struct resource *new)
static void
lba_fixup_bus(struct pci_bus *bus)
{
- struct list_head *ln;
+ struct pci_dev *dev;
#ifdef FBB_SUPPORT
u16 status;
#endif
@@ -712,9 +712,8 @@ lba_fixup_bus(struct pci_bus *bus)
}
- list_for_each(ln, &bus->devices) {
+ list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
- struct pci_dev *dev = pci_dev_b(ln);
DBG("lba_fixup_bus() %s\n", pci_name(dev));
@@ -793,7 +792,7 @@ lba_fixup_bus(struct pci_bus *bus)
}
/* Lastly enable FBB/PERR/SERR on all devices too */
- list_for_each(ln, &bus->devices) {
+ list_for_each_entry(dev, &bus->devices, bus_list) {
(void) pci_read_config_word(dev, PCI_COMMAND, &status);
status |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR | fbb_enable;
(void) pci_write_config_word(dev, PCI_COMMAND, status);
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] de4x5/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 ` [PATCH 5/6] de4x5/PCI: " Bjorn Helgaas
@ 2011-12-16 22:34 ` Grant Grundler
2011-12-19 21:13 ` David Miller
1 sibling, 0 replies; 11+ messages in thread
From: Grant Grundler @ 2011-12-16 22:34 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Jesse Barnes, linux-pci, Grant Grundler, netdev
On Fri, Dec 16, 2011 at 2:31 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> Replace open-coded list traversal with list_for_each_entry().
Hi Bjorn,
I don't have any de4x5 devices to test this but it looks correct to me.
Thanks!
grant
>
> CC: Grant Grundler <grundler@parisc-linux.org>
> CC: netdev@vger.kernel.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/net/ethernet/dec/tulip/de4x5.c | 9 ++-------
> 1 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
> index 871bcaa..3f5d3b9 100644
> --- a/drivers/net/ethernet/dec/tulip/de4x5.c
> +++ b/drivers/net/ethernet/dec/tulip/de4x5.c
> @@ -2127,14 +2127,9 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
> u_long iobase = 0; /* Clear upper 32 bits in Alphas */
> int i, j;
> struct de4x5_private *lp = netdev_priv(dev);
> - struct list_head *walk;
> -
> - list_for_each(walk, &pdev->bus_list) {
> - struct pci_dev *this_dev = pci_dev_b(walk);
> -
> - /* Skip the pci_bus list entry */
> - if (list_entry(walk, struct pci_bus, devices) == pdev->bus) continue;
> + struct pci_dev *this_dev;
>
> + list_for_each_entry(this_dev, &pdev->bus->devices, bus_list) {
> vendor = this_dev->vendor;
> device = this_dev->device << 8;
> if (!(is_DC21040 || is_DC21041 || is_DC21140 || is_DC2114x)) continue;
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/6] sunhme/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 ` [PATCH 4/6] sunhme/PCI: " Bjorn Helgaas
@ 2011-12-19 21:13 ` David Miller
0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2011-12-19 21:13 UTC (permalink / raw)
To: bhelgaas; +Cc: jbarnes, linux-pci, netdev
From: Bjorn Helgaas <bhelgaas@google.com>
Date: Fri, 16 Dec 2011 15:31:49 -0700
> Replace open-coded list traversal with list_for_each_entry().
>
> CC: David S. Miller <davem@davemloft.net>
> CC: netdev@vger.kernel.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Applied.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] de4x5/PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 ` [PATCH 5/6] de4x5/PCI: " Bjorn Helgaas
2011-12-16 22:34 ` Grant Grundler
@ 2011-12-19 21:13 ` David Miller
1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2011-12-19 21:13 UTC (permalink / raw)
To: bhelgaas; +Cc: jbarnes, linux-pci, grundler, netdev
From: Bjorn Helgaas <bhelgaas@google.com>
Date: Fri, 16 Dec 2011 15:31:54 -0700
> Replace open-coded list traversal with list_for_each_entry().
>
> CC: Grant Grundler <grundler@parisc-linux.org>
> CC: netdev@vger.kernel.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Applied.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/6] MIPS: PCI: use list_for_each_entry() for bus->devices traversal
2011-12-16 22:31 ` [PATCH 2/6] MIPS: PCI: " Bjorn Helgaas
@ 2012-01-16 16:25 ` Ralf Baechle
0 siblings, 0 replies; 11+ messages in thread
From: Ralf Baechle @ 2012-01-16 16:25 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Jesse Barnes, linux-pci, linux-mips
Thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-01-16 16:48 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 22:31 [PATCH 0/6] use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 1/6] frv/PCI: " Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 2/6] MIPS: PCI: " Bjorn Helgaas
2012-01-16 16:25 ` Ralf Baechle
2011-12-16 22:31 ` [PATCH 3/6] sh/PCI: " Bjorn Helgaas
2011-12-16 22:31 ` [PATCH 4/6] sunhme/PCI: " Bjorn Helgaas
2011-12-19 21:13 ` David Miller
2011-12-16 22:31 ` [PATCH 5/6] de4x5/PCI: " Bjorn Helgaas
2011-12-16 22:34 ` Grant Grundler
2011-12-19 21:13 ` David Miller
2011-12-16 22:32 ` [PATCH 6/6] parisc/PCI: " 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).