/* Returns %0 on success and a negative error value otherwise.  */
int crw_register_handler(int rsc, crw_handler_t handler)
/* Returns %0 on success and a negative error value otherwise.  */
int crw_register_handler(int rsc, crw_handler_t handler)
{
	int rc = 0;
	if ((rsc < 0) || (rsc >= NR_RSCS))
		return -EINVAL;
	mutex_lock(&crw_handler_mutex);
	if (crw_handlers[rsc])
		rc = -EBUSY;
	else
		crw_handlers[rsc] = handler;
	mutex_unlock(&crw_handler_mutex);
	return rc;
}