Re: [PATCH] PCI code cleanup

Kai Germaschewski (kai@tp1.ruhr-uni-bochum.de)
Mon, 17 Feb 2003 20:57:53 -0600 (CST)


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/