tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / common / mali_scheduler.c
1 /*
2  * Copyright (C) 2011-2012 ARM Limited. All rights reserved.
3  *
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  *
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10
11 #include "mali_kernel_common.h"
12 #include "mali_osk.h"
13
14 static _mali_osk_atomic_t mali_job_autonumber;
15
16 _mali_osk_errcode_t mali_scheduler_initialize(void)
17 {
18         if ( _MALI_OSK_ERR_OK != _mali_osk_atomic_init(&mali_job_autonumber, 0))
19         {
20                 MALI_DEBUG_PRINT(1,  ("Initialization of atomic job id counter failed.\n"));
21                 return _MALI_OSK_ERR_FAULT;
22         }
23
24         return _MALI_OSK_ERR_OK;
25 }
26
27 void mali_scheduler_terminate(void)
28 {
29         _mali_osk_atomic_term(&mali_job_autonumber);
30 }
31
32 u32 mali_scheduler_get_new_id(void)
33 {
34         u32 job_id = _mali_osk_atomic_inc_return(&mali_job_autonumber);
35         return job_id;
36 }