Re: [PATCH] CKRM: 7/10 CKRM: Resource controller for number of tasks

From: Greg KH
Date: Mon Nov 29 2004 - 18:28:27 EST


On Mon, Nov 29, 2004 at 10:50:39AM -0800, Gerrit Huizenga wrote:
> +static spinlock_t stub_lock = SPIN_LOCK_UNLOCKED;
> +
> +static get_ref_t real_get_ref = NULL;
> +static put_ref_t real_put_ref = NULL;
> +
> +void ckrm_numtasks_register(get_ref_t gr, put_ref_t pr)
> +{
> + spin_lock(&stub_lock);
> + real_get_ref = gr;
> + real_put_ref = pr;
> + spin_unlock(&stub_lock);
> +}
> +
> +int numtasks_get_ref(void *arg, int force)
> +{
> + int ret = 1;
> + spin_lock(&stub_lock);
> + if (real_get_ref) {
> + ret = (*real_get_ref) (arg, force);
> + }
> + spin_unlock(&stub_lock);
> + return ret;
> +}
> +
> +void numtasks_put_ref(void *arg)
> +{
> + spin_lock(&stub_lock);
> + if (real_put_ref) {
> + (*real_put_ref) (arg);
> + }
> + spin_unlock(&stub_lock);
> +}
> +
> +EXPORT_SYMBOL(ckrm_numtasks_register);
> +EXPORT_SYMBOL(numtasks_get_ref);
> +EXPORT_SYMBOL(numtasks_put_ref);

Why are these functions used instead of calling the real functions?
They are only ever used to register a single set of functions anyway.

Oh, and void * is to be avoided at all costs...

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/