Files
android_kernel_samsung_sm86…/qdf/inc/qdf_timer.h
Dustin Brown 121d7d1bff qcacmn: Return QDF_STATUS from qdf_timer_init()
In preparation for QDF timer tracking, return QDF_STATUS from
qdf_timer_init(). This allows callers to handle the eventual possibility
of a QDF timer init failure.

Change-Id: I9da4643610099d32b002bda9218af26247a4edc6
CRs-Fixed: 2327724
2018-10-05 19:58:09 -07:00

122 lines
3.1 KiB
C

/*
* Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: qdf_timer
* This file abstracts OS timers running in soft IRQ context.
*/
#ifndef _QDF_TIMER_H
#define _QDF_TIMER_H
#include <qdf_types.h>
#include <i_qdf_timer.h>
/* Platform timer object */
typedef __qdf_timer_t qdf_timer_t;
/**
* qdf_timer_init() - initialize a timer
* @hdl: OS handle
* @timer: Timer object pointer
* @func: Timer function
* @arg: Argument of timer function
* @type: deferrable or non deferrable timer type
*
* Timer type QDF_TIMER_TYPE_SW means its a deferrable sw timer which will
* not cause CPU wake upon expiry
* Timer type QDF_TIMER_TYPE_WAKE_APPS means its a non-deferrable timer which
* will cause CPU wake up on expiry
*
* Return: QDF_STATUS
*/
static inline QDF_STATUS
qdf_timer_init(qdf_handle_t hdl, qdf_timer_t *timer, qdf_timer_func_t func,
void *arg, QDF_TIMER_TYPE type)
{
return __qdf_timer_init(timer, func, arg, type);
}
/**
* qdf_timer_start() - start a one-shot timer
* @timer: Timer object pointer
* @msec: Expiration period in milliseconds
*
* Return: none
*/
static inline void
qdf_timer_start(qdf_timer_t *timer, int msec)
{
__qdf_timer_start(timer, msec);
}
/**
* qdf_timer_mod() - modify existing timer to new timeout value
* @timer: Timer object pointer
* @msec: Expiration period in milliseconds
*
* Return: none
*/
static inline void qdf_timer_mod(qdf_timer_t *timer, int msec)
{
__qdf_timer_mod(timer, msec);
}
/**
* qdf_timer_stop() - cancel qdf timer
* @timer: Timer object pointer
*
* return: bool TRUE Timer was cancelled and deactived
* FALSE Timer was cancelled but already got fired.
*
* The function will return after any running timer completes.
*/
static inline bool qdf_timer_stop(qdf_timer_t *timer)
{
return __qdf_timer_stop(timer);
}
/**
* qdf_timer_sync_cancel - Cancel a timer synchronously
* The function will return after any running timer completes.
* @timer: timer object pointer
*
* return: bool TRUE timer was cancelled and deactived
* FALSE timer was not cancelled
*/
static inline bool qdf_timer_sync_cancel(qdf_timer_t *timer)
{
return __qdf_timer_sync_cancel(timer);
}
/**
* qdf_timer_free() - free qdf timer
* @timer: Timer object pointer
*
* The function will return after any running timer completes.
* Return: none
*/
static inline void qdf_timer_free(qdf_timer_t *timer)
{
__qdf_timer_free(timer);
}
#endif /* _QDF_TIMER_H */