Re: [PATCH] PCI code cleanup

Kai Germaschewski
2003-02-18T02:47:56Z

On 18 Feb 2003, Louis Zhuang wrote:

> The patch clean up some old-style usage of list_head. Pls apply if you
> like it. Thanks

> ===== drivers/pci/probe.c 1.26 vs edited =====
> -- 1.26/drivers/pci/probe.c Mon Jan 13 11:44:26 2003
> +++ edited/drivers/pci/probe.c Tue Feb 18 09:28:40 2003
> @@ -533,7 +533,7 @@
> {
> const struct list_head *l;
>
> - for(l=list->next; l != list; l = l->next) {
> + list_for_each(l, list) {
> const struct pci_bus *b = pci_bus_b(l);
> if (b->number == nr || pci_bus_exists(&b->children, nr))
> return 1;

Well, if you're changing that anyway, you could as well use

{
const struct pci_bus *b;

list_for_each_entry(b, list) {
if (b->number ...

which looks even nicer ;-)

--Kai