Alan wrote:
Jeff - at some point we could eliminate a lot of the NULL checks like
these by having the registration code fill in the defaults where
appropriate ?
libata policy up until this point has been to require all drivers fill
in the hook, either with the commonly-used default, or with their own
variant. Thus, no NULL checks for required hooks, and you get an oops
if you fail this requirement. I like that better than defaults buried
inside libata-core, where it is easier for programmers to forget them.
But actually, it's an open question for the compiler guys whether this
case is preferred:
if (ap->ops->hook)
ap->ops->hook(foo, bar);
else
commonly_used_default(foo, bar);
or this:
ap->ops->hook(foo, bar);
With advanced branch prediction in modern CPUs, ISTR the first case may
be worth considering, even with the branch.
If the second case is preferred, then Akira should make a bombing run
through each driver, applying the patch
+ .irq_on = ata_irq_on
No NULL checks or registration code bother, in that case.
Comments welcome...
Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html