2 * Copyright (C) 2011-2012 ARM Limited. All rights reserved.
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.
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.
12 #include "mali_osk_list.h"
13 #include "mali_session.h"
15 _MALI_OSK_LIST_HEAD(mali_sessions);
17 _mali_osk_lock_t *mali_sessions_lock;
19 _mali_osk_errcode_t mali_session_initialize(void)
21 _MALI_OSK_INIT_LIST_HEAD(&mali_sessions);
23 mali_sessions_lock = _mali_osk_lock_init(_MALI_OSK_LOCKFLAG_READERWRITER | _MALI_OSK_LOCKFLAG_ORDERED, 0, _MALI_OSK_LOCK_ORDER_SESSIONS);
25 if (NULL == mali_sessions_lock) return _MALI_OSK_ERR_NOMEM;
27 return _MALI_OSK_ERR_OK;
30 void mali_session_terminate(void)
32 _mali_osk_lock_term(mali_sessions_lock);
35 void mali_session_add(struct mali_session_data *session)
38 _mali_osk_list_add(&session->link, &mali_sessions);
39 mali_session_unlock();
42 void mali_session_remove(struct mali_session_data *session)
45 _mali_osk_list_delinit(&session->link);
46 mali_session_unlock();