/* Get maximum priority value for a given policy. 
See IEEE 1003.1  */
int sched_get_priority_max(int policy)
/* Get maximum priority value for a given policy. 
See IEEE 1003.1  */
int sched_get_priority_max(int policy)
{
	if (IS_ENABLED(CONFIG_COOP_ENABLED) && policy == SCHED_FIFO) {
		return CONFIG_NUM_COOP_PRIORITIES - 1;
	} else if (IS_ENABLED(CONFIG_PREEMPT_ENABLED) &&
		   (policy == SCHED_RR || policy == SCHED_OTHER)) {
		return CONFIG_NUM_PREEMPT_PRIORITIES - 1;
	}
	errno = EINVAL;
	return -1;
}