
On Thu, Dec 25, 2008 at 11:56 AM, Shinya Kuribayashi shinya.kuribayashi@necel.com wrote:
Remy Bohmer wrote:
Create a default fallback routine that can be used if there is no strong implementation:
__attribute__((weak)) unsigned long long printk_clock(void) { return sched_clock(); }
and here is an example of the strong implementation (from the ARM architecture):
unsigned long long printk_clock(void) { return (unsigned long long)(jiffies - INITIAL_JIFFIES) * (1000000000 / HZ); }
If the strong implementation is available, the weak is simply discarded during linking, if the strong is omitted, the weak is used as fallback. This is a clean, lean and mean example without complex/superfluous aliases or checks for NULL pointers. It should not get any harder than this...
+1. I like this one, and U-Boot/MIPS _machine_restart() is implemented in the same manner.
Looks like removing the aliases seems to be gaining group consensus. Shall I create a patch which removes all the aliases (It will need thorough regression testing)