Support clocks for sync objects

A race still may happen after a few test set runs (in case the same slab object will be used), since completion variables are not handled yet.
This can be much simpler. No need for indices, macros and lots of unnecessary functions. Here is all you need:

void kt_cache_init(kt_cache_t *cache, size_t obj_size, size_t obj_max_num)
{
	phys_addr_t paddr;
	char *obj;
	int i;

	BUG_ON(obj_size == 0);
	BUG_ON(obj_max_num == 0);

	spin_lock_init(&cache->lock);
	obj_size = round_up(obj_size, sizeof(unsigned long));
	cache->memsize = obj_size * obj_max_num;
	/* memblock_alloc is available only during early boot. */
	paddr = memblock_alloc(cache->memsize, PAGE_SIZE);
	BUG_ON(paddr == 0);
	cache->base = phys_to_virt(paddr);
	cache->head = cache->base;

	for (i = 0, obj = cache->base; i < obj_max_num - 1; i++, obj += obj_size)
		*(void**)obj = obj + obj_size;
	*(void**)obj = NULL;
}

void kt_cache_destroy(kt_cache_t *cache)
{
	int rv;

	rv = memblock_free(cache->base, cache->memsize);
	BUG_ON(rv == 0);
}

void *kt_cache_alloc(kt_cache_t *cache)
{
	void *obj;

	spin_lock(&cache->lock);
	obj = cache->head;
	if(obj != NULL)
		cache->head = *(void**)obj;
	spin_unlock(&cache->lock);
	return obj;
}

void kt_cache_free(kt_cache_t *cache, void *obj)
{
	spin_lock(&cache->lock);
	*(void**)obj = cache->head;
	cache->head = obj;
	spin_unlock(&cache->lock);
}