USB: cp210x: fix up set_termios variables
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / sound / pci / asihpi / hpidebug.h
blob940f54c3c5383e377a77dbf3f794818f06147085
1 /*****************************************************************************
3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as
8 published by the Free Software Foundation;
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 Debug macros.
21 *****************************************************************************/
23 #ifndef _HPIDEBUG_H
24 #define _HPIDEBUG_H
26 #include "hpi_internal.h"
28 /* Define debugging levels. */
29 enum { HPI_DEBUG_LEVEL_ERROR = 0, /* always log errors */
30 HPI_DEBUG_LEVEL_WARNING = 1,
31 HPI_DEBUG_LEVEL_NOTICE = 2,
32 HPI_DEBUG_LEVEL_INFO = 3,
33 HPI_DEBUG_LEVEL_DEBUG = 4,
34 HPI_DEBUG_LEVEL_VERBOSE = 5 /* same printk level as DEBUG */
37 #define HPI_DEBUG_LEVEL_DEFAULT HPI_DEBUG_LEVEL_NOTICE
39 /* an OS can define an extra flag string that is appended to
40 the start of each message, eg see linux kernel hpios.h */
42 #ifdef SOURCEFILE_NAME
43 #define FILE_LINE SOURCEFILE_NAME ":" __stringify(__LINE__) " "
44 #else
45 #define FILE_LINE __FILE__ ":" __stringify(__LINE__) " "
46 #endif
48 #define HPI_DEBUG_ASSERT(expression) \
49 do { \
50 if (!(expression)) { \
51 printk(KERN_ERR FILE_LINE \
52 "ASSERT " __stringify(expression)); \
53 } \
54 } while (0)
56 #define HPI_DEBUG_LOG(level, ...) \
57 do { \
58 if (hpi_debug_level >= HPI_DEBUG_LEVEL_##level) { \
59 printk(HPI_DEBUG_FLAG_##level \
60 FILE_LINE __VA_ARGS__); \
61 } \
62 } while (0)
64 void hpi_debug_init(void);
65 int hpi_debug_level_set(int level);
66 int hpi_debug_level_get(void);
67 /* needed by Linux driver for dynamic debug level changes */
68 extern int hpi_debug_level;
70 void hpi_debug_message(struct hpi_message *phm, char *sz_fileline);
72 void hpi_debug_data(u16 *pdata, u32 len);
74 #define HPI_DEBUG_DATA(pdata, len) \
75 do { \
76 if (hpi_debug_level >= HPI_DEBUG_LEVEL_VERBOSE) \
77 hpi_debug_data(pdata, len); \
78 } while (0)
80 #define HPI_DEBUG_MESSAGE(level, phm) \
81 do { \
82 if (hpi_debug_level >= HPI_DEBUG_LEVEL_##level) { \
83 hpi_debug_message(phm, HPI_DEBUG_FLAG_##level \
84 FILE_LINE __stringify(level)); \
85 } \
86 } while (0)
88 #define HPI_DEBUG_RESPONSE(phr) \
89 do { \
90 if (((hpi_debug_level >= HPI_DEBUG_LEVEL_DEBUG) && \
91 (phr->error)) ||\
92 (hpi_debug_level >= HPI_DEBUG_LEVEL_VERBOSE)) \
93 printk(KERN_DEBUG "HPI_RES%d,%d,%d\n", \
94 phr->version, phr->error, phr->specific_error); \
95 } while (0)
97 #ifndef compile_time_assert
98 #define compile_time_assert(cond, msg) \
99 typedef char msg[(cond) ? 1 : -1]
100 #endif
102 #endif /* _HPIDEBUG_H_ */