Re: [PATCH] PCI code cleanup

From: Kai Germaschewski (kai@tp1.ruhr-uni-bochum.de)
Date: Mon Feb 17 2003 - 21:57:53 EST


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:20 EST