staging: unisys: remove BOOL,TRUE,FALSE definitions
[deliverable/linux.git] / drivers / staging / unisys / include / timskmod.h
1 /* timskmod.h
2 *
3 * Copyright (C) 2010 - 2013 UNISYS CORPORATION
4 * All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 */
17
18 #ifndef __TIMSKMOD_H__
19 #define __TIMSKMOD_H__
20
21 #include <linux/version.h>
22 #include <linux/init.h>
23 #include <linux/kernel.h>
24 #include <linux/device.h>
25 #include <linux/kobject.h>
26 #include <linux/sysfs.h>
27 #include <linux/fs.h>
28 #include <linux/string.h>
29 #include <linux/sched.h>
30 #include <linux/spinlock.h>
31 #include <linux/slab.h>
32 #include <linux/errno.h>
33 #include <linux/interrupt.h>
34 #include <linux/wait.h>
35 #include <linux/vmalloc.h>
36 #include <linux/proc_fs.h>
37 #include <linux/cdev.h>
38 #include <linux/types.h>
39 #include <asm/irq.h>
40 #include <linux/io.h>
41 #include <asm/dma.h>
42 #include <linux/uaccess.h>
43 #include <linux/list.h>
44 #include <linux/poll.h>
45 /* #define EXPORT_SYMTAB */
46 #include <linux/module.h>
47 #include <linux/moduleparam.h>
48 #include <linux/fcntl.h>
49 #include <linux/workqueue.h>
50 #include <linux/kthread.h>
51 #include <linux/seq_file.h>
52 #include <linux/mm.h>
53
54 /* #define DEBUG */
55 #if !defined SUCCESS
56 #define SUCCESS 0
57 #endif
58 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
59 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
60 #define STRUCTSEQUAL(x, y) (memcmp(&x, &y, sizeof(x)) == 0)
61 #ifndef HOSTADDRESS
62 #define HOSTADDRESS unsigned long long
63 #endif
64
65 #define sizeofmember(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
66 /** "Covered quotient" function */
67 #define COVQ(v, d) (((v) + (d) - 1) / (d))
68 #define SWAPPOINTERS(p1, p2) \
69 do { \
70 void *SWAPPOINTERS_TEMP = (void *)p1; \
71 (void *)(p1) = (void *)(p2); \
72 (void *)(p2) = SWAPPOINTERS_TEMP; \
73 } while (0)
74
75 #define WARNDRV(fmt, args...) LOGWRN(fmt, ## args)
76 #define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args)
77
78 #define PRINTKDEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args)
79 #define TBDDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args)
80 #define HUHDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args)
81 #define ERRDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args)
82 #define ERRDEVX(devno, fmt, args...) LOGERRDEVX(devno, fmt, ## args)
83 #define WARNDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args)
84 #define SECUREDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args)
85 #define INFODEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args)
86 #define INFODEVX(devno, fmt, args...) LOGINFDEVX(devno, fmt, ## args)
87
88 /** Verifies the consistency of your PRIVATEDEVICEDATA structure using
89 * conventional "signature" fields:
90 * <p>
91 * - sig1 should contain the size of the structure
92 * - sig2 should contain a pointer to the beginning of the structure
93 */
94 #define DDLOOKSVALID(dd) \
95 ((dd != NULL) && \
96 ((dd)->sig1 == sizeof(PRIVATEDEVICEDATA)) && \
97 ((dd)->sig2 == dd))
98
99 /** Verifies the consistency of your PRIVATEFILEDATA structure using
100 * conventional "signature" fields:
101 * <p>
102 * - sig1 should contain the size of the structure
103 * - sig2 should contain a pointer to the beginning of the structure
104 */
105 #define FDLOOKSVALID(fd) \
106 ((fd != NULL) && \
107 ((fd)->sig1 == sizeof(PRIVATEFILEDATA)) && \
108 ((fd)->sig2 == fd))
109
110 /** Sleep for an indicated number of seconds (for use in kernel mode).
111 * x - the number of seconds to sleep.
112 */
113 #define SLEEP(x) \
114 do { __set_current_state(TASK_INTERRUPTIBLE); \
115 schedule_timeout((x)*HZ); \
116 } while (0)
117
118 /** Sleep for an indicated number of jiffies (for use in kernel mode).
119 * x - the number of jiffies to sleep.
120 */
121 #define SLEEPJIFFIES(x) \
122 do { __set_current_state(TASK_INTERRUPTIBLE); \
123 schedule_timeout(x); \
124 } while (0)
125
126 static inline struct cdev *cdev_alloc_init(struct module *owner,
127 const struct file_operations *fops)
128 {
129 struct cdev *cdev = NULL;
130
131 cdev = cdev_alloc();
132 if (!cdev)
133 return NULL;
134 cdev->ops = fops;
135 cdev->owner = owner;
136
137 /* Note that the memory allocated for cdev will be deallocated
138 * when the usage count drops to 0, because it is controlled
139 * by a kobject of type ktype_cdev_dynamic. (This
140 * deallocation could very well happen outside of our kernel
141 * module, like via the cdev_put in __fput() for example.)
142 */
143 return cdev;
144 }
145
146 extern int unisys_spar_platform;
147
148 #endif
This page took 0.044975 seconds and 5 git commands to generate.