[LIBS] Add list_sort() API and also move sorting APIs to libs/common

Signed-off-by: Anup Patel <anup@brainfault.org>