add new files to open just into INTEL.
[apps/core/preloaded/ciss.git] / include / ciss-debug.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <dlog.h>
18 #ifndef CISS_LOG_TAG
19 #define CISS_LOG_TAG "CISS"
20 #endif
21
22 #define DBG(fmt, arg...) \
23         do { \
24                 LOG(LOG_INFO, CISS_LOG_TAG, "[CISS][%s:%d] "fmt"\n",  __func__, __LINE__, ##arg); \
25         } while(0)
26
27 #define ERR(fmt, arg...) \
28         do { \
29                 LOGE(""fmt"\n", ##arg); \
30         } while(0)
31
32 #  define warn_if(expr, fmt, arg...) do { \
33                 if(expr) { \
34                         DBG("(%s) -> "fmt, #expr, ##arg); \
35                 } \
36         } while (0)
37 #  define ret_if(expr) do { \
38                 if(expr) { \
39                         DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
40                         return; \
41                 } \
42         } while (0)
43 #  define retv_if(expr, val) do { \
44                 if(expr) { \
45                         DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
46                         return (val); \
47                 } \
48         } while (0)
49 #  define retm_if(expr, fmt, arg...) do { \
50                 if(expr) { \
51                         ERR(fmt, ##arg); \
52                         DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
53                         return; \
54                 } \
55         } while (0)
56 #  define retvm_if(expr, val, fmt, arg...) do { \
57                 if(expr) { \
58                         ERR(fmt, ##arg); \
59                         DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
60                         return (val); \
61                 } \
62         } while (0)
63