Messages in this thread | | | Date | Fri, 12 Sep 2003 17:22:54 +0100 | From | Jamie Lokier <> | Subject | Re: Memory mapped IO vs Port IO |
| |
Anthony Dominic Truong wrote: > Wouldn't it be better if we set the IN and OUT function pointers to the > right functions during driver init. based on the setting of dev->mmio. > And throughout the driver, we just call the IN and OUT functions by > their pointers. Then we don't have to do if (dev->mmio) every time. > It's similar to the concept of virtual member function in C++.
I think it would be faster to hide the "if (mmio)" part into an inline function which calls one or the other, given a resource cookie.
Branch prediction will remove most of the cost of a conditional test, which is always the same in these drivers after all, but I don't think it's quite so good at predicting indirect function calls.
-- Jamie - 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/
| |