lkml.org 
[lkml]   [2010]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/11] pci: add pci_bridge_release_unused_res and pci_bus_release_unused_bridge_res
> +static void __ref pci_bus_release_bridge_resources(struct pci_bus *bus,
> + unsigned long type,
> + enum release_type rel_type)
> +{
> + struct pci_dev *dev;
> + bool is_leaf_bridge = true;
> +
> + list_for_each_entry(dev, &bus->devices, bus_list) {
> + struct pci_bus *b = dev->subordinate;
> + if (!b)
> + continue;
> +
> + switch (dev->class >> 8) {
> + case PCI_CLASS_BRIDGE_CARDBUS:
> + is_leaf_bridge = false;
> + break;
> +
> + case PCI_CLASS_BRIDGE_PCI:
> + default:
> + is_leaf_bridge = false;
> + if (rel_type == whole_subtree)
> + pci_bus_release_bridge_resources(b, type,
> + whole_subtree);
> + break;
> + }
> + }

I still don't understand this loop. Can't you write it like this:

list_for_each_entry(dev, &bus->devices, bus_list) {
struct pci_bus *b = dev->subordinate;
if (!b)
continue;

is_leaf_bridge = false;

if ((dev->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS)
continue;

if (rel_type == whole_subtree)
pci_bus_release_bridge_resources(b, type,
whole_subtree);
}

I'm looking at that 'default' label in your switch() statement
which causes us to always set is_leaf_bridge = false after 'b' is
valid.

/ac


\
 
 \ /
  Last update: 2010-01-19 22:29    [W:0.119 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site