[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100124.230251.177086043.davem@davemloft.net>
Date: Sun, 24 Jan 2010 23:02:51 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: jpirko@...hat.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next-2.6] net: use helpers to access uc list
From: Jiri Pirko <jpirko@...hat.com>
Date: Sun, 24 Jan 2010 11:42:45 +0100
> +#define netdev_uc_count(dev) ((dev)->uc.count)
> +
> +#define netdev_get_list_by_addr(a) \
> + (container_of((void *) a, struct netdev_hw_addr, addr)->list)
> +
> +#define netdev_get_addr_by_list(l) \
> + (list_entry(l, struct netdev_hw_addr, list)->addr)
> +
> +#define netdev_for_each_addr(a, head) \
> + for (a = netdev_get_addr_by_list((head)->next); \
> + prefetch(netdev_get_list_by_addr(a).next), \
> + &netdev_get_list_by_addr(a) != (head); \
> + a = netdev_get_addr_by_list(netdev_get_list_by_addr(a).next))
> +
> +#define netdev_for_each_uc_addr(a, dev) \
> + netdev_for_each_addr(a, &dev->uc.list)
> +
I should have mentioned this the other day, but I don't like
having "unsigned char *" being the type of the element iterator.
Sure it allows you, I guess, to eliminate one local variable
in the places the iterate, but it definitely is at the cost
of aestetics.
Please use some normal iterating object for the iterator, such as
"struct list_head *" or "struct netdev_hw_addr *". Probably the
latter would work best.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists