Re: [RFC] Virtual methods for devices and generalized GPIO supportusing it

From: H. Peter Anvin
Date: Wed Mar 28 2007 - 12:33:35 EST


Paul Sokolovsky wrote:

In this respect, VTABLE(), METHOD() macros serve the same purpose as container_of() and list_for_each() - they are besides offering (more) convenient syntax, also carry important annotattion and educational
messages, like "it's ok, and encouraged to embed one structure into another - use it!" or "list manipulation is a trivial operation for kernel,
and we want you to treat it as such and use in standard, easily distinguishable way".


You realize, right, that the Linux kernel already have a much cleaner way to do vtables in the kernel, without this kind of macro crappage? It's called an _ops table, and is used in a patternized way:

foo->x_ops->func(foo, ...);

... all over the kernel. We like it that way.

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