aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLior Dotan <liodot@gmail.com>2008-10-17 05:30:07 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-22 12:56:30 -0400
commit0b65d3cc773f29354090cca865732308f675e1ef (patch)
tree2357753917f59d2ed432d7d5c5a01510879093c8
parentb4c0ed116928d59b00cd162bb0083629829fab8c (diff)
Staging: Fixes for me4000 pci data collection driver
Following Andrew Morton's review for this patch I made a patch that fixes most of the remarks. I've converted the sleep_on_timeout to wait_event_timeout but I probably not in the right way. Also I don't know what's the problem with the calls for get_user() so I left them untouched. Signed-off-by: Lior Dotan <liodot@gmail.com> Cc: Andrew Morton <akpm@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/me4000/me4000.c896
-rw-r--r--drivers/staging/me4000/me4000.h194
2 files changed, 545 insertions, 545 deletions
diff --git a/drivers/staging/me4000/me4000.c b/drivers/staging/me4000/me4000.c
index 862dd7ffb5c0..75c268c37308 100644
--- a/drivers/staging/me4000/me4000.c
+++ b/drivers/staging/me4000/me4000.c
@@ -25,24 +25,21 @@
25#include <linux/sched.h> 25#include <linux/sched.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <asm/io.h>
29#include <asm/system.h>
30#include <asm/uaccess.h>
31#include <linux/errno.h> 28#include <linux/errno.h>
32#include <linux/delay.h> 29#include <linux/delay.h>
33#include <linux/fs.h>
34#include <linux/mm.h> 30#include <linux/mm.h>
35#include <linux/unistd.h> 31#include <linux/unistd.h>
36#include <linux/list.h> 32#include <linux/list.h>
37#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
38 34#include <linux/types.h>
39#include <linux/poll.h> 35#include <linux/poll.h>
40#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37#include <linux/slab.h>
41#include <asm/pgtable.h> 38#include <asm/pgtable.h>
42#include <asm/uaccess.h> 39#include <asm/uaccess.h>
43#include <linux/types.h> 40#include <asm/io.h>
44 41#include <asm/system.h>
45#include <linux/slab.h> 42#include <asm/uaccess.h>
46 43
47/* Include-File for the Meilhaus ME-4000 I/O board */ 44/* Include-File for the Meilhaus ME-4000 I/O board */
48#include "me4000.h" 45#include "me4000.h"
@@ -57,14 +54,14 @@ MODULE_SUPPORTED_DEVICE("Meilhaus ME-4000 Multi I/O boards");
57MODULE_LICENSE("GPL"); 54MODULE_LICENSE("GPL");
58 55
59/* Board specific data are kept in a global list */ 56/* Board specific data are kept in a global list */
60LIST_HEAD(me4000_board_info_list); 57static LIST_HEAD(me4000_board_info_list);
61 58
62/* Major Device Numbers. 0 means to get it automatically from the System */ 59/* Major Device Numbers. 0 means to get it automatically from the System */
63static int me4000_ao_major_driver_no = 0; 60static int me4000_ao_major_driver_no;
64static int me4000_ai_major_driver_no = 0; 61static int me4000_ai_major_driver_no;
65static int me4000_dio_major_driver_no = 0; 62static int me4000_dio_major_driver_no;
66static int me4000_cnt_major_driver_no = 0; 63static int me4000_cnt_major_driver_no;
67static int me4000_ext_int_major_driver_no = 0; 64static int me4000_ext_int_major_driver_no;
68 65
69/* Let the user specify a custom major driver number */ 66/* Let the user specify a custom major driver number */
70module_param(me4000_ao_major_driver_no, int, 0); 67module_param(me4000_ao_major_driver_no, int, 0);
@@ -88,36 +85,22 @@ MODULE_PARM_DESC(me4000_ext_int_major_driver_no,
88 "Major driver number for external interrupt (default 0)"); 85 "Major driver number for external interrupt (default 0)");
89 86
90/*----------------------------------------------------------------------------- 87/*-----------------------------------------------------------------------------
91 Module stuff
92 ---------------------------------------------------------------------------*/
93int init_module(void);
94void cleanup_module(void);
95
96/*-----------------------------------------------------------------------------
97 Board detection and initialization 88 Board detection and initialization
98 ---------------------------------------------------------------------------*/ 89 ---------------------------------------------------------------------------*/
99static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id); 90static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id);
100static int me4000_xilinx_download(me4000_info_t *); 91static int me4000_xilinx_download(struct me4000_info *);
101static int me4000_reset_board(me4000_info_t *); 92static int me4000_reset_board(struct me4000_info *);
102 93
103static void clear_board_info_list(void); 94static void clear_board_info_list(void);
104static int get_registers(struct pci_dev *dev, me4000_info_t * info); 95static void release_ao_contexts(struct me4000_info *board_info);
105static int init_board_info(struct pci_dev *dev, me4000_info_t * board_info);
106static int alloc_ao_contexts(me4000_info_t * info);
107static void release_ao_contexts(me4000_info_t * board_info);
108static int alloc_ai_context(me4000_info_t * info);
109static int alloc_dio_context(me4000_info_t * info);
110static int alloc_cnt_context(me4000_info_t * info);
111static int alloc_ext_int_context(me4000_info_t * info);
112
113/*----------------------------------------------------------------------------- 96/*-----------------------------------------------------------------------------
114 Stuff used by all device parts 97 Stuff used by all device parts
115 ---------------------------------------------------------------------------*/ 98 ---------------------------------------------------------------------------*/
116static int me4000_open(struct inode *, struct file *); 99static int me4000_open(struct inode *, struct file *);
117static int me4000_release(struct inode *, struct file *); 100static int me4000_release(struct inode *, struct file *);
118 101
119static int me4000_get_user_info(me4000_user_info_t *, 102static int me4000_get_user_info(struct me4000_user_info *,
120 me4000_info_t * board_info); 103 struct me4000_info *board_info);
121static int me4000_read_procmem(char *, char **, off_t, int, int *, void *); 104static int me4000_read_procmem(char *, char **, off_t, int, int *, void *);
122 105
123/*----------------------------------------------------------------------------- 106/*-----------------------------------------------------------------------------
@@ -140,40 +123,42 @@ static int me4000_ao_ioctl_cont(struct inode *, struct file *, unsigned int,
140static unsigned int me4000_ao_poll_cont(struct file *, poll_table *); 123static unsigned int me4000_ao_poll_cont(struct file *, poll_table *);
141static int me4000_ao_fsync_cont(struct file *, struct dentry *, int); 124static int me4000_ao_fsync_cont(struct file *, struct dentry *, int);
142 125
143static int me4000_ao_start(unsigned long *, me4000_ao_context_t *); 126static int me4000_ao_start(unsigned long *, struct me4000_ao_context *);
144static int me4000_ao_stop(me4000_ao_context_t *); 127static int me4000_ao_stop(struct me4000_ao_context *);
145static int me4000_ao_immediate_stop(me4000_ao_context_t *); 128static int me4000_ao_immediate_stop(struct me4000_ao_context *);
146static int me4000_ao_timer_set_divisor(u32 *, me4000_ao_context_t *); 129static int me4000_ao_timer_set_divisor(u32 *, struct me4000_ao_context *);
147static int me4000_ao_preload(me4000_ao_context_t *); 130static int me4000_ao_preload(struct me4000_ao_context *);
148static int me4000_ao_preload_update(me4000_ao_context_t *); 131static int me4000_ao_preload_update(struct me4000_ao_context *);
149static int me4000_ao_ex_trig_set_edge(int *, me4000_ao_context_t *); 132static int me4000_ao_ex_trig_set_edge(int *, struct me4000_ao_context *);
150static int me4000_ao_ex_trig_enable(me4000_ao_context_t *); 133static int me4000_ao_ex_trig_enable(struct me4000_ao_context *);
151static int me4000_ao_ex_trig_disable(me4000_ao_context_t *); 134static int me4000_ao_ex_trig_disable(struct me4000_ao_context *);
152static int me4000_ao_prepare(me4000_ao_context_t * ao_info); 135static int me4000_ao_prepare(struct me4000_ao_context *ao_info);
153static int me4000_ao_reset(me4000_ao_context_t * ao_info); 136static int me4000_ao_reset(struct me4000_ao_context *ao_info);
154static int me4000_ao_enable_do(me4000_ao_context_t *); 137static int me4000_ao_enable_do(struct me4000_ao_context *);
155static int me4000_ao_disable_do(me4000_ao_context_t *); 138static int me4000_ao_disable_do(struct me4000_ao_context *);
156static int me4000_ao_fsm_state(int *, me4000_ao_context_t *); 139static int me4000_ao_fsm_state(int *, struct me4000_ao_context *);
157 140
158static int me4000_ao_simultaneous_ex_trig(me4000_ao_context_t * ao_context); 141static int me4000_ao_simultaneous_ex_trig(struct me4000_ao_context *ao_context);
159static int me4000_ao_simultaneous_sw(me4000_ao_context_t * ao_context); 142static int me4000_ao_simultaneous_sw(struct me4000_ao_context *ao_context);
160static int me4000_ao_simultaneous_disable(me4000_ao_context_t * ao_context); 143static int me4000_ao_simultaneous_disable(struct me4000_ao_context *ao_context);
161static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * channels, 144static int me4000_ao_simultaneous_update(
162 me4000_ao_context_t * ao_context); 145 struct me4000_ao_channel_list *channels,
163 146 struct me4000_ao_context *ao_context);
164static int me4000_ao_synchronous_ex_trig(me4000_ao_context_t * ao_context); 147
165static int me4000_ao_synchronous_sw(me4000_ao_context_t * ao_context); 148static int me4000_ao_synchronous_ex_trig(struct me4000_ao_context *ao_context);
166static int me4000_ao_synchronous_disable(me4000_ao_context_t * ao_context); 149static int me4000_ao_synchronous_sw(struct me4000_ao_context *ao_context);
150static int me4000_ao_synchronous_disable(struct me4000_ao_context *ao_context);
167 151
168static int me4000_ao_ex_trig_timeout(unsigned long *arg, 152static int me4000_ao_ex_trig_timeout(unsigned long *arg,
169 me4000_ao_context_t * ao_context); 153 struct me4000_ao_context *ao_context);
170static int me4000_ao_get_free_buffer(unsigned long *arg, 154static int me4000_ao_get_free_buffer(unsigned long *arg,
171 me4000_ao_context_t * ao_context); 155 struct me4000_ao_context *ao_context);
172 156
173/*----------------------------------------------------------------------------- 157/*-----------------------------------------------------------------------------
174 Analog input stuff 158 Analog input stuff
175 ---------------------------------------------------------------------------*/ 159 ---------------------------------------------------------------------------*/
176static int me4000_ai_single(me4000_ai_single_t *, me4000_ai_context_t *); 160static int me4000_ai_single(struct me4000_ai_single *,
161 struct me4000_ai_context *);
177static int me4000_ai_ioctl_sing(struct inode *, struct file *, unsigned int, 162static int me4000_ai_ioctl_sing(struct inode *, struct file *, unsigned int,
178 unsigned long); 163 unsigned long);
179 164
@@ -186,68 +171,69 @@ static int me4000_ai_fasync(int fd, struct file *file_p, int mode);
186static int me4000_ai_ioctl_ext(struct inode *, struct file *, unsigned int, 171static int me4000_ai_ioctl_ext(struct inode *, struct file *, unsigned int,
187 unsigned long); 172 unsigned long);
188 173
189static int me4000_ai_prepare(me4000_ai_context_t * ai_context); 174static int me4000_ai_prepare(struct me4000_ai_context *ai_context);
190static int me4000_ai_reset(me4000_ai_context_t * ai_context); 175static int me4000_ai_reset(struct me4000_ai_context *ai_context);
191static int me4000_ai_config(me4000_ai_config_t *, me4000_ai_context_t *); 176static int me4000_ai_config(struct me4000_ai_config *,
192static int me4000_ai_start(me4000_ai_context_t *); 177 struct me4000_ai_context *);
193static int me4000_ai_start_ex(unsigned long *, me4000_ai_context_t *); 178static int me4000_ai_start(struct me4000_ai_context *);
194static int me4000_ai_stop(me4000_ai_context_t *); 179static int me4000_ai_start_ex(unsigned long *, struct me4000_ai_context *);
195static int me4000_ai_immediate_stop(me4000_ai_context_t *); 180static int me4000_ai_stop(struct me4000_ai_context *);
196static int me4000_ai_ex_trig_enable(me4000_ai_context_t *); 181static int me4000_ai_immediate_stop(struct me4000_ai_context *);
197static int me4000_ai_ex_trig_disable(me4000_ai_context_t *); 182static int me4000_ai_ex_trig_enable(struct me4000_ai_context *);
198static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t *, 183static int me4000_ai_ex_trig_disable(struct me4000_ai_context *);
199 me4000_ai_context_t *); 184static int me4000_ai_ex_trig_setup(struct me4000_ai_trigger *,
200static int me4000_ai_sc_setup(me4000_ai_sc_t * arg, 185 struct me4000_ai_context *);
201 me4000_ai_context_t * ai_context); 186static int me4000_ai_sc_setup(struct me4000_ai_sc *arg,
202static int me4000_ai_offset_enable(me4000_ai_context_t * ai_context); 187 struct me4000_ai_context *ai_context);
203static int me4000_ai_offset_disable(me4000_ai_context_t * ai_context); 188static int me4000_ai_offset_enable(struct me4000_ai_context *ai_context);
204static int me4000_ai_fullscale_enable(me4000_ai_context_t * ai_context); 189static int me4000_ai_offset_disable(struct me4000_ai_context *ai_context);
205static int me4000_ai_fullscale_disable(me4000_ai_context_t * ai_context); 190static int me4000_ai_fullscale_enable(struct me4000_ai_context *ai_context);
206static int me4000_ai_fsm_state(int *arg, me4000_ai_context_t * ai_context); 191static int me4000_ai_fullscale_disable(struct me4000_ai_context *ai_context);
192static int me4000_ai_fsm_state(int *arg, struct me4000_ai_context *ai_context);
207static int me4000_ai_get_count_buffer(unsigned long *arg, 193static int me4000_ai_get_count_buffer(unsigned long *arg,
208 me4000_ai_context_t * ai_context); 194 struct me4000_ai_context *ai_context);
209 195
210/*----------------------------------------------------------------------------- 196/*-----------------------------------------------------------------------------
211 EEPROM stuff 197 EEPROM stuff
212 ---------------------------------------------------------------------------*/ 198 ---------------------------------------------------------------------------*/
213static int me4000_eeprom_read(me4000_eeprom_t * arg, 199static int me4000_eeprom_read(struct me4000_eeprom *arg,
214 me4000_ai_context_t * ai_context); 200 struct me4000_ai_context *ai_context);
215static int me4000_eeprom_write(me4000_eeprom_t * arg, 201static int me4000_eeprom_write(struct me4000_eeprom *arg,
216 me4000_ai_context_t * ai_context); 202 struct me4000_ai_context *ai_context);
217static unsigned short eeprom_read_cmd(me4000_ai_context_t * ai_context,
218 unsigned long cmd, int length);
219static int eeprom_write_cmd(me4000_ai_context_t * ai_context, unsigned long cmd,
220 int length);
221 203
222/*----------------------------------------------------------------------------- 204/*-----------------------------------------------------------------------------
223 Digital I/O stuff 205 Digital I/O stuff
224 ---------------------------------------------------------------------------*/ 206 ---------------------------------------------------------------------------*/
225static int me4000_dio_ioctl(struct inode *, struct file *, unsigned int, 207static int me4000_dio_ioctl(struct inode *, struct file *, unsigned int,
226 unsigned long); 208 unsigned long);
227static int me4000_dio_config(me4000_dio_config_t *, me4000_dio_context_t *); 209static int me4000_dio_config(struct me4000_dio_config *,
228static int me4000_dio_get_byte(me4000_dio_byte_t *, me4000_dio_context_t *); 210 struct me4000_dio_context *);
229static int me4000_dio_set_byte(me4000_dio_byte_t *, me4000_dio_context_t *); 211static int me4000_dio_get_byte(struct me4000_dio_byte *,
230static int me4000_dio_reset(me4000_dio_context_t *); 212 struct me4000_dio_context *);
213static int me4000_dio_set_byte(struct me4000_dio_byte *,
214 struct me4000_dio_context *);
215static int me4000_dio_reset(struct me4000_dio_context *);
231 216
232/*----------------------------------------------------------------------------- 217/*-----------------------------------------------------------------------------
233 Counter stuff 218 Counter stuff
234 ---------------------------------------------------------------------------*/ 219 ---------------------------------------------------------------------------*/
235static int me4000_cnt_ioctl(struct inode *, struct file *, unsigned int, 220static int me4000_cnt_ioctl(struct inode *, struct file *, unsigned int,
236 unsigned long); 221 unsigned long);
237static int me4000_cnt_config(me4000_cnt_config_t *, me4000_cnt_context_t *); 222static int me4000_cnt_config(struct me4000_cnt_config *,
238static int me4000_cnt_read(me4000_cnt_t *, me4000_cnt_context_t *); 223 struct me4000_cnt_context *);
239static int me4000_cnt_write(me4000_cnt_t *, me4000_cnt_context_t *); 224static int me4000_cnt_read(struct me4000_cnt *, struct me4000_cnt_context *);
240static int me4000_cnt_reset(me4000_cnt_context_t *); 225static int me4000_cnt_write(struct me4000_cnt *, struct me4000_cnt_context *);
226static int me4000_cnt_reset(struct me4000_cnt_context *);
241 227
242/*----------------------------------------------------------------------------- 228/*-----------------------------------------------------------------------------
243 External interrupt routines 229 External interrupt routines
244 ---------------------------------------------------------------------------*/ 230 ---------------------------------------------------------------------------*/
245static int me4000_ext_int_ioctl(struct inode *, struct file *, unsigned int, 231static int me4000_ext_int_ioctl(struct inode *, struct file *, unsigned int,
246 unsigned long); 232 unsigned long);
247static int me4000_ext_int_enable(me4000_ext_int_context_t *); 233static int me4000_ext_int_enable(struct me4000_ext_int_context *);
248static int me4000_ext_int_disable(me4000_ext_int_context_t *); 234static int me4000_ext_int_disable(struct me4000_ext_int_context *);
249static int me4000_ext_int_count(unsigned long *arg, 235static int me4000_ext_int_count(unsigned long *arg,
250 me4000_ext_int_context_t * ext_int_context); 236 struct me4000_ext_int_context *ext_int_context);
251static int me4000_ext_int_fasync(int fd, struct file *file_ptr, int mode); 237static int me4000_ext_int_fasync(int fd, struct file *file_ptr, int mode);
252 238
253/*----------------------------------------------------------------------------- 239/*-----------------------------------------------------------------------------
@@ -260,27 +246,18 @@ static irqreturn_t me4000_ext_int_isr(int, void *);
260/*----------------------------------------------------------------------------- 246/*-----------------------------------------------------------------------------
261 Inline functions 247 Inline functions
262 ---------------------------------------------------------------------------*/ 248 ---------------------------------------------------------------------------*/
263static int inline me4000_buf_count(me4000_circ_buf_t, int);
264static int inline me4000_buf_space(me4000_circ_buf_t, int);
265static int inline me4000_space_to_end(me4000_circ_buf_t, int);
266static int inline me4000_values_to_end(me4000_circ_buf_t, int);
267
268static void inline me4000_outb(unsigned char value, unsigned long port);
269static void inline me4000_outl(unsigned long value, unsigned long port);
270static unsigned long inline me4000_inl(unsigned long port);
271static unsigned char inline me4000_inb(unsigned long port);
272 249
273static int me4000_buf_count(me4000_circ_buf_t buf, int size) 250static int inline me4000_buf_count(struct me4000_circ_buf buf, int size)
274{ 251{
275 return ((buf.head - buf.tail) & (size - 1)); 252 return ((buf.head - buf.tail) & (size - 1));
276} 253}
277 254
278static int me4000_buf_space(me4000_circ_buf_t buf, int size) 255static int inline me4000_buf_space(struct me4000_circ_buf buf, int size)
279{ 256{
280 return ((buf.tail - (buf.head + 1)) & (size - 1)); 257 return ((buf.tail - (buf.head + 1)) & (size - 1));
281} 258}
282 259
283static int me4000_values_to_end(me4000_circ_buf_t buf, int size) 260static int inline me4000_values_to_end(struct me4000_circ_buf buf, int size)
284{ 261{
285 int end; 262 int end;
286 int n; 263 int n;
@@ -289,7 +266,7 @@ static int me4000_values_to_end(me4000_circ_buf_t buf, int size)
289 return (n < end) ? n : end; 266 return (n < end) ? n : end;
290} 267}
291 268
292static int me4000_space_to_end(me4000_circ_buf_t buf, int size) 269static int inline me4000_space_to_end(struct me4000_circ_buf buf, int size)
293{ 270{
294 int end; 271 int end;
295 int n; 272 int n;
@@ -299,19 +276,19 @@ static int me4000_space_to_end(me4000_circ_buf_t buf, int size)
299 return (n <= end) ? n : (end + 1); 276 return (n <= end) ? n : (end + 1);
300} 277}
301 278
302static void me4000_outb(unsigned char value, unsigned long port) 279static void inline me4000_outb(unsigned char value, unsigned long port)
303{ 280{
304 PORT_PDEBUG("--> 0x%02X port 0x%04lX\n", value, port); 281 PORT_PDEBUG("--> 0x%02X port 0x%04lX\n", value, port);
305 outb(value, port); 282 outb(value, port);
306} 283}
307 284
308static void me4000_outl(unsigned long value, unsigned long port) 285static void inline me4000_outl(unsigned long value, unsigned long port)
309{ 286{
310 PORT_PDEBUG("--> 0x%08lX port 0x%04lX\n", value, port); 287 PORT_PDEBUG("--> 0x%08lX port 0x%04lX\n", value, port);
311 outl(value, port); 288 outl(value, port);
312} 289}
313 290
314static unsigned long me4000_inl(unsigned long port) 291static unsigned long inline me4000_inl(unsigned long port)
315{ 292{
316 unsigned long value; 293 unsigned long value;
317 value = inl(port); 294 value = inl(port);
@@ -319,7 +296,7 @@ static unsigned long me4000_inl(unsigned long port)
319 return value; 296 return value;
320} 297}
321 298
322static unsigned char me4000_inb(unsigned long port) 299static unsigned char inline me4000_inb(unsigned long port)
323{ 300{
324 unsigned char value; 301 unsigned char value;
325 value = inb(port); 302 value = inb(port);
@@ -327,102 +304,102 @@ static unsigned char me4000_inb(unsigned long port)
327 return value; 304 return value;
328} 305}
329 306
330struct pci_driver me4000_driver = { 307static struct pci_driver me4000_driver = {
331 .name = ME4000_NAME, 308 .name = ME4000_NAME,
332 .id_table = me4000_pci_table, 309 .id_table = me4000_pci_table,
333 .probe = me4000_probe 310 .probe = me4000_probe
334}; 311};
335 312
336static struct file_operations me4000_ao_fops_sing = { 313static struct file_operations me4000_ao_fops_sing = {
337 owner:THIS_MODULE, 314 .owner = THIS_MODULE,
338 write:me4000_ao_write_sing, 315 .write = me4000_ao_write_sing,
339 ioctl:me4000_ao_ioctl_sing, 316 .ioctl = me4000_ao_ioctl_sing,
340 open:me4000_open, 317 .open = me4000_open,
341 release:me4000_release, 318 .release = me4000_release,
342}; 319};
343 320
344static struct file_operations me4000_ao_fops_wrap = { 321static struct file_operations me4000_ao_fops_wrap = {
345 owner:THIS_MODULE, 322 .owner = THIS_MODULE,
346 write:me4000_ao_write_wrap, 323 .write = me4000_ao_write_wrap,
347 ioctl:me4000_ao_ioctl_wrap, 324 .ioctl = me4000_ao_ioctl_wrap,
348 open:me4000_open, 325 .open = me4000_open,
349 release:me4000_release, 326 .release = me4000_release,
350}; 327};
351 328
352static struct file_operations me4000_ao_fops_cont = { 329static struct file_operations me4000_ao_fops_cont = {
353 owner:THIS_MODULE, 330 .owner = THIS_MODULE,
354 write:me4000_ao_write_cont, 331 .write = me4000_ao_write_cont,
355 poll:me4000_ao_poll_cont, 332 .poll = me4000_ao_poll_cont,
356 ioctl:me4000_ao_ioctl_cont, 333 .ioctl = me4000_ao_ioctl_cont,
357 open:me4000_open, 334 .open = me4000_open,
358 release:me4000_release, 335 .release = me4000_release,
359 fsync:me4000_ao_fsync_cont, 336 .fsync = me4000_ao_fsync_cont,
360}; 337};
361 338
362static struct file_operations me4000_ai_fops_sing = { 339static struct file_operations me4000_ai_fops_sing = {
363 owner:THIS_MODULE, 340 .owner = THIS_MODULE,
364 ioctl:me4000_ai_ioctl_sing, 341 .ioctl = me4000_ai_ioctl_sing,
365 open:me4000_open, 342 .open = me4000_open,
366 release:me4000_release, 343 .release = me4000_release,
367}; 344};
368 345
369static struct file_operations me4000_ai_fops_cont_sw = { 346static struct file_operations me4000_ai_fops_cont_sw = {
370 owner:THIS_MODULE, 347 .owner = THIS_MODULE,
371 read:me4000_ai_read, 348 .read = me4000_ai_read,
372 poll:me4000_ai_poll, 349 .poll = me4000_ai_poll,
373 ioctl:me4000_ai_ioctl_sw, 350 .ioctl = me4000_ai_ioctl_sw,
374 open:me4000_open, 351 .open = me4000_open,
375 release:me4000_release, 352 .release = me4000_release,
376 fasync:me4000_ai_fasync, 353 .fasync = me4000_ai_fasync,
377}; 354};
378 355
379static struct file_operations me4000_ai_fops_cont_et = { 356static struct file_operations me4000_ai_fops_cont_et = {
380 owner:THIS_MODULE, 357 .owner = THIS_MODULE,
381 read:me4000_ai_read, 358 .read = me4000_ai_read,
382 poll:me4000_ai_poll, 359 .poll = me4000_ai_poll,
383 ioctl:me4000_ai_ioctl_ext, 360 .ioctl = me4000_ai_ioctl_ext,
384 open:me4000_open, 361 .open = me4000_open,
385 release:me4000_release, 362 .release = me4000_release,
386}; 363};
387 364
388static struct file_operations me4000_ai_fops_cont_et_value = { 365static struct file_operations me4000_ai_fops_cont_et_value = {
389 owner:THIS_MODULE, 366 .owner = THIS_MODULE,
390 read:me4000_ai_read, 367 .read = me4000_ai_read,
391 poll:me4000_ai_poll, 368 .poll = me4000_ai_poll,
392 ioctl:me4000_ai_ioctl_ext, 369 .ioctl = me4000_ai_ioctl_ext,
393 open:me4000_open, 370 .open = me4000_open,
394 release:me4000_release, 371 .release = me4000_release,
395}; 372};
396 373
397static struct file_operations me4000_ai_fops_cont_et_chanlist = { 374static struct file_operations me4000_ai_fops_cont_et_chanlist = {
398 owner:THIS_MODULE, 375 .owner = THIS_MODULE,
399 read:me4000_ai_read, 376 .read = me4000_ai_read,
400 poll:me4000_ai_poll, 377 .poll = me4000_ai_poll,
401 ioctl:me4000_ai_ioctl_ext, 378 .ioctl = me4000_ai_ioctl_ext,
402 open:me4000_open, 379 .open = me4000_open,
403 release:me4000_release, 380 .release = me4000_release,
404}; 381};
405 382
406static struct file_operations me4000_dio_fops = { 383static struct file_operations me4000_dio_fops = {
407 owner:THIS_MODULE, 384 .owner = THIS_MODULE,
408 ioctl:me4000_dio_ioctl, 385 .ioctl = me4000_dio_ioctl,
409 open:me4000_open, 386 .open = me4000_open,
410 release:me4000_release, 387 .release = me4000_release,
411}; 388};
412 389
413static struct file_operations me4000_cnt_fops = { 390static struct file_operations me4000_cnt_fops = {
414 owner:THIS_MODULE, 391 .owner = THIS_MODULE,
415 ioctl:me4000_cnt_ioctl, 392 .ioctl = me4000_cnt_ioctl,
416 open:me4000_open, 393 .open = me4000_open,
417 release:me4000_release, 394 .release = me4000_release,
418}; 395};
419 396
420static struct file_operations me4000_ext_int_fops = { 397static struct file_operations me4000_ext_int_fops = {
421 owner:THIS_MODULE, 398 .owner = THIS_MODULE,
422 ioctl:me4000_ext_int_ioctl, 399 .ioctl = me4000_ext_int_ioctl,
423 open:me4000_open, 400 .open = me4000_open,
424 release:me4000_release, 401 .release = me4000_release,
425 fasync:me4000_ext_int_fasync, 402 .fasync = me4000_ext_int_fasync,
426}; 403};
427 404
428static struct file_operations *me4000_ao_fops_array[] = { 405static struct file_operations *me4000_ao_fops_array[] = {
@@ -439,9 +416,9 @@ static struct file_operations *me4000_ai_fops_array[] = {
439 &me4000_ai_fops_cont_et_chanlist, // work through one channel list by external trigger 416 &me4000_ai_fops_cont_et_chanlist, // work through one channel list by external trigger
440}; 417};
441 418
442int __init me4000_init_module(void) 419static int __init me4000_init_module(void)
443{ 420{
444 int result = 0; 421 int result;
445 422
446 CALL_PDEBUG("init_module() is executed\n"); 423 CALL_PDEBUG("init_module() is executed\n");
447 424
@@ -533,26 +510,26 @@ int __init me4000_init_module(void)
533 510
534 return 0; 511 return 0;
535 512
536 INIT_ERROR_7: 513INIT_ERROR_7:
537 unregister_chrdev(me4000_ext_int_major_driver_no, ME4000_EXT_INT_NAME); 514 unregister_chrdev(me4000_ext_int_major_driver_no, ME4000_EXT_INT_NAME);
538 515
539 INIT_ERROR_6: 516INIT_ERROR_6:
540 unregister_chrdev(me4000_cnt_major_driver_no, ME4000_CNT_NAME); 517 unregister_chrdev(me4000_cnt_major_driver_no, ME4000_CNT_NAME);
541 518
542 INIT_ERROR_5: 519INIT_ERROR_5:
543 unregister_chrdev(me4000_dio_major_driver_no, ME4000_DIO_NAME); 520 unregister_chrdev(me4000_dio_major_driver_no, ME4000_DIO_NAME);
544 521
545 INIT_ERROR_4: 522INIT_ERROR_4:
546 unregister_chrdev(me4000_ai_major_driver_no, ME4000_AI_NAME); 523 unregister_chrdev(me4000_ai_major_driver_no, ME4000_AI_NAME);
547 524
548 INIT_ERROR_3: 525INIT_ERROR_3:
549 unregister_chrdev(me4000_ao_major_driver_no, ME4000_AO_NAME); 526 unregister_chrdev(me4000_ao_major_driver_no, ME4000_AO_NAME);
550 527
551 INIT_ERROR_2: 528INIT_ERROR_2:
552 pci_unregister_driver(&me4000_driver); 529 pci_unregister_driver(&me4000_driver);
553 clear_board_info_list(); 530 clear_board_info_list();
554 531
555 INIT_ERROR_1: 532INIT_ERROR_1:
556 return result; 533 return result;
557} 534}
558 535
@@ -562,18 +539,18 @@ static void clear_board_info_list(void)
562{ 539{
563 struct list_head *board_p; 540 struct list_head *board_p;
564 struct list_head *dac_p; 541 struct list_head *dac_p;
565 me4000_info_t *board_info; 542 struct me4000_info *board_info;
566 me4000_ao_context_t *ao_context; 543 struct me4000_ao_context *ao_context;
567 544
568 /* Clear context lists */ 545 /* Clear context lists */
569 for (board_p = me4000_board_info_list.next; 546 for (board_p = me4000_board_info_list.next;
570 board_p != &me4000_board_info_list; board_p = board_p->next) { 547 board_p != &me4000_board_info_list; board_p = board_p->next) {
571 board_info = list_entry(board_p, me4000_info_t, list); 548 board_info = list_entry(board_p, struct me4000_info, list);
572 /* Clear analog output context list */ 549 /* Clear analog output context list */
573 while (!list_empty(&board_info->ao_context_list)) { 550 while (!list_empty(&board_info->ao_context_list)) {
574 dac_p = board_info->ao_context_list.next; 551 dac_p = board_info->ao_context_list.next;
575 ao_context = 552 ao_context =
576 list_entry(dac_p, me4000_ao_context_t, list); 553 list_entry(dac_p, struct me4000_ao_context, list);
577 me4000_ao_reset(ao_context); 554 me4000_ao_reset(ao_context);
578 free_irq(ao_context->irq, ao_context); 555 free_irq(ao_context->irq, ao_context);
579 if (ao_context->circ_buf.buf) 556 if (ao_context->circ_buf.buf)
@@ -600,14 +577,14 @@ static void clear_board_info_list(void)
600 /* Clear the board info list */ 577 /* Clear the board info list */
601 while (!list_empty(&me4000_board_info_list)) { 578 while (!list_empty(&me4000_board_info_list)) {
602 board_p = me4000_board_info_list.next; 579 board_p = me4000_board_info_list.next;
603 board_info = list_entry(board_p, me4000_info_t, list); 580 board_info = list_entry(board_p, struct me4000_info, list);
604 pci_release_regions(board_info->pci_dev_p); 581 pci_release_regions(board_info->pci_dev_p);
605 list_del(board_p); 582 list_del(board_p);
606 kfree(board_info); 583 kfree(board_info);
607 } 584 }
608} 585}
609 586
610static int get_registers(struct pci_dev *dev, me4000_info_t * board_info) 587static int get_registers(struct pci_dev *dev, struct me4000_info *board_info)
611{ 588{
612 589
613 /*--------------------------- plx regbase ---------------------------------*/ 590 /*--------------------------- plx regbase ---------------------------------*/
@@ -667,20 +644,20 @@ static int get_registers(struct pci_dev *dev, me4000_info_t * board_info)
667} 644}
668 645
669static int init_board_info(struct pci_dev *pci_dev_p, 646static int init_board_info(struct pci_dev *pci_dev_p,
670 me4000_info_t * board_info) 647 struct me4000_info *board_info)
671{ 648{
672 int i; 649 int i;
673 int result; 650 int result;
674 struct list_head *board_p; 651 struct list_head *board_p;
675 board_info->pci_dev_p = pci_dev_p; 652 board_info->pci_dev_p = pci_dev_p;
676 653
677 for (i = 0; i < ME4000_BOARD_VERSIONS; i++) { 654 for (i = 0; i < ARRAY_SIZE(me4000_boards); i++) {
678 if (me4000_boards[i].device_id == pci_dev_p->device) { 655 if (me4000_boards[i].device_id == pci_dev_p->device) {
679 board_info->board_p = &me4000_boards[i]; 656 board_info->board_p = &me4000_boards[i];
680 break; 657 break;
681 } 658 }
682 } 659 }
683 if (i == ME4000_BOARD_VERSIONS) { 660 if (i == ARRAY_SIZE(me4000_boards)) {
684 printk(KERN_ERR 661 printk(KERN_ERR
685 "ME4000:init_board_info():Device ID not valid\n"); 662 "ME4000:init_board_info():Device ID not valid\n");
686 return -ENODEV; 663 return -ENODEV;
@@ -755,21 +732,21 @@ static int init_board_info(struct pci_dev *pci_dev_p,
755 return 0; 732 return 0;
756} 733}
757 734
758static int alloc_ao_contexts(me4000_info_t * info) 735static int alloc_ao_contexts(struct me4000_info *info)
759{ 736{
760 int i; 737 int i;
761 int err; 738 int err;
762 me4000_ao_context_t *ao_context; 739 struct me4000_ao_context *ao_context;
763 740
764 for (i = 0; i < info->board_p->ao.count; i++) { 741 for (i = 0; i < info->board_p->ao.count; i++) {
765 ao_context = kmalloc(sizeof(me4000_ao_context_t), GFP_KERNEL); 742 ao_context = kzalloc(sizeof(struct me4000_ao_context),
743 GFP_KERNEL);
766 if (!ao_context) { 744 if (!ao_context) {
767 printk(KERN_ERR 745 printk(KERN_ERR
768 "alloc_ao_contexts():Can't get memory for ao context\n"); 746 "alloc_ao_contexts():Can't get memory for ao context\n");
769 release_ao_contexts(info); 747 release_ao_contexts(info);
770 return -ENOMEM; 748 return -ENOMEM;
771 } 749 }
772 memset(ao_context, 0, sizeof(me4000_ao_context_t));
773 750
774 spin_lock_init(&ao_context->use_lock); 751 spin_lock_init(&ao_context->use_lock);
775 spin_lock_init(&ao_context->int_lock); 752 spin_lock_init(&ao_context->int_lock);
@@ -780,15 +757,13 @@ static int alloc_ao_contexts(me4000_info_t * info)
780 if (info->board_p->ao.fifo_count) { 757 if (info->board_p->ao.fifo_count) {
781 /* Allocate circular buffer */ 758 /* Allocate circular buffer */
782 ao_context->circ_buf.buf = 759 ao_context->circ_buf.buf =
783 kmalloc(ME4000_AO_BUFFER_SIZE, GFP_KERNEL); 760 kzalloc(ME4000_AO_BUFFER_SIZE, GFP_KERNEL);
784 if (!ao_context->circ_buf.buf) { 761 if (!ao_context->circ_buf.buf) {
785 printk(KERN_ERR 762 printk(KERN_ERR
786 "alloc_ao_contexts():Can't get circular buffer\n"); 763 "alloc_ao_contexts():Can't get circular buffer\n");
787 release_ao_contexts(info); 764 release_ao_contexts(info);
788 return -ENOMEM; 765 return -ENOMEM;
789 } 766 }
790 memset(ao_context->circ_buf.buf, 0,
791 ME4000_AO_BUFFER_SIZE);
792 767
793 /* Clear the circular buffer */ 768 /* Clear the circular buffer */
794 ao_context->circ_buf.head = 0; 769 ao_context->circ_buf.head = 0;
@@ -872,9 +847,8 @@ static int alloc_ao_contexts(me4000_info_t * info)
872 ME4000_NAME, ao_context); 847 ME4000_NAME, ao_context);
873 if (err) { 848 if (err) {
874 printk(KERN_ERR 849 printk(KERN_ERR
875 "alloc_ao_contexts():Can't get interrupt line"); 850 "%s:Can't get interrupt line", __func__);
876 if (ao_context->circ_buf.buf) 851 kfree(ao_context->circ_buf.buf);
877 kfree(ao_context->circ_buf.buf);
878 kfree(ao_context); 852 kfree(ao_context);
879 release_ao_contexts(info); 853 release_ao_contexts(info);
880 return -ENODEV; 854 return -ENODEV;
@@ -888,35 +862,34 @@ static int alloc_ao_contexts(me4000_info_t * info)
888 return 0; 862 return 0;
889} 863}
890 864
891static void release_ao_contexts(me4000_info_t * board_info) 865static void release_ao_contexts(struct me4000_info *board_info)
892{ 866{
893 struct list_head *dac_p; 867 struct list_head *dac_p;
894 me4000_ao_context_t *ao_context; 868 struct me4000_ao_context *ao_context;
895 869
896 /* Clear analog output context list */ 870 /* Clear analog output context list */
897 while (!list_empty(&board_info->ao_context_list)) { 871 while (!list_empty(&board_info->ao_context_list)) {
898 dac_p = board_info->ao_context_list.next; 872 dac_p = board_info->ao_context_list.next;
899 ao_context = list_entry(dac_p, me4000_ao_context_t, list); 873 ao_context = list_entry(dac_p, struct me4000_ao_context, list);
900 free_irq(ao_context->irq, ao_context); 874 free_irq(ao_context->irq, ao_context);
901 if (ao_context->circ_buf.buf) 875 kfree(ao_context->circ_buf.buf);
902 kfree(ao_context->circ_buf.buf);
903 list_del(dac_p); 876 list_del(dac_p);
904 kfree(ao_context); 877 kfree(ao_context);
905 } 878 }
906} 879}
907 880
908static int alloc_ai_context(me4000_info_t * info) 881static int alloc_ai_context(struct me4000_info *info)
909{ 882{
910 me4000_ai_context_t *ai_context; 883 struct me4000_ai_context *ai_context;
911 884
912 if (info->board_p->ai.count) { 885 if (info->board_p->ai.count) {
913 ai_context = kmalloc(sizeof(me4000_ai_context_t), GFP_KERNEL); 886 ai_context = kzalloc(sizeof(struct me4000_ai_context),
887 GFP_KERNEL);
914 if (!ai_context) { 888 if (!ai_context) {
915 printk(KERN_ERR 889 printk(KERN_ERR
916 "ME4000:alloc_ai_context():Can't get memory for ai context\n"); 890 "ME4000:alloc_ai_context():Can't get memory for ai context\n");
917 return -ENOMEM; 891 return -ENOMEM;
918 } 892 }
919 memset(ai_context, 0, sizeof(me4000_ai_context_t));
920 893
921 info->ai_context = ai_context; 894 info->ai_context = ai_context;
922 895
@@ -958,18 +931,18 @@ static int alloc_ai_context(me4000_info_t * info)
958 return 0; 931 return 0;
959} 932}
960 933
961static int alloc_dio_context(me4000_info_t * info) 934static int alloc_dio_context(struct me4000_info *info)
962{ 935{
963 me4000_dio_context_t *dio_context; 936 struct me4000_dio_context *dio_context;
964 937
965 if (info->board_p->dio.count) { 938 if (info->board_p->dio.count) {
966 dio_context = kmalloc(sizeof(me4000_dio_context_t), GFP_KERNEL); 939 dio_context = kzalloc(sizeof(struct me4000_dio_context),
940 GFP_KERNEL);
967 if (!dio_context) { 941 if (!dio_context) {
968 printk(KERN_ERR 942 printk(KERN_ERR
969 "ME4000:alloc_dio_context():Can't get memory for dio context\n"); 943 "ME4000:alloc_dio_context():Can't get memory for dio context\n");
970 return -ENOMEM; 944 return -ENOMEM;
971 } 945 }
972 memset(dio_context, 0, sizeof(me4000_dio_context_t));
973 946
974 info->dio_context = dio_context; 947 info->dio_context = dio_context;
975 948
@@ -995,18 +968,18 @@ static int alloc_dio_context(me4000_info_t * info)
995 return 0; 968 return 0;
996} 969}
997 970
998static int alloc_cnt_context(me4000_info_t * info) 971static int alloc_cnt_context(struct me4000_info *info)
999{ 972{
1000 me4000_cnt_context_t *cnt_context; 973 struct me4000_cnt_context *cnt_context;
1001 974
1002 if (info->board_p->cnt.count) { 975 if (info->board_p->cnt.count) {
1003 cnt_context = kmalloc(sizeof(me4000_cnt_context_t), GFP_KERNEL); 976 cnt_context = kzalloc(sizeof(struct me4000_cnt_context),
977 GFP_KERNEL);
1004 if (!cnt_context) { 978 if (!cnt_context) {
1005 printk(KERN_ERR 979 printk(KERN_ERR
1006 "ME4000:alloc_cnt_context():Can't get memory for cnt context\n"); 980 "ME4000:alloc_cnt_context():Can't get memory for cnt context\n");
1007 return -ENOMEM; 981 return -ENOMEM;
1008 } 982 }
1009 memset(cnt_context, 0, sizeof(me4000_cnt_context_t));
1010 983
1011 info->cnt_context = cnt_context; 984 info->cnt_context = cnt_context;
1012 985
@@ -1026,19 +999,18 @@ static int alloc_cnt_context(me4000_info_t * info)
1026 return 0; 999 return 0;
1027} 1000}
1028 1001
1029static int alloc_ext_int_context(me4000_info_t * info) 1002static int alloc_ext_int_context(struct me4000_info *info)
1030{ 1003{
1031 me4000_ext_int_context_t *ext_int_context; 1004 struct me4000_ext_int_context *ext_int_context;
1032 1005
1033 if (info->board_p->cnt.count) { 1006 if (info->board_p->cnt.count) {
1034 ext_int_context = 1007 ext_int_context =
1035 kmalloc(sizeof(me4000_ext_int_context_t), GFP_KERNEL); 1008 kzalloc(sizeof(struct me4000_ext_int_context), GFP_KERNEL);
1036 if (!ext_int_context) { 1009 if (!ext_int_context) {
1037 printk(KERN_ERR 1010 printk(KERN_ERR
1038 "ME4000:alloc_ext_int_context():Can't get memory for cnt context\n"); 1011 "ME4000:alloc_ext_int_context():Can't get memory for cnt context\n");
1039 return -ENOMEM; 1012 return -ENOMEM;
1040 } 1013 }
1041 memset(ext_int_context, 0, sizeof(me4000_ext_int_context_t));
1042 1014
1043 info->ext_int_context = ext_int_context; 1015 info->ext_int_context = ext_int_context;
1044 1016
@@ -1060,19 +1032,18 @@ static int alloc_ext_int_context(me4000_info_t * info)
1060static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id) 1032static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id)
1061{ 1033{
1062 int result = 0; 1034 int result = 0;
1063 me4000_info_t *board_info; 1035 struct me4000_info *board_info;
1064 1036
1065 CALL_PDEBUG("me4000_probe() is executed\n"); 1037 CALL_PDEBUG("me4000_probe() is executed\n");
1066 1038
1067 /* Allocate structure for board context */ 1039 /* Allocate structure for board context */
1068 board_info = kmalloc(sizeof(me4000_info_t), GFP_KERNEL); 1040 board_info = kzalloc(sizeof(struct me4000_info), GFP_KERNEL);
1069 if (!board_info) { 1041 if (!board_info) {
1070 printk(KERN_ERR 1042 printk(KERN_ERR
1071 "ME4000:Can't get memory for board info structure\n"); 1043 "ME4000:Can't get memory for board info structure\n");
1072 result = -ENOMEM; 1044 result = -ENOMEM;
1073 goto PROBE_ERROR_1; 1045 goto PROBE_ERROR_1;
1074 } 1046 }
1075 memset(board_info, 0, sizeof(me4000_info_t));
1076 1047
1077 /* Add to global linked list */ 1048 /* Add to global linked list */
1078 list_add_tail(&board_info->list, &me4000_board_info_list); 1049 list_add_tail(&board_info->list, &me4000_board_info_list);
@@ -1080,70 +1051,70 @@ static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id)
1080 /* Get the PCI base registers */ 1051 /* Get the PCI base registers */
1081 result = get_registers(dev, board_info); 1052 result = get_registers(dev, board_info);
1082 if (result) { 1053 if (result) {
1083 printk(KERN_ERR "me4000_probe():Cannot get registers\n"); 1054 printk(KERN_ERR "%s:Cannot get registers\n", __func__);
1084 goto PROBE_ERROR_2; 1055 goto PROBE_ERROR_2;
1085 } 1056 }
1086 1057
1087 /* Enable the device */ 1058 /* Enable the device */
1088 result = pci_enable_device(dev); 1059 result = pci_enable_device(dev);
1089 if (result < 0) { 1060 if (result < 0) {
1090 printk(KERN_ERR "me4000_probe():Cannot enable PCI device\n"); 1061 printk(KERN_ERR "%s:Cannot enable PCI device\n", __func__);
1091 goto PROBE_ERROR_2; 1062 goto PROBE_ERROR_2;
1092 } 1063 }
1093 1064
1094 /* Request the PCI register regions */ 1065 /* Request the PCI register regions */
1095 result = pci_request_regions(dev, ME4000_NAME); 1066 result = pci_request_regions(dev, ME4000_NAME);
1096 if (result < 0) { 1067 if (result < 0) {
1097 printk(KERN_ERR "me4000_probe():Cannot request I/O regions\n"); 1068 printk(KERN_ERR "%s:Cannot request I/O regions\n", __func__);
1098 goto PROBE_ERROR_2; 1069 goto PROBE_ERROR_2;
1099 } 1070 }
1100 1071
1101 /* Initialize board info */ 1072 /* Initialize board info */
1102 result = init_board_info(dev, board_info); 1073 result = init_board_info(dev, board_info);
1103 if (result) { 1074 if (result) {
1104 printk(KERN_ERR "me4000_probe():Cannot init baord info\n"); 1075 printk(KERN_ERR "%s:Cannot init baord info\n", __func__);
1105 goto PROBE_ERROR_3; 1076 goto PROBE_ERROR_3;
1106 } 1077 }
1107 1078
1108 /* Download the xilinx firmware */ 1079 /* Download the xilinx firmware */
1109 result = me4000_xilinx_download(board_info); 1080 result = me4000_xilinx_download(board_info);
1110 if (result) { 1081 if (result) {
1111 printk(KERN_ERR "me4000_probe:Can't download firmware\n"); 1082 printk(KERN_ERR "%s:Can't download firmware\n", __func__);
1112 goto PROBE_ERROR_3; 1083 goto PROBE_ERROR_3;
1113 } 1084 }
1114 1085
1115 /* Make a hardware reset */ 1086 /* Make a hardware reset */
1116 result = me4000_reset_board(board_info); 1087 result = me4000_reset_board(board_info);
1117 if (result) { 1088 if (result) {
1118 printk(KERN_ERR "me4000_probe:Can't reset board\n"); 1089 printk(KERN_ERR "%s :Can't reset board\n", __func__);
1119 goto PROBE_ERROR_3; 1090 goto PROBE_ERROR_3;
1120 } 1091 }
1121 1092
1122 /* Allocate analog output context structures */ 1093 /* Allocate analog output context structures */
1123 result = alloc_ao_contexts(board_info); 1094 result = alloc_ao_contexts(board_info);
1124 if (result) { 1095 if (result) {
1125 printk(KERN_ERR "me4000_probe():Cannot allocate ao contexts\n"); 1096 printk(KERN_ERR "%s:Cannot allocate ao contexts\n", __func__);
1126 goto PROBE_ERROR_3; 1097 goto PROBE_ERROR_3;
1127 } 1098 }
1128 1099
1129 /* Allocate analog input context */ 1100 /* Allocate analog input context */
1130 result = alloc_ai_context(board_info); 1101 result = alloc_ai_context(board_info);
1131 if (result) { 1102 if (result) {
1132 printk(KERN_ERR "me4000_probe():Cannot allocate ai context\n"); 1103 printk(KERN_ERR "%s:Cannot allocate ai context\n", __func__);
1133 goto PROBE_ERROR_4; 1104 goto PROBE_ERROR_4;
1134 } 1105 }
1135 1106
1136 /* Allocate digital I/O context */ 1107 /* Allocate digital I/O context */
1137 result = alloc_dio_context(board_info); 1108 result = alloc_dio_context(board_info);
1138 if (result) { 1109 if (result) {
1139 printk(KERN_ERR "me4000_probe():Cannot allocate dio context\n"); 1110 printk(KERN_ERR "%s:Cannot allocate dio context\n", __func__);
1140 goto PROBE_ERROR_5; 1111 goto PROBE_ERROR_5;
1141 } 1112 }
1142 1113
1143 /* Allocate counter context */ 1114 /* Allocate counter context */
1144 result = alloc_cnt_context(board_info); 1115 result = alloc_cnt_context(board_info);
1145 if (result) { 1116 if (result) {
1146 printk(KERN_ERR "me4000_probe():Cannot allocate cnt context\n"); 1117 printk(KERN_ERR "%s:Cannot allocate cnt context\n", __func__);
1147 goto PROBE_ERROR_6; 1118 goto PROBE_ERROR_6;
1148 } 1119 }
1149 1120
@@ -1151,36 +1122,36 @@ static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id)
1151 result = alloc_ext_int_context(board_info); 1122 result = alloc_ext_int_context(board_info);
1152 if (result) { 1123 if (result) {
1153 printk(KERN_ERR 1124 printk(KERN_ERR
1154 "me4000_probe():Cannot allocate ext_int context\n"); 1125 "%s:Cannot allocate ext_int context\n", __func__);
1155 goto PROBE_ERROR_7; 1126 goto PROBE_ERROR_7;
1156 } 1127 }
1157 1128
1158 return 0; 1129 return 0;
1159 1130
1160 PROBE_ERROR_7: 1131PROBE_ERROR_7:
1161 kfree(board_info->cnt_context); 1132 kfree(board_info->cnt_context);
1162 1133
1163 PROBE_ERROR_6: 1134PROBE_ERROR_6:
1164 kfree(board_info->dio_context); 1135 kfree(board_info->dio_context);
1165 1136
1166 PROBE_ERROR_5: 1137PROBE_ERROR_5:
1167 kfree(board_info->ai_context); 1138 kfree(board_info->ai_context);
1168 1139
1169 PROBE_ERROR_4: 1140PROBE_ERROR_4:
1170 release_ao_contexts(board_info); 1141 release_ao_contexts(board_info);
1171 1142
1172 PROBE_ERROR_3: 1143PROBE_ERROR_3:
1173 pci_release_regions(dev); 1144 pci_release_regions(dev);
1174 1145
1175 PROBE_ERROR_2: 1146PROBE_ERROR_2:
1176 list_del(&board_info->list); 1147 list_del(&board_info->list);
1177 kfree(board_info); 1148 kfree(board_info);
1178 1149
1179 PROBE_ERROR_1: 1150PROBE_ERROR_1:
1180 return result; 1151 return result;
1181} 1152}
1182 1153
1183static int me4000_xilinx_download(me4000_info_t * info) 1154static int me4000_xilinx_download(struct me4000_info *info)
1184{ 1155{
1185 int size = 0; 1156 int size = 0;
1186 u32 value = 0; 1157 u32 value = 0;
@@ -1211,7 +1182,7 @@ static int me4000_xilinx_download(me4000_info_t * info)
1211 /* Wait until /INIT pin is set */ 1182 /* Wait until /INIT pin is set */
1212 udelay(20); 1183 udelay(20);
1213 if (!inl(info->plx_regbase + PLX_INTCSR) & 0x20) { 1184 if (!inl(info->plx_regbase + PLX_INTCSR) & 0x20) {
1214 printk(KERN_ERR "me4000_xilinx_download():Can't init Xilinx\n"); 1185 printk(KERN_ERR "%s:Can't init Xilinx\n", __func__);
1215 return -EIO; 1186 return -EIO;
1216 } 1187 }
1217 1188
@@ -1232,7 +1203,7 @@ static int me4000_xilinx_download(me4000_info_t * info)
1232 /* Check if BUSY flag is low */ 1203 /* Check if BUSY flag is low */
1233 if (inl(info->plx_regbase + PLX_ICR) & 0x20) { 1204 if (inl(info->plx_regbase + PLX_ICR) & 0x20) {
1234 printk(KERN_ERR 1205 printk(KERN_ERR
1235 "me4000_xilinx_download():Xilinx is still busy (idx = %d)\n", 1206 "%s:Xilinx is still busy (idx = %d)\n", __func__,
1236 idx); 1207 idx);
1237 return -EIO; 1208 return -EIO;
1238 } 1209 }
@@ -1246,9 +1217,9 @@ static int me4000_xilinx_download(me4000_info_t * info)
1246 PDEBUG("me4000_xilinx_download():Download was successful\n"); 1217 PDEBUG("me4000_xilinx_download():Download was successful\n");
1247 } else { 1218 } else {
1248 printk(KERN_ERR 1219 printk(KERN_ERR
1249 "ME4000:me4000_xilinx_download():DONE flag is not set\n"); 1220 "ME4000:%s:DONE flag is not set\n", __func__);
1250 printk(KERN_ERR 1221 printk(KERN_ERR
1251 "ME4000:me4000_xilinx_download():Download not succesful\n"); 1222 "ME4000:%s:Download not succesful\n", __func__);
1252 return -EIO; 1223 return -EIO;
1253 } 1224 }
1254 1225
@@ -1260,7 +1231,7 @@ static int me4000_xilinx_download(me4000_info_t * info)
1260 return 0; 1231 return 0;
1261} 1232}
1262 1233
1263static int me4000_reset_board(me4000_info_t * info) 1234static int me4000_reset_board(struct me4000_info *info)
1264{ 1235{
1265 unsigned long icr; 1236 unsigned long icr;
1266 1237
@@ -1314,12 +1285,12 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1314 int err = 0; 1285 int err = 0;
1315 int i; 1286 int i;
1316 struct list_head *ptr; 1287 struct list_head *ptr;
1317 me4000_info_t *board_info = NULL; 1288 struct me4000_info *board_info = NULL;
1318 me4000_ao_context_t *ao_context = NULL; 1289 struct me4000_ao_context *ao_context = NULL;
1319 me4000_ai_context_t *ai_context = NULL; 1290 struct me4000_ai_context *ai_context = NULL;
1320 me4000_dio_context_t *dio_context = NULL; 1291 struct me4000_dio_context *dio_context = NULL;
1321 me4000_cnt_context_t *cnt_context = NULL; 1292 struct me4000_cnt_context *cnt_context = NULL;
1322 me4000_ext_int_context_t *ext_int_context = NULL; 1293 struct me4000_ext_int_context *ext_int_context = NULL;
1323 1294
1324 CALL_PDEBUG("me4000_open() is executed\n"); 1295 CALL_PDEBUG("me4000_open() is executed\n");
1325 1296
@@ -1335,7 +1306,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1335 /* Search for the board context */ 1306 /* Search for the board context */
1336 for (ptr = me4000_board_info_list.next, i = 0; 1307 for (ptr = me4000_board_info_list.next, i = 0;
1337 ptr != &me4000_board_info_list; ptr = ptr->next, i++) { 1308 ptr != &me4000_board_info_list; ptr = ptr->next, i++) {
1338 board_info = list_entry(ptr, me4000_info_t, list); 1309 board_info = list_entry(ptr, struct me4000_info, list);
1339 if (i == board) 1310 if (i == board)
1340 break; 1311 break;
1341 } 1312 }
@@ -1351,7 +1322,8 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1351 for (ptr = board_info->ao_context_list.next, i = 0; 1322 for (ptr = board_info->ao_context_list.next, i = 0;
1352 ptr != &board_info->ao_context_list; 1323 ptr != &board_info->ao_context_list;
1353 ptr = ptr->next, i++) { 1324 ptr = ptr->next, i++) {
1354 ao_context = list_entry(ptr, me4000_ao_context_t, list); 1325 ao_context = list_entry(ptr, struct me4000_ao_context,
1326 list);
1355 if (i == dev) 1327 if (i == dev)
1356 break; 1328 break;
1357 } 1329 }
@@ -1415,7 +1387,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1415 /* Search for the board context */ 1387 /* Search for the board context */
1416 for (ptr = me4000_board_info_list.next, i = 0; 1388 for (ptr = me4000_board_info_list.next, i = 0;
1417 ptr != &me4000_board_info_list; ptr = ptr->next, i++) { 1389 ptr != &me4000_board_info_list; ptr = ptr->next, i++) {
1418 board_info = list_entry(ptr, me4000_info_t, list); 1390 board_info = list_entry(ptr, struct me4000_info, list);
1419 if (i == board) 1391 if (i == board)
1420 break; 1392 break;
1421 } 1393 }
@@ -1469,7 +1441,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1469 /* Search for the board context */ 1441 /* Search for the board context */
1470 for (ptr = me4000_board_info_list.next; 1442 for (ptr = me4000_board_info_list.next;
1471 ptr != &me4000_board_info_list; ptr = ptr->next) { 1443 ptr != &me4000_board_info_list; ptr = ptr->next) {
1472 board_info = list_entry(ptr, me4000_info_t, list); 1444 board_info = list_entry(ptr, struct me4000_info, list);
1473 if (board_info->board_count == board) 1445 if (board_info->board_count == board)
1474 break; 1446 break;
1475 } 1447 }
@@ -1514,7 +1486,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1514 /* Search for the board context */ 1486 /* Search for the board context */
1515 for (ptr = me4000_board_info_list.next; 1487 for (ptr = me4000_board_info_list.next;
1516 ptr != &me4000_board_info_list; ptr = ptr->next) { 1488 ptr != &me4000_board_info_list; ptr = ptr->next) {
1517 board_info = list_entry(ptr, me4000_info_t, list); 1489 board_info = list_entry(ptr, struct me4000_info, list);
1518 if (board_info->board_count == board) 1490 if (board_info->board_count == board)
1519 break; 1491 break;
1520 } 1492 }
@@ -1557,7 +1529,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1557 /* Search for the board context */ 1529 /* Search for the board context */
1558 for (ptr = me4000_board_info_list.next; 1530 for (ptr = me4000_board_info_list.next;
1559 ptr != &me4000_board_info_list; ptr = ptr->next) { 1531 ptr != &me4000_board_info_list; ptr = ptr->next) {
1560 board_info = list_entry(ptr, me4000_info_t, list); 1532 board_info = list_entry(ptr, struct me4000_info, list);
1561 if (board_info->board_count == board) 1533 if (board_info->board_count == board)
1562 break; 1534 break;
1563 } 1535 }
@@ -1613,11 +1585,11 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
1613 1585
1614static int me4000_release(struct inode *inode_p, struct file *file_p) 1586static int me4000_release(struct inode *inode_p, struct file *file_p)
1615{ 1587{
1616 me4000_ao_context_t *ao_context; 1588 struct me4000_ao_context *ao_context;
1617 me4000_ai_context_t *ai_context; 1589 struct me4000_ai_context *ai_context;
1618 me4000_dio_context_t *dio_context; 1590 struct me4000_dio_context *dio_context;
1619 me4000_cnt_context_t *cnt_context; 1591 struct me4000_cnt_context *cnt_context;
1620 me4000_ext_int_context_t *ext_int_context; 1592 struct me4000_ext_int_context *ext_int_context;
1621 1593
1622 CALL_PDEBUG("me4000_release() is executed\n"); 1594 CALL_PDEBUG("me4000_release() is executed\n");
1623 1595
@@ -1677,7 +1649,7 @@ static int me4000_release(struct inode *inode_p, struct file *file_p)
1677 1649
1678/*------------------------------- Analog output stuff --------------------------------------*/ 1650/*------------------------------- Analog output stuff --------------------------------------*/
1679 1651
1680static int me4000_ao_prepare(me4000_ao_context_t * ao_context) 1652static int me4000_ao_prepare(struct me4000_ao_context *ao_context)
1681{ 1653{
1682 unsigned long flags; 1654 unsigned long flags;
1683 1655
@@ -1756,7 +1728,7 @@ static int me4000_ao_prepare(me4000_ao_context_t * ao_context)
1756 return 0; 1728 return 0;
1757} 1729}
1758 1730
1759static int me4000_ao_reset(me4000_ao_context_t * ao_context) 1731static int me4000_ao_reset(struct me4000_ao_context *ao_context)
1760{ 1732{
1761 u32 tmp; 1733 u32 tmp;
1762 wait_queue_head_t queue; 1734 wait_queue_head_t queue;
@@ -1777,9 +1749,10 @@ static int me4000_ao_reset(me4000_ao_context_t * ao_context)
1777 tmp |= ME4000_AO_CTRL_BIT_IMMEDIATE_STOP; 1749 tmp |= ME4000_AO_CTRL_BIT_IMMEDIATE_STOP;
1778 me4000_outl(tmp, ao_context->ctrl_reg); 1750 me4000_outl(tmp, ao_context->ctrl_reg);
1779 1751
1780 while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) { 1752 wait_event_timeout(queue,
1781 sleep_on_timeout(&queue, 1); 1753 (inl(ao_context->status_reg) &
1782 } 1754 ME4000_AO_STATUS_BIT_FSM) == 0,
1755 1);
1783 1756
1784 /* Set to transparent mode */ 1757 /* Set to transparent mode */
1785 me4000_ao_simultaneous_disable(ao_context); 1758 me4000_ao_simultaneous_disable(ao_context);
@@ -1812,9 +1785,10 @@ static int me4000_ao_reset(me4000_ao_context_t * ao_context)
1812 me4000_outl(tmp, ao_context->ctrl_reg); 1785 me4000_outl(tmp, ao_context->ctrl_reg);
1813 spin_unlock_irqrestore(&ao_context->int_lock, flags); 1786 spin_unlock_irqrestore(&ao_context->int_lock, flags);
1814 1787
1815 while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) { 1788 wait_event_timeout(queue,
1816 sleep_on_timeout(&queue, 1); 1789 (inl(ao_context->status_reg) &
1817 } 1790 ME4000_AO_STATUS_BIT_FSM) == 0,
1791 1);
1818 1792
1819 /* Clear the circular buffer */ 1793 /* Clear the circular buffer */
1820 ao_context->circ_buf.head = 0; 1794 ao_context->circ_buf.head = 0;
@@ -1853,9 +1827,9 @@ static int me4000_ao_reset(me4000_ao_context_t * ao_context)
1853} 1827}
1854 1828
1855static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff, 1829static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff,
1856 size_t cnt, loff_t * offp) 1830 size_t cnt, loff_t *offp)
1857{ 1831{
1858 me4000_ao_context_t *ao_context = filep->private_data; 1832 struct me4000_ao_context *ao_context = filep->private_data;
1859 u32 value; 1833 u32 value;
1860 const u16 *buffer = (const u16 *)buff; 1834 const u16 *buffer = (const u16 *)buff;
1861 1835
@@ -1863,13 +1837,13 @@ static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff,
1863 1837
1864 if (cnt != 2) { 1838 if (cnt != 2) {
1865 printk(KERN_ERR 1839 printk(KERN_ERR
1866 "me4000_ao_write_sing():Write count is not 2\n"); 1840 "%s:Write count is not 2\n", __func__);
1867 return -EINVAL; 1841 return -EINVAL;
1868 } 1842 }
1869 1843
1870 if (get_user(value, buffer)) { 1844 if (get_user(value, buffer)) {
1871 printk(KERN_ERR 1845 printk(KERN_ERR
1872 "me4000_ao_write_sing():Cannot copy data from user\n"); 1846 "%s:Cannot copy data from user\n", __func__);
1873 return -EFAULT; 1847 return -EFAULT;
1874 } 1848 }
1875 1849
@@ -1879,9 +1853,9 @@ static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff,
1879} 1853}
1880 1854
1881static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff, 1855static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
1882 size_t cnt, loff_t * offp) 1856 size_t cnt, loff_t *offp)
1883{ 1857{
1884 me4000_ao_context_t *ao_context = filep->private_data; 1858 struct me4000_ao_context *ao_context = filep->private_data;
1885 size_t i; 1859 size_t i;
1886 u32 value; 1860 u32 value;
1887 u32 tmp; 1861 u32 tmp;
@@ -1893,13 +1867,13 @@ static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
1893 /* Check if a conversion is already running */ 1867 /* Check if a conversion is already running */
1894 if (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) { 1868 if (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) {
1895 printk(KERN_ERR 1869 printk(KERN_ERR
1896 "ME4000:me4000_ao_write_wrap():There is already a conversion running\n"); 1870 "%s:There is already a conversion running\n", __func__);
1897 return -EBUSY; 1871 return -EBUSY;
1898 } 1872 }
1899 1873
1900 if (count > ME4000_AO_FIFO_COUNT) { 1874 if (count > ME4000_AO_FIFO_COUNT) {
1901 printk(KERN_ERR 1875 printk(KERN_ERR
1902 "me4000_ao_write_wrap():Can't load more than %d values\n", 1876 "%s:Can't load more than %d values\n", __func__,
1903 ME4000_AO_FIFO_COUNT); 1877 ME4000_AO_FIFO_COUNT);
1904 return -ENOSPC; 1878 return -ENOSPC;
1905 } 1879 }
@@ -1914,7 +1888,7 @@ static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
1914 for (i = 0; i < count; i++) { 1888 for (i = 0; i < count; i++) {
1915 if (get_user(value, buffer + i)) { 1889 if (get_user(value, buffer + i)) {
1916 printk(KERN_ERR 1890 printk(KERN_ERR
1917 "me4000_ao_write_single():Cannot copy data from user\n"); 1891 "%s:Cannot copy data from user\n", __func__);
1918 return -EFAULT; 1892 return -EFAULT;
1919 } 1893 }
1920 if (((ao_context->fifo_reg & 0xFF) == ME4000_AO_01_FIFO_REG) 1894 if (((ao_context->fifo_reg & 0xFF) == ME4000_AO_01_FIFO_REG)
@@ -1928,9 +1902,9 @@ static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
1928} 1902}
1929 1903
1930static ssize_t me4000_ao_write_cont(struct file *filep, const char *buff, 1904static ssize_t me4000_ao_write_cont(struct file *filep, const char *buff,
1931 size_t cnt, loff_t * offp) 1905 size_t cnt, loff_t *offp)
1932{ 1906{
1933 me4000_ao_context_t *ao_context = filep->private_data; 1907 struct me4000_ao_context *ao_context = filep->private_data;
1934 const u16 *buffer = (const u16 *)buff; 1908 const u16 *buffer = (const u16 *)buff;
1935 size_t count = cnt / 2; 1909 size_t count = cnt / 2;
1936 unsigned long flags; 1910 unsigned long flags;
@@ -2154,9 +2128,9 @@ static ssize_t me4000_ao_write_cont(struct file *filep, const char *buff,
2154 return 2 * ret; 2128 return 2 * ret;
2155} 2129}
2156 2130
2157static unsigned int me4000_ao_poll_cont(struct file *file_p, poll_table * wait) 2131static unsigned int me4000_ao_poll_cont(struct file *file_p, poll_table *wait)
2158{ 2132{
2159 me4000_ao_context_t *ao_context; 2133 struct me4000_ao_context *ao_context;
2160 unsigned long mask = 0; 2134 unsigned long mask = 0;
2161 2135
2162 CALL_PDEBUG("me4000_ao_poll_cont() is executed\n"); 2136 CALL_PDEBUG("me4000_ao_poll_cont() is executed\n");
@@ -2177,7 +2151,7 @@ static unsigned int me4000_ao_poll_cont(struct file *file_p, poll_table * wait)
2177static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p, 2151static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p,
2178 int datasync) 2152 int datasync)
2179{ 2153{
2180 me4000_ao_context_t *ao_context; 2154 struct me4000_ao_context *ao_context;
2181 wait_queue_head_t queue; 2155 wait_queue_head_t queue;
2182 2156
2183 CALL_PDEBUG("me4000_ao_fsync_cont() is executed\n"); 2157 CALL_PDEBUG("me4000_ao_fsync_cont() is executed\n");
@@ -2187,15 +2161,19 @@ static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p,
2187 2161
2188 while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) { 2162 while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) {
2189 interruptible_sleep_on_timeout(&queue, 1); 2163 interruptible_sleep_on_timeout(&queue, 1);
2164 wait_event_interruptible_timeout(queue,
2165 !(inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM),
2166 1);
2190 if (ao_context->pipe_flag) { 2167 if (ao_context->pipe_flag) {
2191 printk(KERN_ERR 2168 printk(KERN_ERR
2192 "me4000_ao_fsync_cont():Broken pipe detected\n"); 2169 "%s:Broken pipe detected\n", __func__);
2193 return -EPIPE; 2170 return -EPIPE;
2194 } 2171 }
2195 2172
2196 if (signal_pending(current)) { 2173 if (signal_pending(current)) {
2197 printk(KERN_ERR 2174 printk(KERN_ERR
2198 "me4000_ao_fsync_cont():Wait on state machine interrupted\n"); 2175 "%s:Wait on state machine interrupted\n",
2176 __func__);
2199 return -EINTR; 2177 return -EINTR;
2200 } 2178 }
2201 } 2179 }
@@ -2206,7 +2184,7 @@ static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p,
2206static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p, 2184static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
2207 unsigned int service, unsigned long arg) 2185 unsigned int service, unsigned long arg)
2208{ 2186{
2209 me4000_ao_context_t *ao_context; 2187 struct me4000_ao_context *ao_context;
2210 2188
2211 CALL_PDEBUG("me4000_ao_ioctl_sing() is executed\n"); 2189 CALL_PDEBUG("me4000_ao_ioctl_sing() is executed\n");
2212 2190
@@ -2229,7 +2207,7 @@ static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
2229 case ME4000_AO_PRELOAD_UPDATE: 2207 case ME4000_AO_PRELOAD_UPDATE:
2230 return me4000_ao_preload_update(ao_context); 2208 return me4000_ao_preload_update(ao_context);
2231 case ME4000_GET_USER_INFO: 2209 case ME4000_GET_USER_INFO:
2232 return me4000_get_user_info((me4000_user_info_t *) arg, 2210 return me4000_get_user_info((struct me4000_user_info *)arg,
2233 ao_context->board_info); 2211 ao_context->board_info);
2234 case ME4000_AO_SIMULTANEOUS_EX_TRIG: 2212 case ME4000_AO_SIMULTANEOUS_EX_TRIG:
2235 return me4000_ao_simultaneous_ex_trig(ao_context); 2213 return me4000_ao_simultaneous_ex_trig(ao_context);
@@ -2239,8 +2217,9 @@ static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
2239 return me4000_ao_simultaneous_disable(ao_context); 2217 return me4000_ao_simultaneous_disable(ao_context);
2240 case ME4000_AO_SIMULTANEOUS_UPDATE: 2218 case ME4000_AO_SIMULTANEOUS_UPDATE:
2241 return 2219 return
2242 me4000_ao_simultaneous_update((me4000_ao_channel_list_t *) 2220 me4000_ao_simultaneous_update(
2243 arg, ao_context); 2221 (struct me4000_ao_channel_list *)arg,
2222 ao_context);
2244 case ME4000_AO_EX_TRIG_TIMEOUT: 2223 case ME4000_AO_EX_TRIG_TIMEOUT:
2245 return me4000_ao_ex_trig_timeout((unsigned long *)arg, 2224 return me4000_ao_ex_trig_timeout((unsigned long *)arg,
2246 ao_context); 2225 ao_context);
@@ -2258,7 +2237,7 @@ static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
2258static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p, 2237static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p,
2259 unsigned int service, unsigned long arg) 2238 unsigned int service, unsigned long arg)
2260{ 2239{
2261 me4000_ao_context_t *ao_context; 2240 struct me4000_ao_context *ao_context;
2262 2241
2263 CALL_PDEBUG("me4000_ao_ioctl_wrap() is executed\n"); 2242 CALL_PDEBUG("me4000_ao_ioctl_wrap() is executed\n");
2264 2243
@@ -2287,7 +2266,7 @@ static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p,
2287 case ME4000_AO_EX_TRIG_DISABLE: 2266 case ME4000_AO_EX_TRIG_DISABLE:
2288 return me4000_ao_ex_trig_disable(ao_context); 2267 return me4000_ao_ex_trig_disable(ao_context);
2289 case ME4000_GET_USER_INFO: 2268 case ME4000_GET_USER_INFO:
2290 return me4000_get_user_info((me4000_user_info_t *) arg, 2269 return me4000_get_user_info((struct me4000_user_info *)arg,
2291 ao_context->board_info); 2270 ao_context->board_info);
2292 case ME4000_AO_FSM_STATE: 2271 case ME4000_AO_FSM_STATE:
2293 return me4000_ao_fsm_state((int *)arg, ao_context); 2272 return me4000_ao_fsm_state((int *)arg, ao_context);
@@ -2310,7 +2289,7 @@ static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p,
2310static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p, 2289static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p,
2311 unsigned int service, unsigned long arg) 2290 unsigned int service, unsigned long arg)
2312{ 2291{
2313 me4000_ao_context_t *ao_context; 2292 struct me4000_ao_context *ao_context;
2314 2293
2315 CALL_PDEBUG("me4000_ao_ioctl_cont() is executed\n"); 2294 CALL_PDEBUG("me4000_ao_ioctl_cont() is executed\n");
2316 2295
@@ -2345,7 +2324,7 @@ static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p,
2345 case ME4000_AO_FSM_STATE: 2324 case ME4000_AO_FSM_STATE:
2346 return me4000_ao_fsm_state((int *)arg, ao_context); 2325 return me4000_ao_fsm_state((int *)arg, ao_context);
2347 case ME4000_GET_USER_INFO: 2326 case ME4000_GET_USER_INFO:
2348 return me4000_get_user_info((me4000_user_info_t *) arg, 2327 return me4000_get_user_info((struct me4000_user_info *)arg,
2349 ao_context->board_info); 2328 ao_context->board_info);
2350 case ME4000_AO_SYNCHRONOUS_EX_TRIG: 2329 case ME4000_AO_SYNCHRONOUS_EX_TRIG:
2351 return me4000_ao_synchronous_ex_trig(ao_context); 2330 return me4000_ao_synchronous_ex_trig(ao_context);
@@ -2362,7 +2341,8 @@ static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p,
2362 return 0; 2341 return 0;
2363} 2342}
2364 2343
2365static int me4000_ao_start(unsigned long *arg, me4000_ao_context_t * ao_context) 2344static int me4000_ao_start(unsigned long *arg,
2345 struct me4000_ao_context *ao_context)
2366{ 2346{
2367 u32 tmp; 2347 u32 tmp;
2368 wait_queue_head_t queue; 2348 wait_queue_head_t queue;
@@ -2412,7 +2392,7 @@ static int me4000_ao_start(unsigned long *arg, me4000_ao_context_t * ao_context)
2412 return 0; 2392 return 0;
2413} 2393}
2414 2394
2415static int me4000_ao_stop(me4000_ao_context_t * ao_context) 2395static int me4000_ao_stop(struct me4000_ao_context *ao_context)
2416{ 2396{
2417 u32 tmp; 2397 u32 tmp;
2418 wait_queue_head_t queue; 2398 wait_queue_head_t queue;
@@ -2445,7 +2425,7 @@ static int me4000_ao_stop(me4000_ao_context_t * ao_context)
2445 return 0; 2425 return 0;
2446} 2426}
2447 2427
2448static int me4000_ao_immediate_stop(me4000_ao_context_t * ao_context) 2428static int me4000_ao_immediate_stop(struct me4000_ao_context *ao_context)
2449{ 2429{
2450 u32 tmp; 2430 u32 tmp;
2451 wait_queue_head_t queue; 2431 wait_queue_head_t queue;
@@ -2477,8 +2457,8 @@ static int me4000_ao_immediate_stop(me4000_ao_context_t * ao_context)
2477 return 0; 2457 return 0;
2478} 2458}
2479 2459
2480static int me4000_ao_timer_set_divisor(u32 * arg, 2460static int me4000_ao_timer_set_divisor(u32 *arg,
2481 me4000_ao_context_t * ao_context) 2461 struct me4000_ao_context *ao_context)
2482{ 2462{
2483 u32 divisor; 2463 u32 divisor;
2484 u32 tmp; 2464 u32 tmp;
@@ -2518,7 +2498,7 @@ static int me4000_ao_timer_set_divisor(u32 * arg,
2518} 2498}
2519 2499
2520static int me4000_ao_ex_trig_set_edge(int *arg, 2500static int me4000_ao_ex_trig_set_edge(int *arg,
2521 me4000_ao_context_t * ao_context) 2501 struct me4000_ao_context *ao_context)
2522{ 2502{
2523 int mode; 2503 int mode;
2524 u32 tmp; 2504 u32 tmp;
@@ -2569,7 +2549,7 @@ static int me4000_ao_ex_trig_set_edge(int *arg,
2569 return 0; 2549 return 0;
2570} 2550}
2571 2551
2572static int me4000_ao_ex_trig_enable(me4000_ao_context_t * ao_context) 2552static int me4000_ao_ex_trig_enable(struct me4000_ao_context *ao_context)
2573{ 2553{
2574 u32 tmp; 2554 u32 tmp;
2575 unsigned long flags; 2555 unsigned long flags;
@@ -2593,7 +2573,7 @@ static int me4000_ao_ex_trig_enable(me4000_ao_context_t * ao_context)
2593 return 0; 2573 return 0;
2594} 2574}
2595 2575
2596static int me4000_ao_ex_trig_disable(me4000_ao_context_t * ao_context) 2576static int me4000_ao_ex_trig_disable(struct me4000_ao_context *ao_context)
2597{ 2577{
2598 u32 tmp; 2578 u32 tmp;
2599 unsigned long flags; 2579 unsigned long flags;
@@ -2617,7 +2597,7 @@ static int me4000_ao_ex_trig_disable(me4000_ao_context_t * ao_context)
2617 return 0; 2597 return 0;
2618} 2598}
2619 2599
2620static int me4000_ao_simultaneous_disable(me4000_ao_context_t * ao_context) 2600static int me4000_ao_simultaneous_disable(struct me4000_ao_context *ao_context)
2621{ 2601{
2622 u32 tmp; 2602 u32 tmp;
2623 2603
@@ -2643,7 +2623,7 @@ static int me4000_ao_simultaneous_disable(me4000_ao_context_t * ao_context)
2643 return 0; 2623 return 0;
2644} 2624}
2645 2625
2646static int me4000_ao_simultaneous_ex_trig(me4000_ao_context_t * ao_context) 2626static int me4000_ao_simultaneous_ex_trig(struct me4000_ao_context *ao_context)
2647{ 2627{
2648 u32 tmp; 2628 u32 tmp;
2649 2629
@@ -2659,7 +2639,7 @@ static int me4000_ao_simultaneous_ex_trig(me4000_ao_context_t * ao_context)
2659 return 0; 2639 return 0;
2660} 2640}
2661 2641
2662static int me4000_ao_simultaneous_sw(me4000_ao_context_t * ao_context) 2642static int me4000_ao_simultaneous_sw(struct me4000_ao_context *ao_context)
2663{ 2643{
2664 u32 tmp; 2644 u32 tmp;
2665 2645
@@ -2675,13 +2655,13 @@ static int me4000_ao_simultaneous_sw(me4000_ao_context_t * ao_context)
2675 return 0; 2655 return 0;
2676} 2656}
2677 2657
2678static int me4000_ao_preload(me4000_ao_context_t * ao_context) 2658static int me4000_ao_preload(struct me4000_ao_context *ao_context)
2679{ 2659{
2680 CALL_PDEBUG("me4000_ao_preload() is executed\n"); 2660 CALL_PDEBUG("me4000_ao_preload() is executed\n");
2681 return me4000_ao_simultaneous_sw(ao_context); 2661 return me4000_ao_simultaneous_sw(ao_context);
2682} 2662}
2683 2663
2684static int me4000_ao_preload_update(me4000_ao_context_t * ao_context) 2664static int me4000_ao_preload_update(struct me4000_ao_context *ao_context)
2685{ 2665{
2686 u32 tmp; 2666 u32 tmp;
2687 u32 ctrl; 2667 u32 ctrl;
@@ -2705,10 +2685,12 @@ static int me4000_ao_preload_update(me4000_ao_context_t * ao_context)
2705 if (! 2685 if (!
2706 (tmp & 2686 (tmp &
2707 (0x1 << 2687 (0x1 <<
2708 (((me4000_ao_context_t *) entry)->index + 16)))) { 2688 (((struct me4000_ao_context *)entry)->index
2689 + 16)))) {
2709 tmp &= 2690 tmp &=
2710 ~(0x1 << 2691 ~(0x1 <<
2711 (((me4000_ao_context_t *) entry)->index)); 2692 (((struct me4000_ao_context *)entry)->
2693 index));
2712 } 2694 }
2713 } 2695 }
2714 } 2696 }
@@ -2718,18 +2700,19 @@ static int me4000_ao_preload_update(me4000_ao_context_t * ao_context)
2718 return 0; 2700 return 0;
2719} 2701}
2720 2702
2721static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * arg, 2703static int me4000_ao_simultaneous_update(struct me4000_ao_channel_list *arg,
2722 me4000_ao_context_t * ao_context) 2704 struct me4000_ao_context *ao_context)
2723{ 2705{
2724 int err; 2706 int err;
2725 int i; 2707 int i;
2726 u32 tmp; 2708 u32 tmp;
2727 me4000_ao_channel_list_t channels; 2709 struct me4000_ao_channel_list channels;
2728 2710
2729 CALL_PDEBUG("me4000_ao_simultaneous_update() is executed\n"); 2711 CALL_PDEBUG("me4000_ao_simultaneous_update() is executed\n");
2730 2712
2731 /* Copy data from user */ 2713 /* Copy data from user */
2732 err = copy_from_user(&channels, arg, sizeof(me4000_ao_channel_list_t)); 2714 err = copy_from_user(&channels, arg,
2715 sizeof(struct me4000_ao_channel_list));
2733 if (err) { 2716 if (err) {
2734 printk(KERN_ERR 2717 printk(KERN_ERR
2735 "ME4000:me4000_ao_simultaneous_update():Can't copy command\n"); 2718 "ME4000:me4000_ao_simultaneous_update():Can't copy command\n");
@@ -2737,13 +2720,12 @@ static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * arg,
2737 } 2720 }
2738 2721
2739 channels.list = 2722 channels.list =
2740 kmalloc(sizeof(unsigned long) * channels.count, GFP_KERNEL); 2723 kzalloc(sizeof(unsigned long) * channels.count, GFP_KERNEL);
2741 if (!channels.list) { 2724 if (!channels.list) {
2742 printk(KERN_ERR 2725 printk(KERN_ERR
2743 "ME4000:me4000_ao_simultaneous_update():Can't get buffer\n"); 2726 "ME4000:me4000_ao_simultaneous_update():Can't get buffer\n");
2744 return -ENOMEM; 2727 return -ENOMEM;
2745 } 2728 }
2746 memset(channels.list, 0, sizeof(unsigned long) * channels.count);
2747 2729
2748 /* Copy channel list from user */ 2730 /* Copy channel list from user */
2749 err = 2731 err =
@@ -2777,7 +2759,7 @@ static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * arg,
2777 return 0; 2759 return 0;
2778} 2760}
2779 2761
2780static int me4000_ao_synchronous_ex_trig(me4000_ao_context_t * ao_context) 2762static int me4000_ao_synchronous_ex_trig(struct me4000_ao_context *ao_context)
2781{ 2763{
2782 u32 tmp; 2764 u32 tmp;
2783 unsigned long flags; 2765 unsigned long flags;
@@ -2813,7 +2795,7 @@ static int me4000_ao_synchronous_ex_trig(me4000_ao_context_t * ao_context)
2813 return 0; 2795 return 0;
2814} 2796}
2815 2797
2816static int me4000_ao_synchronous_sw(me4000_ao_context_t * ao_context) 2798static int me4000_ao_synchronous_sw(struct me4000_ao_context *ao_context)
2817{ 2799{
2818 u32 tmp; 2800 u32 tmp;
2819 unsigned long flags; 2801 unsigned long flags;
@@ -2848,13 +2830,13 @@ static int me4000_ao_synchronous_sw(me4000_ao_context_t * ao_context)
2848 return 0; 2830 return 0;
2849} 2831}
2850 2832
2851static int me4000_ao_synchronous_disable(me4000_ao_context_t * ao_context) 2833static int me4000_ao_synchronous_disable(struct me4000_ao_context *ao_context)
2852{ 2834{
2853 return me4000_ao_simultaneous_disable(ao_context); 2835 return me4000_ao_simultaneous_disable(ao_context);
2854} 2836}
2855 2837
2856static int me4000_ao_get_free_buffer(unsigned long *arg, 2838static int me4000_ao_get_free_buffer(unsigned long *arg,
2857 me4000_ao_context_t * ao_context) 2839 struct me4000_ao_context *ao_context)
2858{ 2840{
2859 unsigned long c; 2841 unsigned long c;
2860 int err; 2842 int err;
@@ -2864,7 +2846,7 @@ static int me4000_ao_get_free_buffer(unsigned long *arg,
2864 err = copy_to_user(arg, &c, sizeof(unsigned long)); 2846 err = copy_to_user(arg, &c, sizeof(unsigned long));
2865 if (err) { 2847 if (err) {
2866 printk(KERN_ERR 2848 printk(KERN_ERR
2867 "ME4000:me4000_ao_get_free_buffer():Can't copy to user space\n"); 2849 "%s:Can't copy to user space\n", __func__);
2868 return -EFAULT; 2850 return -EFAULT;
2869 } 2851 }
2870 2852
@@ -2872,7 +2854,7 @@ static int me4000_ao_get_free_buffer(unsigned long *arg,
2872} 2854}
2873 2855
2874static int me4000_ao_ex_trig_timeout(unsigned long *arg, 2856static int me4000_ao_ex_trig_timeout(unsigned long *arg,
2875 me4000_ao_context_t * ao_context) 2857 struct me4000_ao_context *ao_context)
2876{ 2858{
2877 u32 tmp; 2859 u32 tmp;
2878 wait_queue_head_t queue; 2860 wait_queue_head_t queue;
@@ -2928,7 +2910,7 @@ static int me4000_ao_ex_trig_timeout(unsigned long *arg,
2928 return 0; 2910 return 0;
2929} 2911}
2930 2912
2931static int me4000_ao_enable_do(me4000_ao_context_t * ao_context) 2913static int me4000_ao_enable_do(struct me4000_ao_context *ao_context)
2932{ 2914{
2933 u32 tmp; 2915 u32 tmp;
2934 unsigned long flags; 2916 unsigned long flags;
@@ -2959,7 +2941,7 @@ static int me4000_ao_enable_do(me4000_ao_context_t * ao_context)
2959 return 0; 2941 return 0;
2960} 2942}
2961 2943
2962static int me4000_ao_disable_do(me4000_ao_context_t * ao_context) 2944static int me4000_ao_disable_do(struct me4000_ao_context *ao_context)
2963{ 2945{
2964 u32 tmp; 2946 u32 tmp;
2965 unsigned long flags; 2947 unsigned long flags;
@@ -2989,7 +2971,7 @@ static int me4000_ao_disable_do(me4000_ao_context_t * ao_context)
2989 return 0; 2971 return 0;
2990} 2972}
2991 2973
2992static int me4000_ao_fsm_state(int *arg, me4000_ao_context_t * ao_context) 2974static int me4000_ao_fsm_state(int *arg, struct me4000_ao_context *ao_context)
2993{ 2975{
2994 unsigned long tmp; 2976 unsigned long tmp;
2995 2977
@@ -3012,9 +2994,9 @@ static int me4000_ao_fsm_state(int *arg, me4000_ao_context_t * ao_context)
3012 return 0; 2994 return 0;
3013} 2995}
3014 2996
3015/*------------------------------- Analog input stuff --------------------------------------*/ 2997/*------------------------- Analog input stuff -------------------------------*/
3016 2998
3017static int me4000_ai_prepare(me4000_ai_context_t * ai_context) 2999static int me4000_ai_prepare(struct me4000_ai_context *ai_context)
3018{ 3000{
3019 wait_queue_head_t queue; 3001 wait_queue_head_t queue;
3020 int err; 3002 int err;
@@ -3057,14 +3039,13 @@ static int me4000_ai_prepare(me4000_ai_context_t * ai_context)
3057 3039
3058 /* Allocate circular buffer */ 3040 /* Allocate circular buffer */
3059 ai_context->circ_buf.buf = 3041 ai_context->circ_buf.buf =
3060 kmalloc(ME4000_AI_BUFFER_SIZE, GFP_KERNEL); 3042 kzalloc(ME4000_AI_BUFFER_SIZE, GFP_KERNEL);
3061 if (!ai_context->circ_buf.buf) { 3043 if (!ai_context->circ_buf.buf) {
3062 printk(KERN_ERR 3044 printk(KERN_ERR
3063 "ME4000:me4000_ai_prepare():Can't get circular buffer\n"); 3045 "ME4000:me4000_ai_prepare():Can't get circular buffer\n");
3064 free_irq(ai_context->irq, ai_context); 3046 free_irq(ai_context->irq, ai_context);
3065 return -ENOMEM; 3047 return -ENOMEM;
3066 } 3048 }
3067 memset(ai_context->circ_buf.buf, 0, ME4000_AI_BUFFER_SIZE);
3068 3049
3069 /* Clear the circular buffer */ 3050 /* Clear the circular buffer */
3070 ai_context->circ_buf.head = 0; 3051 ai_context->circ_buf.head = 0;
@@ -3074,7 +3055,7 @@ static int me4000_ai_prepare(me4000_ai_context_t * ai_context)
3074 return 0; 3055 return 0;
3075} 3056}
3076 3057
3077static int me4000_ai_reset(me4000_ai_context_t * ai_context) 3058static int me4000_ai_reset(struct me4000_ai_context *ai_context)
3078{ 3059{
3079 wait_queue_head_t queue; 3060 wait_queue_head_t queue;
3080 u32 tmp; 3061 u32 tmp;
@@ -3139,7 +3120,7 @@ static int me4000_ai_reset(me4000_ai_context_t * ai_context)
3139static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p, 3120static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
3140 unsigned int service, unsigned long arg) 3121 unsigned int service, unsigned long arg)
3141{ 3122{
3142 me4000_ai_context_t *ai_context; 3123 struct me4000_ai_context *ai_context;
3143 3124
3144 CALL_PDEBUG("me4000_ai_ioctl_sing() is executed\n"); 3125 CALL_PDEBUG("me4000_ai_ioctl_sing() is executed\n");
3145 3126
@@ -3157,16 +3138,17 @@ static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
3157 3138
3158 switch (service) { 3139 switch (service) {
3159 case ME4000_AI_SINGLE: 3140 case ME4000_AI_SINGLE:
3160 return me4000_ai_single((me4000_ai_single_t *) arg, ai_context); 3141 return me4000_ai_single((struct me4000_ai_single *)arg,
3142 ai_context);
3161 case ME4000_AI_EX_TRIG_ENABLE: 3143 case ME4000_AI_EX_TRIG_ENABLE:
3162 return me4000_ai_ex_trig_enable(ai_context); 3144 return me4000_ai_ex_trig_enable(ai_context);
3163 case ME4000_AI_EX_TRIG_DISABLE: 3145 case ME4000_AI_EX_TRIG_DISABLE:
3164 return me4000_ai_ex_trig_disable(ai_context); 3146 return me4000_ai_ex_trig_disable(ai_context);
3165 case ME4000_AI_EX_TRIG_SETUP: 3147 case ME4000_AI_EX_TRIG_SETUP:
3166 return me4000_ai_ex_trig_setup((me4000_ai_trigger_t *) arg, 3148 return me4000_ai_ex_trig_setup((struct me4000_ai_trigger *)arg,
3167 ai_context); 3149 ai_context);
3168 case ME4000_GET_USER_INFO: 3150 case ME4000_GET_USER_INFO:
3169 return me4000_get_user_info((me4000_user_info_t *) arg, 3151 return me4000_get_user_info((struct me4000_user_info *)arg,
3170 ai_context->board_info); 3152 ai_context->board_info);
3171 case ME4000_AI_OFFSET_ENABLE: 3153 case ME4000_AI_OFFSET_ENABLE:
3172 return me4000_ai_offset_enable(ai_context); 3154 return me4000_ai_offset_enable(ai_context);
@@ -3177,9 +3159,11 @@ static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
3177 case ME4000_AI_FULLSCALE_DISABLE: 3159 case ME4000_AI_FULLSCALE_DISABLE:
3178 return me4000_ai_fullscale_disable(ai_context); 3160 return me4000_ai_fullscale_disable(ai_context);
3179 case ME4000_AI_EEPROM_READ: 3161 case ME4000_AI_EEPROM_READ:
3180 return me4000_eeprom_read((me4000_eeprom_t *) arg, ai_context); 3162 return me4000_eeprom_read((struct me4000_eeprom *)arg,
3163 ai_context);
3181 case ME4000_AI_EEPROM_WRITE: 3164 case ME4000_AI_EEPROM_WRITE:
3182 return me4000_eeprom_write((me4000_eeprom_t *) arg, ai_context); 3165 return me4000_eeprom_write((struct me4000_eeprom *)arg,
3166 ai_context);
3183 default: 3167 default:
3184 printk(KERN_ERR 3168 printk(KERN_ERR
3185 "me4000_ai_ioctl_sing():Invalid service number\n"); 3169 "me4000_ai_ioctl_sing():Invalid service number\n");
@@ -3188,10 +3172,10 @@ static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
3188 return 0; 3172 return 0;
3189} 3173}
3190 3174
3191static int me4000_ai_single(me4000_ai_single_t * arg, 3175static int me4000_ai_single(struct me4000_ai_single *arg,
3192 me4000_ai_context_t * ai_context) 3176 struct me4000_ai_context *ai_context)
3193{ 3177{
3194 me4000_ai_single_t cmd; 3178 struct me4000_ai_single cmd;
3195 int err; 3179 int err;
3196 u32 tmp; 3180 u32 tmp;
3197 wait_queue_head_t queue; 3181 wait_queue_head_t queue;
@@ -3202,7 +3186,7 @@ static int me4000_ai_single(me4000_ai_single_t * arg,
3202 init_waitqueue_head(&queue); 3186 init_waitqueue_head(&queue);
3203 3187
3204 /* Copy data from user */ 3188 /* Copy data from user */
3205 err = copy_from_user(&cmd, arg, sizeof(me4000_ai_single_t)); 3189 err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_single));
3206 if (err) { 3190 if (err) {
3207 printk(KERN_ERR 3191 printk(KERN_ERR
3208 "ME4000:me4000_ai_single():Can't copy from user space\n"); 3192 "ME4000:me4000_ai_single():Can't copy from user space\n");
@@ -3301,7 +3285,7 @@ static int me4000_ai_single(me4000_ai_single_t * arg,
3301 cmd.value = me4000_inl(ai_context->data_reg) & 0xFFFF; 3285 cmd.value = me4000_inl(ai_context->data_reg) & 0xFFFF;
3302 3286
3303 /* Copy result back to user */ 3287 /* Copy result back to user */
3304 err = copy_to_user(arg, &cmd, sizeof(me4000_ai_single_t)); 3288 err = copy_to_user(arg, &cmd, sizeof(struct me4000_ai_single));
3305 if (err) { 3289 if (err) {
3306 printk(KERN_ERR 3290 printk(KERN_ERR
3307 "ME4000:me4000_ai_single():Can't copy to user space\n"); 3291 "ME4000:me4000_ai_single():Can't copy to user space\n");
@@ -3314,7 +3298,7 @@ static int me4000_ai_single(me4000_ai_single_t * arg,
3314static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p, 3298static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
3315 unsigned int service, unsigned long arg) 3299 unsigned int service, unsigned long arg)
3316{ 3300{
3317 me4000_ai_context_t *ai_context; 3301 struct me4000_ai_context *ai_context;
3318 3302
3319 CALL_PDEBUG("me4000_ai_ioctl_sw() is executed\n"); 3303 CALL_PDEBUG("me4000_ai_ioctl_sw() is executed\n");
3320 3304
@@ -3332,9 +3316,11 @@ static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
3332 3316
3333 switch (service) { 3317 switch (service) {
3334 case ME4000_AI_SC_SETUP: 3318 case ME4000_AI_SC_SETUP:
3335 return me4000_ai_sc_setup((me4000_ai_sc_t *) arg, ai_context); 3319 return me4000_ai_sc_setup((struct me4000_ai_sc *)arg,
3320 ai_context);
3336 case ME4000_AI_CONFIG: 3321 case ME4000_AI_CONFIG:
3337 return me4000_ai_config((me4000_ai_config_t *) arg, ai_context); 3322 return me4000_ai_config((struct me4000_ai_config *)arg,
3323 ai_context);
3338 case ME4000_AI_START: 3324 case ME4000_AI_START:
3339 return me4000_ai_start(ai_context); 3325 return me4000_ai_start(ai_context);
3340 case ME4000_AI_STOP: 3326 case ME4000_AI_STOP:
@@ -3344,19 +3330,20 @@ static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
3344 case ME4000_AI_FSM_STATE: 3330 case ME4000_AI_FSM_STATE:
3345 return me4000_ai_fsm_state((int *)arg, ai_context); 3331 return me4000_ai_fsm_state((int *)arg, ai_context);
3346 case ME4000_GET_USER_INFO: 3332 case ME4000_GET_USER_INFO:
3347 return me4000_get_user_info((me4000_user_info_t *) arg, 3333 return me4000_get_user_info((struct me4000_user_info *)arg,
3348 ai_context->board_info); 3334 ai_context->board_info);
3349 case ME4000_AI_EEPROM_READ: 3335 case ME4000_AI_EEPROM_READ:
3350 return me4000_eeprom_read((me4000_eeprom_t *) arg, ai_context); 3336 return me4000_eeprom_read((struct me4000_eeprom *)arg,
3337 ai_context);
3351 case ME4000_AI_EEPROM_WRITE: 3338 case ME4000_AI_EEPROM_WRITE:
3352 return me4000_eeprom_write((me4000_eeprom_t *) arg, ai_context); 3339 return me4000_eeprom_write((struct me4000_eeprom *)arg,
3340 ai_context);
3353 case ME4000_AI_GET_COUNT_BUFFER: 3341 case ME4000_AI_GET_COUNT_BUFFER:
3354 return me4000_ai_get_count_buffer((unsigned long *)arg, 3342 return me4000_ai_get_count_buffer((unsigned long *)arg,
3355 ai_context); 3343 ai_context);
3356 default: 3344 default:
3357 printk(KERN_ERR 3345 printk(KERN_ERR
3358 "ME4000:me4000_ai_ioctl_sw():Invalid service number %d\n", 3346 "%s:Invalid service number %d\n", __func__, service);
3359 service);
3360 return -ENOTTY; 3347 return -ENOTTY;
3361 } 3348 }
3362 return 0; 3349 return 0;
@@ -3365,7 +3352,7 @@ static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
3365static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p, 3352static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
3366 unsigned int service, unsigned long arg) 3353 unsigned int service, unsigned long arg)
3367{ 3354{
3368 me4000_ai_context_t *ai_context; 3355 struct me4000_ai_context *ai_context;
3369 3356
3370 CALL_PDEBUG("me4000_ai_ioctl_ext() is executed\n"); 3357 CALL_PDEBUG("me4000_ai_ioctl_ext() is executed\n");
3371 3358
@@ -3383,9 +3370,11 @@ static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
3383 3370
3384 switch (service) { 3371 switch (service) {
3385 case ME4000_AI_SC_SETUP: 3372 case ME4000_AI_SC_SETUP:
3386 return me4000_ai_sc_setup((me4000_ai_sc_t *) arg, ai_context); 3373 return me4000_ai_sc_setup((struct me4000_ai_sc *)arg,
3374 ai_context);
3387 case ME4000_AI_CONFIG: 3375 case ME4000_AI_CONFIG:
3388 return me4000_ai_config((me4000_ai_config_t *) arg, ai_context); 3376 return me4000_ai_config((struct me4000_ai_config *)arg,
3377 ai_context);
3389 case ME4000_AI_START: 3378 case ME4000_AI_START:
3390 return me4000_ai_start_ex((unsigned long *)arg, ai_context); 3379 return me4000_ai_start_ex((unsigned long *)arg, ai_context);
3391 case ME4000_AI_STOP: 3380 case ME4000_AI_STOP:
@@ -3397,20 +3386,19 @@ static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
3397 case ME4000_AI_EX_TRIG_DISABLE: 3386 case ME4000_AI_EX_TRIG_DISABLE:
3398 return me4000_ai_ex_trig_disable(ai_context); 3387 return me4000_ai_ex_trig_disable(ai_context);
3399 case ME4000_AI_EX_TRIG_SETUP: 3388 case ME4000_AI_EX_TRIG_SETUP:
3400 return me4000_ai_ex_trig_setup((me4000_ai_trigger_t *) arg, 3389 return me4000_ai_ex_trig_setup((struct me4000_ai_trigger *)arg,
3401 ai_context); 3390 ai_context);
3402 case ME4000_AI_FSM_STATE: 3391 case ME4000_AI_FSM_STATE:
3403 return me4000_ai_fsm_state((int *)arg, ai_context); 3392 return me4000_ai_fsm_state((int *)arg, ai_context);
3404 case ME4000_GET_USER_INFO: 3393 case ME4000_GET_USER_INFO:
3405 return me4000_get_user_info((me4000_user_info_t *) arg, 3394 return me4000_get_user_info((struct me4000_user_info *)arg,
3406 ai_context->board_info); 3395 ai_context->board_info);
3407 case ME4000_AI_GET_COUNT_BUFFER: 3396 case ME4000_AI_GET_COUNT_BUFFER:
3408 return me4000_ai_get_count_buffer((unsigned long *)arg, 3397 return me4000_ai_get_count_buffer((unsigned long *)arg,
3409 ai_context); 3398 ai_context);
3410 default: 3399 default:
3411 printk(KERN_ERR 3400 printk(KERN_ERR
3412 "ME4000:me4000_ai_ioctl_ext():Invalid service number %d\n", 3401 "%s:Invalid service number %d\n", __func__ , service);
3413 service);
3414 return -ENOTTY; 3402 return -ENOTTY;
3415 } 3403 }
3416 return 0; 3404 return 0;
@@ -3418,7 +3406,7 @@ static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
3418 3406
3419static int me4000_ai_fasync(int fd, struct file *file_p, int mode) 3407static int me4000_ai_fasync(int fd, struct file *file_p, int mode)
3420{ 3408{
3421 me4000_ai_context_t *ai_context; 3409 struct me4000_ai_context *ai_context;
3422 3410
3423 CALL_PDEBUG("me4000_ao_fasync_cont() is executed\n"); 3411 CALL_PDEBUG("me4000_ao_fasync_cont() is executed\n");
3424 3412
@@ -3426,10 +3414,10 @@ static int me4000_ai_fasync(int fd, struct file *file_p, int mode)
3426 return fasync_helper(fd, file_p, mode, &ai_context->fasync_p); 3414 return fasync_helper(fd, file_p, mode, &ai_context->fasync_p);
3427} 3415}
3428 3416
3429static int me4000_ai_config(me4000_ai_config_t * arg, 3417static int me4000_ai_config(struct me4000_ai_config *arg,
3430 me4000_ai_context_t * ai_context) 3418 struct me4000_ai_context *ai_context)
3431{ 3419{
3432 me4000_ai_config_t cmd; 3420 struct me4000_ai_config cmd;
3433 u32 *list = NULL; 3421 u32 *list = NULL;
3434 u32 mode; 3422 u32 mode;
3435 int i; 3423 int i;
@@ -3451,7 +3439,7 @@ static int me4000_ai_config(me4000_ai_config_t * arg,
3451 } 3439 }
3452 3440
3453 /* Copy data from user */ 3441 /* Copy data from user */
3454 err = copy_from_user(&cmd, arg, sizeof(me4000_ai_config_t)); 3442 err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_config));
3455 if (err) { 3443 if (err) {
3456 printk(KERN_ERR 3444 printk(KERN_ERR
3457 "ME4000:me4000_ai_config():Can't copy from user space\n"); 3445 "ME4000:me4000_ai_config():Can't copy from user space\n");
@@ -3671,7 +3659,7 @@ static int me4000_ai_config(me4000_ai_config_t * arg,
3671 3659
3672 return 0; 3660 return 0;
3673 3661
3674 AI_CONFIG_ERR: 3662AI_CONFIG_ERR:
3675 3663
3676 /* Reset the timers */ 3664 /* Reset the timers */
3677 ai_context->chan_timer = 66; 3665 ai_context->chan_timer = 66;
@@ -3699,7 +3687,7 @@ static int me4000_ai_config(me4000_ai_config_t * arg,
3699 3687
3700} 3688}
3701 3689
3702static int ai_common_start(me4000_ai_context_t * ai_context) 3690static int ai_common_start(struct me4000_ai_context *ai_context)
3703{ 3691{
3704 u32 tmp; 3692 u32 tmp;
3705 CALL_PDEBUG("ai_common_start() is executed\n"); 3693 CALL_PDEBUG("ai_common_start() is executed\n");
@@ -3762,7 +3750,7 @@ static int ai_common_start(me4000_ai_context_t * ai_context)
3762 return 0; 3750 return 0;
3763} 3751}
3764 3752
3765static int me4000_ai_start(me4000_ai_context_t * ai_context) 3753static int me4000_ai_start(struct me4000_ai_context *ai_context)
3766{ 3754{
3767 int err; 3755 int err;
3768 CALL_PDEBUG("me4000_ai_start() is executed\n"); 3756 CALL_PDEBUG("me4000_ai_start() is executed\n");
@@ -3779,7 +3767,7 @@ static int me4000_ai_start(me4000_ai_context_t * ai_context)
3779} 3767}
3780 3768
3781static int me4000_ai_start_ex(unsigned long *arg, 3769static int me4000_ai_start_ex(unsigned long *arg,
3782 me4000_ai_context_t * ai_context) 3770 struct me4000_ai_context *ai_context)
3783{ 3771{
3784 int err; 3772 int err;
3785 wait_queue_head_t queue; 3773 wait_queue_head_t queue;
@@ -3834,7 +3822,7 @@ static int me4000_ai_start_ex(unsigned long *arg,
3834 return 0; 3822 return 0;
3835} 3823}
3836 3824
3837static int me4000_ai_stop(me4000_ai_context_t * ai_context) 3825static int me4000_ai_stop(struct me4000_ai_context *ai_context)
3838{ 3826{
3839 wait_queue_head_t queue; 3827 wait_queue_head_t queue;
3840 u32 tmp; 3828 u32 tmp;
@@ -3871,7 +3859,7 @@ static int me4000_ai_stop(me4000_ai_context_t * ai_context)
3871 return 0; 3859 return 0;
3872} 3860}
3873 3861
3874static int me4000_ai_immediate_stop(me4000_ai_context_t * ai_context) 3862static int me4000_ai_immediate_stop(struct me4000_ai_context *ai_context)
3875{ 3863{
3876 wait_queue_head_t queue; 3864 wait_queue_head_t queue;
3877 u32 tmp; 3865 u32 tmp;
@@ -3908,7 +3896,7 @@ static int me4000_ai_immediate_stop(me4000_ai_context_t * ai_context)
3908 return 0; 3896 return 0;
3909} 3897}
3910 3898
3911static int me4000_ai_ex_trig_enable(me4000_ai_context_t * ai_context) 3899static int me4000_ai_ex_trig_enable(struct me4000_ai_context *ai_context)
3912{ 3900{
3913 u32 tmp; 3901 u32 tmp;
3914 unsigned long flags; 3902 unsigned long flags;
@@ -3924,7 +3912,7 @@ static int me4000_ai_ex_trig_enable(me4000_ai_context_t * ai_context)
3924 return 0; 3912 return 0;
3925} 3913}
3926 3914
3927static int me4000_ai_ex_trig_disable(me4000_ai_context_t * ai_context) 3915static int me4000_ai_ex_trig_disable(struct me4000_ai_context *ai_context)
3928{ 3916{
3929 u32 tmp; 3917 u32 tmp;
3930 unsigned long flags; 3918 unsigned long flags;
@@ -3940,10 +3928,10 @@ static int me4000_ai_ex_trig_disable(me4000_ai_context_t * ai_context)
3940 return 0; 3928 return 0;
3941} 3929}
3942 3930
3943static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t * arg, 3931static int me4000_ai_ex_trig_setup(struct me4000_ai_trigger *arg,
3944 me4000_ai_context_t * ai_context) 3932 struct me4000_ai_context *ai_context)
3945{ 3933{
3946 me4000_ai_trigger_t cmd; 3934 struct me4000_ai_trigger cmd;
3947 int err; 3935 int err;
3948 u32 tmp; 3936 u32 tmp;
3949 unsigned long flags; 3937 unsigned long flags;
@@ -3951,7 +3939,7 @@ static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t * arg,
3951 CALL_PDEBUG("me4000_ai_ex_trig_setup() is executed\n"); 3939 CALL_PDEBUG("me4000_ai_ex_trig_setup() is executed\n");
3952 3940
3953 /* Copy data from user */ 3941 /* Copy data from user */
3954 err = copy_from_user(&cmd, arg, sizeof(me4000_ai_trigger_t)); 3942 err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_trigger));
3955 if (err) { 3943 if (err) {
3956 printk(KERN_ERR 3944 printk(KERN_ERR
3957 "ME4000:me4000_ai_ex_trig_setup():Can't copy from user space\n"); 3945 "ME4000:me4000_ai_ex_trig_setup():Can't copy from user space\n");
@@ -4000,16 +3988,16 @@ static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t * arg,
4000 return 0; 3988 return 0;
4001} 3989}
4002 3990
4003static int me4000_ai_sc_setup(me4000_ai_sc_t * arg, 3991static int me4000_ai_sc_setup(struct me4000_ai_sc *arg,
4004 me4000_ai_context_t * ai_context) 3992 struct me4000_ai_context *ai_context)
4005{ 3993{
4006 me4000_ai_sc_t cmd; 3994 struct me4000_ai_sc cmd;
4007 int err; 3995 int err;
4008 3996
4009 CALL_PDEBUG("me4000_ai_sc_setup() is executed\n"); 3997 CALL_PDEBUG("me4000_ai_sc_setup() is executed\n");
4010 3998
4011 /* Copy data from user */ 3999 /* Copy data from user */
4012 err = copy_from_user(&cmd, arg, sizeof(me4000_ai_sc_t)); 4000 err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_sc));
4013 if (err) { 4001 if (err) {
4014 printk(KERN_ERR 4002 printk(KERN_ERR
4015 "ME4000:me4000_ai_sc_setup():Can't copy from user space\n"); 4003 "ME4000:me4000_ai_sc_setup():Can't copy from user space\n");
@@ -4023,9 +4011,9 @@ static int me4000_ai_sc_setup(me4000_ai_sc_t * arg,
4023} 4011}
4024 4012
4025static ssize_t me4000_ai_read(struct file *filep, char *buff, size_t cnt, 4013static ssize_t me4000_ai_read(struct file *filep, char *buff, size_t cnt,
4026 loff_t * offp) 4014 loff_t *offp)
4027{ 4015{
4028 me4000_ai_context_t *ai_context = filep->private_data; 4016 struct me4000_ai_context *ai_context = filep->private_data;
4029 s16 *buffer = (s16 *) buff; 4017 s16 *buffer = (s16 *) buff;
4030 size_t count = cnt / 2; 4018 size_t count = cnt / 2;
4031 unsigned long flags; 4019 unsigned long flags;
@@ -4150,9 +4138,9 @@ static ssize_t me4000_ai_read(struct file *filep, char *buff, size_t cnt,
4150 return ret * 2; 4138 return ret * 2;
4151} 4139}
4152 4140
4153static unsigned int me4000_ai_poll(struct file *file_p, poll_table * wait) 4141static unsigned int me4000_ai_poll(struct file *file_p, poll_table *wait)
4154{ 4142{
4155 me4000_ai_context_t *ai_context; 4143 struct me4000_ai_context *ai_context;
4156 unsigned long mask = 0; 4144 unsigned long mask = 0;
4157 4145
4158 CALL_PDEBUG("me4000_ai_poll() is executed\n"); 4146 CALL_PDEBUG("me4000_ai_poll() is executed\n");
@@ -4171,7 +4159,7 @@ static unsigned int me4000_ai_poll(struct file *file_p, poll_table * wait)
4171 return mask; 4159 return mask;
4172} 4160}
4173 4161
4174static int me4000_ai_offset_enable(me4000_ai_context_t * ai_context) 4162static int me4000_ai_offset_enable(struct me4000_ai_context *ai_context)
4175{ 4163{
4176 unsigned long tmp; 4164 unsigned long tmp;
4177 4165
@@ -4184,7 +4172,7 @@ static int me4000_ai_offset_enable(me4000_ai_context_t * ai_context)
4184 return 0; 4172 return 0;
4185} 4173}
4186 4174
4187static int me4000_ai_offset_disable(me4000_ai_context_t * ai_context) 4175static int me4000_ai_offset_disable(struct me4000_ai_context *ai_context)
4188{ 4176{
4189 unsigned long tmp; 4177 unsigned long tmp;
4190 4178
@@ -4197,7 +4185,7 @@ static int me4000_ai_offset_disable(me4000_ai_context_t * ai_context)
4197 return 0; 4185 return 0;
4198} 4186}
4199 4187
4200static int me4000_ai_fullscale_enable(me4000_ai_context_t * ai_context) 4188static int me4000_ai_fullscale_enable(struct me4000_ai_context *ai_context)
4201{ 4189{
4202 unsigned long tmp; 4190 unsigned long tmp;
4203 4191
@@ -4210,7 +4198,7 @@ static int me4000_ai_fullscale_enable(me4000_ai_context_t * ai_context)
4210 return 0; 4198 return 0;
4211} 4199}
4212 4200
4213static int me4000_ai_fullscale_disable(me4000_ai_context_t * ai_context) 4201static int me4000_ai_fullscale_disable(struct me4000_ai_context *ai_context)
4214{ 4202{
4215 unsigned long tmp; 4203 unsigned long tmp;
4216 4204
@@ -4223,7 +4211,7 @@ static int me4000_ai_fullscale_disable(me4000_ai_context_t * ai_context)
4223 return 0; 4211 return 0;
4224} 4212}
4225 4213
4226static int me4000_ai_fsm_state(int *arg, me4000_ai_context_t * ai_context) 4214static int me4000_ai_fsm_state(int *arg, struct me4000_ai_context *ai_context)
4227{ 4215{
4228 unsigned long tmp; 4216 unsigned long tmp;
4229 4217
@@ -4242,7 +4230,7 @@ static int me4000_ai_fsm_state(int *arg, me4000_ai_context_t * ai_context)
4242} 4230}
4243 4231
4244static int me4000_ai_get_count_buffer(unsigned long *arg, 4232static int me4000_ai_get_count_buffer(unsigned long *arg,
4245 me4000_ai_context_t * ai_context) 4233 struct me4000_ai_context *ai_context)
4246{ 4234{
4247 unsigned long c; 4235 unsigned long c;
4248 int err; 4236 int err;
@@ -4252,7 +4240,7 @@ static int me4000_ai_get_count_buffer(unsigned long *arg,
4252 err = copy_to_user(arg, &c, sizeof(unsigned long)); 4240 err = copy_to_user(arg, &c, sizeof(unsigned long));
4253 if (err) { 4241 if (err) {
4254 printk(KERN_ERR 4242 printk(KERN_ERR
4255 "ME4000:me4000_ai_get_count_buffer():Can't copy to user space\n"); 4243 "%s:Can't copy to user space\n", __func__);
4256 return -EFAULT; 4244 return -EFAULT;
4257 } 4245 }
4258 4246
@@ -4261,7 +4249,7 @@ static int me4000_ai_get_count_buffer(unsigned long *arg,
4261 4249
4262/*---------------------------------- EEPROM stuff ---------------------------*/ 4250/*---------------------------------- EEPROM stuff ---------------------------*/
4263 4251
4264static int eeprom_write_cmd(me4000_ai_context_t * ai_context, unsigned long cmd, 4252static int eeprom_write_cmd(struct me4000_ai_context *ai_context, unsigned long cmd,
4265 int length) 4253 int length)
4266{ 4254{
4267 int i; 4255 int i;
@@ -4318,7 +4306,7 @@ static int eeprom_write_cmd(me4000_ai_context_t * ai_context, unsigned long cmd,
4318 return 0; 4306 return 0;
4319} 4307}
4320 4308
4321static unsigned short eeprom_read_cmd(me4000_ai_context_t * ai_context, 4309static unsigned short eeprom_read_cmd(struct me4000_ai_context *ai_context,
4322 unsigned long cmd, int length) 4310 unsigned long cmd, int length)
4323{ 4311{
4324 int i; 4312 int i;
@@ -4397,11 +4385,11 @@ static unsigned short eeprom_read_cmd(me4000_ai_context_t * ai_context,
4397 return id; 4385 return id;
4398} 4386}
4399 4387
4400static int me4000_eeprom_write(me4000_eeprom_t * arg, 4388static int me4000_eeprom_write(struct me4000_eeprom *arg,
4401 me4000_ai_context_t * ai_context) 4389 struct me4000_ai_context *ai_context)
4402{ 4390{
4403 int err; 4391 int err;
4404 me4000_eeprom_t setup; 4392 struct me4000_eeprom setup;
4405 unsigned long cmd; 4393 unsigned long cmd;
4406 unsigned long date_high; 4394 unsigned long date_high;
4407 unsigned long date_low; 4395 unsigned long date_low;
@@ -4594,12 +4582,12 @@ static int me4000_eeprom_write(me4000_eeprom_t * arg,
4594 return 0; 4582 return 0;
4595} 4583}
4596 4584
4597static int me4000_eeprom_read(me4000_eeprom_t * arg, 4585static int me4000_eeprom_read(struct me4000_eeprom *arg,
4598 me4000_ai_context_t * ai_context) 4586 struct me4000_ai_context *ai_context)
4599{ 4587{
4600 int err; 4588 int err;
4601 unsigned long cmd; 4589 unsigned long cmd;
4602 me4000_eeprom_t setup; 4590 struct me4000_eeprom setup;
4603 4591
4604 CALL_PDEBUG("me4000_eeprom_read() is executed\n"); 4592 CALL_PDEBUG("me4000_eeprom_read() is executed\n");
4605 4593
@@ -4687,7 +4675,7 @@ static int me4000_eeprom_read(me4000_eeprom_t * arg,
4687static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p, 4675static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p,
4688 unsigned int service, unsigned long arg) 4676 unsigned int service, unsigned long arg)
4689{ 4677{
4690 me4000_dio_context_t *dio_context; 4678 struct me4000_dio_context *dio_context;
4691 4679
4692 CALL_PDEBUG("me4000_dio_ioctl() is executed\n"); 4680 CALL_PDEBUG("me4000_dio_ioctl() is executed\n");
4693 4681
@@ -4704,13 +4692,13 @@ static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p,
4704 4692
4705 switch (service) { 4693 switch (service) {
4706 case ME4000_DIO_CONFIG: 4694 case ME4000_DIO_CONFIG:
4707 return me4000_dio_config((me4000_dio_config_t *) arg, 4695 return me4000_dio_config((struct me4000_dio_config *)arg,
4708 dio_context); 4696 dio_context);
4709 case ME4000_DIO_SET_BYTE: 4697 case ME4000_DIO_SET_BYTE:
4710 return me4000_dio_set_byte((me4000_dio_byte_t *) arg, 4698 return me4000_dio_set_byte((struct me4000_dio_byte *)arg,
4711 dio_context); 4699 dio_context);
4712 case ME4000_DIO_GET_BYTE: 4700 case ME4000_DIO_GET_BYTE:
4713 return me4000_dio_get_byte((me4000_dio_byte_t *) arg, 4701 return me4000_dio_get_byte((struct me4000_dio_byte *)arg,
4714 dio_context); 4702 dio_context);
4715 case ME4000_DIO_RESET: 4703 case ME4000_DIO_RESET:
4716 return me4000_dio_reset(dio_context); 4704 return me4000_dio_reset(dio_context);
@@ -4723,17 +4711,17 @@ static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p,
4723 return 0; 4711 return 0;
4724} 4712}
4725 4713
4726static int me4000_dio_config(me4000_dio_config_t * arg, 4714static int me4000_dio_config(struct me4000_dio_config *arg,
4727 me4000_dio_context_t * dio_context) 4715 struct me4000_dio_context *dio_context)
4728{ 4716{
4729 me4000_dio_config_t cmd; 4717 struct me4000_dio_config cmd;
4730 u32 tmp; 4718 u32 tmp;
4731 int err; 4719 int err;
4732 4720
4733 CALL_PDEBUG("me4000_dio_config() is executed\n"); 4721 CALL_PDEBUG("me4000_dio_config() is executed\n");
4734 4722
4735 /* Copy data from user */ 4723 /* Copy data from user */
4736 err = copy_from_user(&cmd, arg, sizeof(me4000_dio_config_t)); 4724 err = copy_from_user(&cmd, arg, sizeof(struct me4000_dio_config));
4737 if (err) { 4725 if (err) {
4738 printk(KERN_ERR 4726 printk(KERN_ERR
4739 "ME4000:me4000_dio_config():Can't copy from user space\n"); 4727 "ME4000:me4000_dio_config():Can't copy from user space\n");
@@ -4964,16 +4952,16 @@ static int me4000_dio_config(me4000_dio_config_t * arg,
4964 return 0; 4952 return 0;
4965} 4953}
4966 4954
4967static int me4000_dio_set_byte(me4000_dio_byte_t * arg, 4955static int me4000_dio_set_byte(struct me4000_dio_byte *arg,
4968 me4000_dio_context_t * dio_context) 4956 struct me4000_dio_context *dio_context)
4969{ 4957{
4970 me4000_dio_byte_t cmd; 4958 struct me4000_dio_byte cmd;
4971 int err; 4959 int err;
4972 4960
4973 CALL_PDEBUG("me4000_dio_set_byte() is executed\n"); 4961 CALL_PDEBUG("me4000_dio_set_byte() is executed\n");
4974 4962
4975 /* Copy data from user */ 4963 /* Copy data from user */
4976 err = copy_from_user(&cmd, arg, sizeof(me4000_dio_byte_t)); 4964 err = copy_from_user(&cmd, arg, sizeof(struct me4000_dio_byte));
4977 if (err) { 4965 if (err) {
4978 printk(KERN_ERR 4966 printk(KERN_ERR
4979 "ME4000:me4000_dio_set_byte():Can't copy from user space\n"); 4967 "ME4000:me4000_dio_set_byte():Can't copy from user space\n");
@@ -5030,16 +5018,16 @@ static int me4000_dio_set_byte(me4000_dio_byte_t * arg,
5030 return 0; 5018 return 0;
5031} 5019}
5032 5020
5033static int me4000_dio_get_byte(me4000_dio_byte_t * arg, 5021static int me4000_dio_get_byte(struct me4000_dio_byte *arg,
5034 me4000_dio_context_t * dio_context) 5022 struct me4000_dio_context *dio_context)
5035{ 5023{
5036 me4000_dio_byte_t cmd; 5024 struct me4000_dio_byte cmd;
5037 int err; 5025 int err;
5038 5026
5039 CALL_PDEBUG("me4000_dio_get_byte() is executed\n"); 5027 CALL_PDEBUG("me4000_dio_get_byte() is executed\n");
5040 5028
5041 /* Copy data from user */ 5029 /* Copy data from user */
5042 err = copy_from_user(&cmd, arg, sizeof(me4000_dio_byte_t)); 5030 err = copy_from_user(&cmd, arg, sizeof(struct me4000_dio_byte));
5043 if (err) { 5031 if (err) {
5044 printk(KERN_ERR 5032 printk(KERN_ERR
5045 "ME4000:me4000_dio_get_byte():Can't copy from user space\n"); 5033 "ME4000:me4000_dio_get_byte():Can't copy from user space\n");
@@ -5070,7 +5058,7 @@ static int me4000_dio_get_byte(me4000_dio_byte_t * arg,
5070 } 5058 }
5071 5059
5072 /* Copy result back to user */ 5060 /* Copy result back to user */
5073 err = copy_to_user(arg, &cmd, sizeof(me4000_dio_byte_t)); 5061 err = copy_to_user(arg, &cmd, sizeof(struct me4000_dio_byte));
5074 if (err) { 5062 if (err) {
5075 printk(KERN_ERR 5063 printk(KERN_ERR
5076 "ME4000:me4000_dio_get_byte():Can't copy to user space\n"); 5064 "ME4000:me4000_dio_get_byte():Can't copy to user space\n");
@@ -5080,7 +5068,7 @@ static int me4000_dio_get_byte(me4000_dio_byte_t * arg,
5080 return 0; 5068 return 0;
5081} 5069}
5082 5070
5083static int me4000_dio_reset(me4000_dio_context_t * dio_context) 5071static int me4000_dio_reset(struct me4000_dio_context *dio_context)
5084{ 5072{
5085 CALL_PDEBUG("me4000_dio_reset() is executed\n"); 5073 CALL_PDEBUG("me4000_dio_reset() is executed\n");
5086 5074
@@ -5101,7 +5089,7 @@ static int me4000_dio_reset(me4000_dio_context_t * dio_context)
5101static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p, 5089static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p,
5102 unsigned int service, unsigned long arg) 5090 unsigned int service, unsigned long arg)
5103{ 5091{
5104 me4000_cnt_context_t *cnt_context; 5092 struct me4000_cnt_context *cnt_context;
5105 5093
5106 CALL_PDEBUG("me4000_cnt_ioctl() is executed\n"); 5094 CALL_PDEBUG("me4000_cnt_ioctl() is executed\n");
5107 5095
@@ -5118,11 +5106,11 @@ static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p,
5118 5106
5119 switch (service) { 5107 switch (service) {
5120 case ME4000_CNT_READ: 5108 case ME4000_CNT_READ:
5121 return me4000_cnt_read((me4000_cnt_t *) arg, cnt_context); 5109 return me4000_cnt_read((struct me4000_cnt *)arg, cnt_context);
5122 case ME4000_CNT_WRITE: 5110 case ME4000_CNT_WRITE:
5123 return me4000_cnt_write((me4000_cnt_t *) arg, cnt_context); 5111 return me4000_cnt_write((struct me4000_cnt *)arg, cnt_context);
5124 case ME4000_CNT_CONFIG: 5112 case ME4000_CNT_CONFIG:
5125 return me4000_cnt_config((me4000_cnt_config_t *) arg, 5113 return me4000_cnt_config((struct me4000_cnt_config *)arg,
5126 cnt_context); 5114 cnt_context);
5127 case ME4000_CNT_RESET: 5115 case ME4000_CNT_RESET:
5128 return me4000_cnt_reset(cnt_context); 5116 return me4000_cnt_reset(cnt_context);
@@ -5135,10 +5123,10 @@ static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p,
5135 return 0; 5123 return 0;
5136} 5124}
5137 5125
5138static int me4000_cnt_config(me4000_cnt_config_t * arg, 5126static int me4000_cnt_config(struct me4000_cnt_config *arg,
5139 me4000_cnt_context_t * cnt_context) 5127 struct me4000_cnt_context *cnt_context)
5140{ 5128{
5141 me4000_cnt_config_t cmd; 5129 struct me4000_cnt_config cmd;
5142 u8 counter; 5130 u8 counter;
5143 u8 mode; 5131 u8 mode;
5144 int err; 5132 int err;
@@ -5146,7 +5134,7 @@ static int me4000_cnt_config(me4000_cnt_config_t * arg,
5146 CALL_PDEBUG("me4000_cnt_config() is executed\n"); 5134 CALL_PDEBUG("me4000_cnt_config() is executed\n");
5147 5135
5148 /* Copy data from user */ 5136 /* Copy data from user */
5149 err = copy_from_user(&cmd, arg, sizeof(me4000_cnt_config_t)); 5137 err = copy_from_user(&cmd, arg, sizeof(struct me4000_cnt_config));
5150 if (err) { 5138 if (err) {
5151 printk(KERN_ERR 5139 printk(KERN_ERR
5152 "ME4000:me4000_cnt_config():Can't copy from user space\n"); 5140 "ME4000:me4000_cnt_config():Can't copy from user space\n");
@@ -5204,17 +5192,17 @@ static int me4000_cnt_config(me4000_cnt_config_t * arg,
5204 return 0; 5192 return 0;
5205} 5193}
5206 5194
5207static int me4000_cnt_read(me4000_cnt_t * arg, 5195static int me4000_cnt_read(struct me4000_cnt *arg,
5208 me4000_cnt_context_t * cnt_context) 5196 struct me4000_cnt_context *cnt_context)
5209{ 5197{
5210 me4000_cnt_t cmd; 5198 struct me4000_cnt cmd;
5211 u8 tmp; 5199 u8 tmp;
5212 int err; 5200 int err;
5213 5201
5214 CALL_PDEBUG("me4000_cnt_read() is executed\n"); 5202 CALL_PDEBUG("me4000_cnt_read() is executed\n");
5215 5203
5216 /* Copy data from user */ 5204 /* Copy data from user */
5217 err = copy_from_user(&cmd, arg, sizeof(me4000_cnt_t)); 5205 err = copy_from_user(&cmd, arg, sizeof(struct me4000_cnt));
5218 if (err) { 5206 if (err) {
5219 printk(KERN_ERR 5207 printk(KERN_ERR
5220 "ME4000:me4000_cnt_read():Can't copy from user space\n"); 5208 "ME4000:me4000_cnt_read():Can't copy from user space\n");
@@ -5249,7 +5237,7 @@ static int me4000_cnt_read(me4000_cnt_t * arg,
5249 } 5237 }
5250 5238
5251 /* Copy result back to user */ 5239 /* Copy result back to user */
5252 err = copy_to_user(arg, &cmd, sizeof(me4000_cnt_t)); 5240 err = copy_to_user(arg, &cmd, sizeof(struct me4000_cnt));
5253 if (err) { 5241 if (err) {
5254 printk(KERN_ERR 5242 printk(KERN_ERR
5255 "ME4000:me4000_cnt_read():Can't copy to user space\n"); 5243 "ME4000:me4000_cnt_read():Can't copy to user space\n");
@@ -5259,17 +5247,17 @@ static int me4000_cnt_read(me4000_cnt_t * arg,
5259 return 0; 5247 return 0;
5260} 5248}
5261 5249
5262static int me4000_cnt_write(me4000_cnt_t * arg, 5250static int me4000_cnt_write(struct me4000_cnt *arg,
5263 me4000_cnt_context_t * cnt_context) 5251 struct me4000_cnt_context *cnt_context)
5264{ 5252{
5265 me4000_cnt_t cmd; 5253 struct me4000_cnt cmd;
5266 u8 tmp; 5254 u8 tmp;
5267 int err; 5255 int err;
5268 5256
5269 CALL_PDEBUG("me4000_cnt_write() is executed\n"); 5257 CALL_PDEBUG("me4000_cnt_write() is executed\n");
5270 5258
5271 /* Copy data from user */ 5259 /* Copy data from user */
5272 err = copy_from_user(&cmd, arg, sizeof(me4000_cnt_t)); 5260 err = copy_from_user(&cmd, arg, sizeof(struct me4000_cnt));
5273 if (err) { 5261 if (err) {
5274 printk(KERN_ERR 5262 printk(KERN_ERR
5275 "ME4000:me4000_cnt_write():Can't copy from user space\n"); 5263 "ME4000:me4000_cnt_write():Can't copy from user space\n");
@@ -5306,7 +5294,7 @@ static int me4000_cnt_write(me4000_cnt_t * arg,
5306 return 0; 5294 return 0;
5307} 5295}
5308 5296
5309static int me4000_cnt_reset(me4000_cnt_context_t * cnt_context) 5297static int me4000_cnt_reset(struct me4000_cnt_context *cnt_context)
5310{ 5298{
5311 CALL_PDEBUG("me4000_cnt_reset() is executed\n"); 5299 CALL_PDEBUG("me4000_cnt_reset() is executed\n");
5312 5300
@@ -5333,7 +5321,7 @@ static int me4000_cnt_reset(me4000_cnt_context_t * cnt_context)
5333static int me4000_ext_int_ioctl(struct inode *inode_p, struct file *file_p, 5321static int me4000_ext_int_ioctl(struct inode *inode_p, struct file *file_p,
5334 unsigned int service, unsigned long arg) 5322 unsigned int service, unsigned long arg)
5335{ 5323{
5336 me4000_ext_int_context_t *ext_int_context; 5324 struct me4000_ext_int_context *ext_int_context;
5337 5325
5338 CALL_PDEBUG("me4000_ext_int_ioctl() is executed\n"); 5326 CALL_PDEBUG("me4000_ext_int_ioctl() is executed\n");
5339 5327
@@ -5366,7 +5354,7 @@ static int me4000_ext_int_ioctl(struct inode *inode_p, struct file *file_p,
5366 return 0; 5354 return 0;
5367} 5355}
5368 5356
5369static int me4000_ext_int_enable(me4000_ext_int_context_t * ext_int_context) 5357static int me4000_ext_int_enable(struct me4000_ext_int_context *ext_int_context)
5370{ 5358{
5371 unsigned long tmp; 5359 unsigned long tmp;
5372 5360
@@ -5379,7 +5367,7 @@ static int me4000_ext_int_enable(me4000_ext_int_context_t * ext_int_context)
5379 return 0; 5367 return 0;
5380} 5368}
5381 5369
5382static int me4000_ext_int_disable(me4000_ext_int_context_t * ext_int_context) 5370static int me4000_ext_int_disable(struct me4000_ext_int_context *ext_int_context)
5383{ 5371{
5384 unsigned long tmp; 5372 unsigned long tmp;
5385 5373
@@ -5393,7 +5381,7 @@ static int me4000_ext_int_disable(me4000_ext_int_context_t * ext_int_context)
5393} 5381}
5394 5382
5395static int me4000_ext_int_count(unsigned long *arg, 5383static int me4000_ext_int_count(unsigned long *arg,
5396 me4000_ext_int_context_t * ext_int_context) 5384 struct me4000_ext_int_context *ext_int_context)
5397{ 5385{
5398 5386
5399 CALL_PDEBUG("me4000_ext_int_count() is executed\n"); 5387 CALL_PDEBUG("me4000_ext_int_count() is executed\n");
@@ -5404,10 +5392,10 @@ static int me4000_ext_int_count(unsigned long *arg,
5404 5392
5405/*------------------------------------ General stuff ------------------------------------*/ 5393/*------------------------------------ General stuff ------------------------------------*/
5406 5394
5407static int me4000_get_user_info(me4000_user_info_t * arg, 5395static int me4000_get_user_info(struct me4000_user_info *arg,
5408 me4000_info_t * board_info) 5396 struct me4000_info *board_info)
5409{ 5397{
5410 me4000_user_info_t user_info; 5398 struct me4000_user_info user_info;
5411 5399
5412 CALL_PDEBUG("me4000_get_user_info() is executed\n"); 5400 CALL_PDEBUG("me4000_get_user_info() is executed\n");
5413 5401
@@ -5437,7 +5425,7 @@ static int me4000_get_user_info(me4000_user_info_t * arg,
5437 5425
5438 user_info.cnt_count = board_info->board_p->cnt.count; 5426 user_info.cnt_count = board_info->board_p->cnt.count;
5439 5427
5440 if (copy_to_user(arg, &user_info, sizeof(me4000_user_info_t))) 5428 if (copy_to_user(arg, &user_info, sizeof(struct me4000_user_info)))
5441 return -EFAULT; 5429 return -EFAULT;
5442 5430
5443 return 0; 5431 return 0;
@@ -5448,7 +5436,7 @@ static int me4000_get_user_info(me4000_user_info_t * arg,
5448static int me4000_ext_int_fasync(int fd, struct file *file_ptr, int mode) 5436static int me4000_ext_int_fasync(int fd, struct file *file_ptr, int mode)
5449{ 5437{
5450 int result = 0; 5438 int result = 0;
5451 me4000_ext_int_context_t *ext_int_context; 5439 struct me4000_ext_int_context *ext_int_context;
5452 5440
5453 CALL_PDEBUG("me4000_ext_int_fasync() is executed\n"); 5441 CALL_PDEBUG("me4000_ext_int_fasync() is executed\n");
5454 5442
@@ -5465,7 +5453,7 @@ static irqreturn_t me4000_ao_isr(int irq, void *dev_id)
5465{ 5453{
5466 u32 tmp; 5454 u32 tmp;
5467 u32 value; 5455 u32 value;
5468 me4000_ao_context_t *ao_context; 5456 struct me4000_ao_context *ao_context;
5469 int i; 5457 int i;
5470 int c = 0; 5458 int c = 0;
5471 int c1 = 0; 5459 int c1 = 0;
@@ -5589,7 +5577,7 @@ static irqreturn_t me4000_ao_isr(int irq, void *dev_id)
5589static irqreturn_t me4000_ai_isr(int irq, void *dev_id) 5577static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
5590{ 5578{
5591 u32 tmp; 5579 u32 tmp;
5592 me4000_ai_context_t *ai_context; 5580 struct me4000_ai_context *ai_context;
5593 int i; 5581 int i;
5594 int c = 0; 5582 int c = 0;
5595 int c1 = 0; 5583 int c1 = 0;
@@ -5933,7 +5921,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
5933 5921
5934static irqreturn_t me4000_ext_int_isr(int irq, void *dev_id) 5922static irqreturn_t me4000_ext_int_isr(int irq, void *dev_id)
5935{ 5923{
5936 me4000_ext_int_context_t *ext_int_context; 5924 struct me4000_ext_int_context *ext_int_context;
5937 unsigned long tmp; 5925 unsigned long tmp;
5938 5926
5939 ISR_PDEBUG("me4000_ext_int_isr() is executed\n"); 5927 ISR_PDEBUG("me4000_ext_int_isr() is executed\n");
@@ -5969,10 +5957,10 @@ static irqreturn_t me4000_ext_int_isr(int irq, void *dev_id)
5969 return IRQ_HANDLED; 5957 return IRQ_HANDLED;
5970} 5958}
5971 5959
5972void __exit me4000_module_exit(void) 5960static void __exit me4000_module_exit(void)
5973{ 5961{
5974 struct list_head *board_p; 5962 struct list_head *board_p;
5975 me4000_info_t *board_info; 5963 struct me4000_info *board_info;
5976 5964
5977 CALL_PDEBUG("cleanup_module() is executed\n"); 5965 CALL_PDEBUG("cleanup_module() is executed\n");
5978 5966
@@ -5993,7 +5981,7 @@ void __exit me4000_module_exit(void)
5993 /* Reset the boards */ 5981 /* Reset the boards */
5994 for (board_p = me4000_board_info_list.next; 5982 for (board_p = me4000_board_info_list.next;
5995 board_p != &me4000_board_info_list; board_p = board_p->next) { 5983 board_p != &me4000_board_info_list; board_p = board_p->next) {
5996 board_info = list_entry(board_p, me4000_info_t, list); 5984 board_info = list_entry(board_p, struct me4000_info, list);
5997 me4000_reset_board(board_info); 5985 me4000_reset_board(board_info);
5998 } 5986 }
5999 5987
@@ -6007,7 +5995,7 @@ static int me4000_read_procmem(char *buf, char **start, off_t offset, int count,
6007{ 5995{
6008 int len = 0; 5996 int len = 0;
6009 int limit = count - 1000; 5997 int limit = count - 1000;
6010 me4000_info_t *board_info; 5998 struct me4000_info *board_info;
6011 struct list_head *ptr; 5999 struct list_head *ptr;
6012 6000
6013 len += sprintf(buf + len, "\nME4000 DRIVER VERSION %X.%X.%X\n\n", 6001 len += sprintf(buf + len, "\nME4000 DRIVER VERSION %X.%X.%X\n\n",
@@ -6019,7 +6007,7 @@ static int me4000_read_procmem(char *buf, char **start, off_t offset, int count,
6019 for (ptr = me4000_board_info_list.next; 6007 for (ptr = me4000_board_info_list.next;
6020 (ptr != &me4000_board_info_list) && (len < limit); 6008 (ptr != &me4000_board_info_list) && (len < limit);
6021 ptr = ptr->next) { 6009 ptr = ptr->next) {
6022 board_info = list_entry(ptr, me4000_info_t, list); 6010 board_info = list_entry(ptr, struct me4000_info, list);
6023 6011
6024 len += 6012 len +=
6025 sprintf(buf + len, "Board number %d:\n", 6013 sprintf(buf + len, "Board number %d:\n",
diff --git a/drivers/staging/me4000/me4000.h b/drivers/staging/me4000/me4000.h
index c35e4b9793a0..81c6f4d5e25c 100644
--- a/drivers/staging/me4000/me4000.h
+++ b/drivers/staging/me4000/me4000.h
@@ -329,46 +329,46 @@
329 Circular buffer used for analog input/output reads/writes. 329 Circular buffer used for analog input/output reads/writes.
330 ===========================================================================*/ 330 ===========================================================================*/
331 331
332typedef struct me4000_circ_buf { 332struct me4000_circ_buf {
333 s16 *buf; 333 s16 *buf;
334 int volatile head; 334 int volatile head;
335 int volatile tail; 335 int volatile tail;
336} me4000_circ_buf_t; 336};
337 337
338/*============================================================================= 338/*=============================================================================
339 Information about the hardware capabilities 339 Information about the hardware capabilities
340 ===========================================================================*/ 340 ===========================================================================*/
341 341
342typedef struct me4000_ao_info { 342struct me4000_ao_info {
343 int count; 343 int count;
344 int fifo_count; 344 int fifo_count;
345} me4000_ao_info_t; 345};
346 346
347typedef struct me4000_ai_info { 347struct me4000_ai_info {
348 int count; 348 int count;
349 int sh_count; 349 int sh_count;
350 int diff_count; 350 int diff_count;
351 int ex_trig_analog; 351 int ex_trig_analog;
352} me4000_ai_info_t; 352};
353 353
354typedef struct me4000_dio_info { 354struct me4000_dio_info {
355 int count; 355 int count;
356} me4000_dio_info_t; 356};
357 357
358typedef struct me4000_cnt_info { 358struct me4000_cnt_info {
359 int count; 359 int count;
360} me4000_cnt_info_t; 360};
361 361
362typedef struct me4000_board { 362struct me4000_board {
363 u16 vendor_id; 363 u16 vendor_id;
364 u16 device_id; 364 u16 device_id;
365 me4000_ao_info_t ao; 365 struct me4000_ao_info ao;
366 me4000_ai_info_t ai; 366 struct me4000_ai_info ai;
367 me4000_dio_info_t dio; 367 struct me4000_dio_info dio;
368 me4000_cnt_info_t cnt; 368 struct me4000_cnt_info cnt;
369} me4000_board_t; 369};
370 370
371static me4000_board_t me4000_boards[] = { 371static struct me4000_board me4000_boards[] = {
372 {PCI_VENDOR_ID_MEILHAUS, 0x4610, {0, 0}, {16, 0, 0, 0}, {4}, {3}}, 372 {PCI_VENDOR_ID_MEILHAUS, 0x4610, {0, 0}, {16, 0, 0, 0}, {4}, {3}},
373 373
374 {PCI_VENDOR_ID_MEILHAUS, 0x4650, {0, 0}, {16, 0, 0, 0}, {4}, {0}}, 374 {PCI_VENDOR_ID_MEILHAUS, 0x4650, {0, 0}, {16, 0, 0, 0}, {4}, {0}},
@@ -391,8 +391,6 @@ static me4000_board_t me4000_boards[] = {
391 {0}, 391 {0},
392}; 392};
393 393
394#define ME4000_BOARD_VERSIONS (sizeof(me4000_boards) / sizeof(me4000_board_t) - 1)
395
396/*============================================================================= 394/*=============================================================================
397 PCI device table. 395 PCI device table.
398 This is used by modprobe to translate PCI IDs to drivers. 396 This is used by modprobe to translate PCI IDs to drivers.
@@ -427,19 +425,19 @@ MODULE_DEVICE_TABLE(pci, me4000_pci_table);
427 Global board and subdevice information structures 425 Global board and subdevice information structures
428 ===========================================================================*/ 426 ===========================================================================*/
429 427
430typedef struct me4000_info { 428struct me4000_info {
431 struct list_head list; // List of all detected boards 429 struct list_head list; // List of all detected boards
432 int board_count; // Index of the board after detection 430 int board_count; // Index of the board after detection
433 431
434 unsigned long plx_regbase; // PLX configuration space base address 432 unsigned long plx_regbase; // PLX configuration space base address
435 unsigned long me4000_regbase; // Base address of the ME4000 433 resource_size_t me4000_regbase; // Base address of the ME4000
436 unsigned long timer_regbase; // Base address of the timer circuit 434 resource_size_t timer_regbase; // Base address of the timer circuit
437 unsigned long program_regbase; // Base address to set the program pin for the xilinx 435 resource_size_t program_regbase; // Base address to set the program pin for the xilinx
438 436
439 unsigned long plx_regbase_size; // PLX register set space 437 unsigned long plx_regbase_size; // PLX register set space
440 unsigned long me4000_regbase_size; // ME4000 register set space 438 resource_size_t me4000_regbase_size; // ME4000 register set space
441 unsigned long timer_regbase_size; // Timer circuit register set space 439 resource_size_t timer_regbase_size; // Timer circuit register set space
442 unsigned long program_regbase_size; // Size of program base address of the ME4000 440 resource_size_t program_regbase_size; // Size of program base address of the ME4000
443 441
444 unsigned int serial_no; // Serial number of the board 442 unsigned int serial_no; // Serial number of the board
445 unsigned char hw_revision; // Hardware revision of the board 443 unsigned char hw_revision; // Hardware revision of the board
@@ -451,7 +449,7 @@ typedef struct me4000_info {
451 int pci_func_no; // PCI function number 449 int pci_func_no; // PCI function number
452 struct pci_dev *pci_dev_p; // General PCI information 450 struct pci_dev *pci_dev_p; // General PCI information
453 451
454 me4000_board_t *board_p; // Holds the board capabilities 452 struct me4000_board *board_p; // Holds the board capabilities
455 453
456 unsigned int irq; // IRQ assigned from the PCI BIOS 454 unsigned int irq; // IRQ assigned from the PCI BIOS
457 unsigned int irq_count; // Count of external interrupts 455 unsigned int irq_count; // Count of external interrupts
@@ -464,18 +462,18 @@ typedef struct me4000_info {
464 struct me4000_dio_context *dio_context; // Digital I/O specific context 462 struct me4000_dio_context *dio_context; // Digital I/O specific context
465 struct me4000_cnt_context *cnt_context; // Counter specific context 463 struct me4000_cnt_context *cnt_context; // Counter specific context
466 struct me4000_ext_int_context *ext_int_context; // External interrupt specific context 464 struct me4000_ext_int_context *ext_int_context; // External interrupt specific context
467} me4000_info_t; 465};
468 466
469typedef struct me4000_ao_context { 467struct me4000_ao_context {
470 struct list_head list; // linked list of me4000_ao_context_t 468 struct list_head list; // linked list of me4000_ao_context_t
471 int index; // Index in the list 469 int index; // Index in the list
472 int mode; // Indicates mode (0 = single, 1 = wraparound, 2 = continous) 470 int mode; // Indicates mode (0 = single, 1 = wraparound, 2 = continous)
473 int dac_in_use; // Indicates if already opend 471 int dac_in_use; // Indicates if already opend
474 spinlock_t use_lock; // Guards in_use 472 spinlock_t use_lock; // Guards in_use
475 spinlock_t int_lock; // Used when locking out interrupts 473 spinlock_t int_lock; // Used when locking out interrupts
476 me4000_circ_buf_t circ_buf; // Circular buffer 474 struct me4000_circ_buf circ_buf; // Circular buffer
477 wait_queue_head_t wait_queue; // Wait queue to sleep while blocking write 475 wait_queue_head_t wait_queue; // Wait queue to sleep while blocking write
478 me4000_info_t *board_info; 476 struct me4000_info *board_info;
479 unsigned int irq; // The irq associated with this ADC 477 unsigned int irq; // The irq associated with this ADC
480 int volatile pipe_flag; // Indicates broken pipe set from me4000_ao_isr() 478 int volatile pipe_flag; // Indicates broken pipe set from me4000_ao_isr()
481 unsigned long ctrl_reg; 479 unsigned long ctrl_reg;
@@ -486,9 +484,9 @@ typedef struct me4000_ao_context {
486 unsigned long irq_status_reg; 484 unsigned long irq_status_reg;
487 unsigned long preload_reg; 485 unsigned long preload_reg;
488 struct fasync_struct *fasync_p; // Queue for asynchronous notification 486 struct fasync_struct *fasync_p; // Queue for asynchronous notification
489} me4000_ao_context_t; 487};
490 488
491typedef struct me4000_ai_context { 489struct me4000_ai_context {
492 struct list_head list; // linked list of me4000_ai_info_t 490 struct list_head list; // linked list of me4000_ai_info_t
493 int mode; // Indicates mode 491 int mode; // Indicates mode
494 int in_use; // Indicates if already opend 492 int in_use; // Indicates if already opend
@@ -496,9 +494,9 @@ typedef struct me4000_ai_context {
496 spinlock_t int_lock; // Used when locking out interrupts 494 spinlock_t int_lock; // Used when locking out interrupts
497 int number; // Number of the DAC 495 int number; // Number of the DAC
498 unsigned int irq; // The irq associated with this ADC 496 unsigned int irq; // The irq associated with this ADC
499 me4000_circ_buf_t circ_buf; // Circular buffer 497 struct me4000_circ_buf circ_buf; // Circular buffer
500 wait_queue_head_t wait_queue; // Wait queue to sleep while blocking read 498 wait_queue_head_t wait_queue; // Wait queue to sleep while blocking read
501 me4000_info_t *board_info; 499 struct me4000_info *board_info;
502 500
503 struct fasync_struct *fasync_p; // Queue for asynchronous notification 501 struct fasync_struct *fasync_p; // Queue for asynchronous notification
504 502
@@ -523,48 +521,48 @@ typedef struct me4000_ai_context {
523 unsigned long channel_list_count; 521 unsigned long channel_list_count;
524 unsigned long sample_counter; 522 unsigned long sample_counter;
525 int sample_counter_reload; 523 int sample_counter_reload;
526} me4000_ai_context_t; 524};
527 525
528typedef struct me4000_dio_context { 526struct me4000_dio_context {
529 struct list_head list; // linked list of me4000_dio_context_t 527 struct list_head list; // linked list of me4000_dio_context_t
530 int in_use; // Indicates if already opend 528 int in_use; // Indicates if already opend
531 spinlock_t use_lock; // Guards in_use 529 spinlock_t use_lock; // Guards in_use
532 int number; 530 int number;
533 int dio_count; 531 int dio_count;
534 me4000_info_t *board_info; 532 struct me4000_info *board_info;
535 unsigned long dir_reg; 533 unsigned long dir_reg;
536 unsigned long ctrl_reg; 534 unsigned long ctrl_reg;
537 unsigned long port_0_reg; 535 unsigned long port_0_reg;
538 unsigned long port_1_reg; 536 unsigned long port_1_reg;
539 unsigned long port_2_reg; 537 unsigned long port_2_reg;
540 unsigned long port_3_reg; 538 unsigned long port_3_reg;
541} me4000_dio_context_t; 539};
542 540
543typedef struct me4000_cnt_context { 541struct me4000_cnt_context {
544 struct list_head list; // linked list of me4000_dio_context_t 542 struct list_head list; // linked list of me4000_dio_context_t
545 int in_use; // Indicates if already opend 543 int in_use; // Indicates if already opend
546 spinlock_t use_lock; // Guards in_use 544 spinlock_t use_lock; // Guards in_use
547 int number; 545 int number;
548 int cnt_count; 546 int cnt_count;
549 me4000_info_t *board_info; 547 struct me4000_info *board_info;
550 unsigned long ctrl_reg; 548 unsigned long ctrl_reg;
551 unsigned long counter_0_reg; 549 unsigned long counter_0_reg;
552 unsigned long counter_1_reg; 550 unsigned long counter_1_reg;
553 unsigned long counter_2_reg; 551 unsigned long counter_2_reg;
554} me4000_cnt_context_t; 552};
555 553
556typedef struct me4000_ext_int_context { 554struct me4000_ext_int_context {
557 struct list_head list; // linked list of me4000_dio_context_t 555 struct list_head list; // linked list of me4000_dio_context_t
558 int in_use; // Indicates if already opend 556 int in_use; // Indicates if already opend
559 spinlock_t use_lock; // Guards in_use 557 spinlock_t use_lock; // Guards in_use
560 int number; 558 int number;
561 me4000_info_t *board_info; 559 struct me4000_info *board_info;
562 unsigned int irq; 560 unsigned int irq;
563 unsigned long int_count; 561 unsigned long int_count;
564 struct fasync_struct *fasync_ptr; 562 struct fasync_struct *fasync_ptr;
565 unsigned long ctrl_reg; 563 unsigned long ctrl_reg;
566 unsigned long irq_status_reg; 564 unsigned long irq_status_reg;
567} me4000_ext_int_context_t; 565};
568 566
569#endif 567#endif
570 568
@@ -745,12 +743,12 @@ typedef struct me4000_ext_int_context {
745 General type definitions 743 General type definitions
746 ----------------------------------------------------------------------------*/ 744 ----------------------------------------------------------------------------*/
747 745
748typedef struct me4000_user_info { 746struct me4000_user_info {
749 int board_count; // Index of the board after detection 747 int board_count; // Index of the board after detection
750 unsigned long plx_regbase; // PLX configuration space base address 748 unsigned long plx_regbase; // PLX configuration space base address
751 unsigned long me4000_regbase; // Base address of the ME4000 749 resource_size_t me4000_regbase; // Base address of the ME4000
752 unsigned long plx_regbase_size; // PLX register set space 750 unsigned long plx_regbase_size; // PLX register set space
753 unsigned long me4000_regbase_size; // ME4000 register set space 751 resource_size_t me4000_regbase_size; // ME4000 register set space
754 unsigned long serial_no; // Serial number of the board 752 unsigned long serial_no; // Serial number of the board
755 unsigned char hw_revision; // Hardware revision of the board 753 unsigned char hw_revision; // Hardware revision of the board
756 unsigned short vendor_id; // Meilhaus vendor id (0x1402) 754 unsigned short vendor_id; // Meilhaus vendor id (0x1402)
@@ -773,62 +771,62 @@ typedef struct me4000_user_info {
773 int dio_count; // Count of digital I/O ports 771 int dio_count; // Count of digital I/O ports
774 772
775 int cnt_count; // Count of counters 773 int cnt_count; // Count of counters
776} me4000_user_info_t; 774};
777 775
778/*----------------------------------------------------------------------------- 776/*-----------------------------------------------------------------------------
779 Type definitions for analog output 777 Type definitions for analog output
780 ----------------------------------------------------------------------------*/ 778 ----------------------------------------------------------------------------*/
781 779
782typedef struct me4000_ao_channel_list { 780struct me4000_ao_channel_list {
783 unsigned long count; 781 unsigned long count;
784 unsigned long *list; 782 unsigned long *list;
785} me4000_ao_channel_list_t; 783};
786 784
787/*----------------------------------------------------------------------------- 785/*-----------------------------------------------------------------------------
788 Type definitions for analog input 786 Type definitions for analog input
789 ----------------------------------------------------------------------------*/ 787 ----------------------------------------------------------------------------*/
790 788
791typedef struct me4000_ai_channel_list { 789struct me4000_ai_channel_list {
792 unsigned long count; 790 unsigned long count;
793 unsigned long *list; 791 unsigned long *list;
794} me4000_ai_channel_list_t; 792};
795 793
796typedef struct me4000_ai_timer { 794struct me4000_ai_timer {
797 unsigned long pre_chan; 795 unsigned long pre_chan;
798 unsigned long chan; 796 unsigned long chan;
799 unsigned long scan_low; 797 unsigned long scan_low;
800 unsigned long scan_high; 798 unsigned long scan_high;
801} me4000_ai_timer_t; 799};
802 800
803typedef struct me4000_ai_config { 801struct me4000_ai_config {
804 me4000_ai_timer_t timer; 802 struct me4000_ai_timer timer;
805 me4000_ai_channel_list_t channel_list; 803 struct me4000_ai_channel_list channel_list;
806 int sh; 804 int sh;
807} me4000_ai_config_t; 805};
808 806
809typedef struct me4000_ai_single { 807struct me4000_ai_single {
810 int channel; 808 int channel;
811 int range; 809 int range;
812 int mode; 810 int mode;
813 short value; 811 short value;
814 unsigned long timeout; 812 unsigned long timeout;
815} me4000_ai_single_t; 813};
816 814
817typedef struct me4000_ai_trigger { 815struct me4000_ai_trigger {
818 int mode; 816 int mode;
819 int edge; 817 int edge;
820} me4000_ai_trigger_t; 818};
821 819
822typedef struct me4000_ai_sc { 820struct me4000_ai_sc {
823 unsigned long value; 821 unsigned long value;
824 int reload; 822 int reload;
825} me4000_ai_sc_t; 823};
826 824
827/*----------------------------------------------------------------------------- 825/*-----------------------------------------------------------------------------
828 Type definitions for eeprom 826 Type definitions for eeprom
829 ----------------------------------------------------------------------------*/ 827 ----------------------------------------------------------------------------*/
830 828
831typedef struct me4000_eeprom { 829struct me4000_eeprom {
832 unsigned long date; 830 unsigned long date;
833 short uni_10_offset; 831 short uni_10_offset;
834 short uni_10_fullscale; 832 short uni_10_fullscale;
@@ -842,45 +840,45 @@ typedef struct me4000_eeprom {
842 short diff_10_fullscale; 840 short diff_10_fullscale;
843 short diff_2_5_offset; 841 short diff_2_5_offset;
844 short diff_2_5_fullscale; 842 short diff_2_5_fullscale;
845} me4000_eeprom_t; 843};
846 844
847/*----------------------------------------------------------------------------- 845/*-----------------------------------------------------------------------------
848 Type definitions for digital I/O 846 Type definitions for digital I/O
849 ----------------------------------------------------------------------------*/ 847 ----------------------------------------------------------------------------*/
850 848
851typedef struct me4000_dio_config { 849struct me4000_dio_config {
852 int port; 850 int port;
853 int mode; 851 int mode;
854 int function; 852 int function;
855} me4000_dio_config_t; 853};
856 854
857typedef struct me4000_dio_byte { 855struct me4000_dio_byte {
858 int port; 856 int port;
859 unsigned char byte; 857 unsigned char byte;
860} me4000_dio_byte_t; 858};
861 859
862/*----------------------------------------------------------------------------- 860/*-----------------------------------------------------------------------------
863 Type definitions for counters 861 Type definitions for counters
864 ----------------------------------------------------------------------------*/ 862 ----------------------------------------------------------------------------*/
865 863
866typedef struct me4000_cnt { 864struct me4000_cnt {
867 int counter; 865 int counter;
868 unsigned short value; 866 unsigned short value;
869} me4000_cnt_t; 867};
870 868
871typedef struct me4000_cnt_config { 869struct me4000_cnt_config {
872 int counter; 870 int counter;
873 int mode; 871 int mode;
874} me4000_cnt_config_t; 872};
875 873
876/*----------------------------------------------------------------------------- 874/*-----------------------------------------------------------------------------
877 Type definitions for external interrupt 875 Type definitions for external interrupt
878 ----------------------------------------------------------------------------*/ 876 ----------------------------------------------------------------------------*/
879 877
880typedef struct { 878struct me4000_int {
881 int int1_count; 879 int int1_count;
882 int int2_count; 880 int int2_count;
883} me4000_int_type; 881};
884 882
885/*----------------------------------------------------------------------------- 883/*-----------------------------------------------------------------------------
886 The ioctls of the board 884 The ioctls of the board
@@ -888,7 +886,8 @@ typedef struct {
888 886
889#define ME4000_IOCTL_MAXNR 50 887#define ME4000_IOCTL_MAXNR 50
890#define ME4000_MAGIC 'y' 888#define ME4000_MAGIC 'y'
891#define ME4000_GET_USER_INFO _IOR (ME4000_MAGIC, 0, me4000_user_info_t) 889#define ME4000_GET_USER_INFO _IOR (ME4000_MAGIC, 0, \
890 struct me4000_user_info)
892 891
893#define ME4000_AO_START _IOW (ME4000_MAGIC, 1, unsigned long) 892#define ME4000_AO_START _IOW (ME4000_MAGIC, 1, unsigned long)
894#define ME4000_AO_STOP _IO (ME4000_MAGIC, 2) 893#define ME4000_AO_STOP _IO (ME4000_MAGIC, 2)
@@ -904,25 +903,35 @@ typedef struct {
904#define ME4000_AO_DISABLE_DO _IO (ME4000_MAGIC, 12) 903#define ME4000_AO_DISABLE_DO _IO (ME4000_MAGIC, 12)
905#define ME4000_AO_FSM_STATE _IOR (ME4000_MAGIC, 13, int) 904#define ME4000_AO_FSM_STATE _IOR (ME4000_MAGIC, 13, int)
906 905
907#define ME4000_AI_SINGLE _IOR (ME4000_MAGIC, 14, me4000_ai_single_t) 906#define ME4000_AI_SINGLE _IOR (ME4000_MAGIC, 14, \
907 struct me4000_ai_single)
908#define ME4000_AI_START _IOW (ME4000_MAGIC, 15, unsigned long) 908#define ME4000_AI_START _IOW (ME4000_MAGIC, 15, unsigned long)
909#define ME4000_AI_STOP _IO (ME4000_MAGIC, 16) 909#define ME4000_AI_STOP _IO (ME4000_MAGIC, 16)
910#define ME4000_AI_IMMEDIATE_STOP _IO (ME4000_MAGIC, 17) 910#define ME4000_AI_IMMEDIATE_STOP _IO (ME4000_MAGIC, 17)
911#define ME4000_AI_EX_TRIG_ENABLE _IO (ME4000_MAGIC, 18) 911#define ME4000_AI_EX_TRIG_ENABLE _IO (ME4000_MAGIC, 18)
912#define ME4000_AI_EX_TRIG_DISABLE _IO (ME4000_MAGIC, 19) 912#define ME4000_AI_EX_TRIG_DISABLE _IO (ME4000_MAGIC, 19)
913#define ME4000_AI_EX_TRIG_SETUP _IOW (ME4000_MAGIC, 20, me4000_ai_trigger_t) 913#define ME4000_AI_EX_TRIG_SETUP _IOW (ME4000_MAGIC, 20, \
914#define ME4000_AI_CONFIG _IOW (ME4000_MAGIC, 21, me4000_ai_config_t) 914 struct me4000_ai_trigger)
915#define ME4000_AI_SC_SETUP _IOW (ME4000_MAGIC, 22, me4000_ai_sc_t) 915#define ME4000_AI_CONFIG _IOW (ME4000_MAGIC, 21, \
916 struct me4000_ai_config)
917#define ME4000_AI_SC_SETUP _IOW (ME4000_MAGIC, 22, \
918 struct me4000_ai_sc)
916#define ME4000_AI_FSM_STATE _IOR (ME4000_MAGIC, 23, int) 919#define ME4000_AI_FSM_STATE _IOR (ME4000_MAGIC, 23, int)
917 920
918#define ME4000_DIO_CONFIG _IOW (ME4000_MAGIC, 24, me4000_dio_config_t) 921#define ME4000_DIO_CONFIG _IOW (ME4000_MAGIC, 24, \
919#define ME4000_DIO_GET_BYTE _IOR (ME4000_MAGIC, 25, me4000_dio_byte_t) 922 struct me4000_dio_config)
920#define ME4000_DIO_SET_BYTE _IOW (ME4000_MAGIC, 26, me4000_dio_byte_t) 923#define ME4000_DIO_GET_BYTE _IOR (ME4000_MAGIC, 25, \
924 struct me4000_dio_byte)
925#define ME4000_DIO_SET_BYTE _IOW (ME4000_MAGIC, 26, \
926 struct me4000_dio_byte)
921#define ME4000_DIO_RESET _IO (ME4000_MAGIC, 27) 927#define ME4000_DIO_RESET _IO (ME4000_MAGIC, 27)
922 928
923#define ME4000_CNT_READ _IOR (ME4000_MAGIC, 28, me4000_cnt_t) 929#define ME4000_CNT_READ _IOR (ME4000_MAGIC, 28, \
924#define ME4000_CNT_WRITE _IOW (ME4000_MAGIC, 29, me4000_cnt_t) 930 struct me4000_cnt)
925#define ME4000_CNT_CONFIG _IOW (ME4000_MAGIC, 30, me4000_cnt_config_t) 931#define ME4000_CNT_WRITE _IOW (ME4000_MAGIC, 29, \
932 struct me4000_cnt)
933#define ME4000_CNT_CONFIG _IOW (ME4000_MAGIC, 30, \
934 struct me4000_cnt_config)
926#define ME4000_CNT_RESET _IO (ME4000_MAGIC, 31) 935#define ME4000_CNT_RESET _IO (ME4000_MAGIC, 31)
927 936
928#define ME4000_EXT_INT_DISABLE _IO (ME4000_MAGIC, 32) 937#define ME4000_EXT_INT_DISABLE _IO (ME4000_MAGIC, 32)
@@ -934,13 +943,16 @@ typedef struct {
934#define ME4000_AI_FULLSCALE_ENABLE _IO (ME4000_MAGIC, 37) 943#define ME4000_AI_FULLSCALE_ENABLE _IO (ME4000_MAGIC, 37)
935#define ME4000_AI_FULLSCALE_DISABLE _IO (ME4000_MAGIC, 38) 944#define ME4000_AI_FULLSCALE_DISABLE _IO (ME4000_MAGIC, 38)
936 945
937#define ME4000_AI_EEPROM_READ _IOR (ME4000_MAGIC, 39, me4000_eeprom_t) 946#define ME4000_AI_EEPROM_READ _IOR (ME4000_MAGIC, 39, \
938#define ME4000_AI_EEPROM_WRITE _IOW (ME4000_MAGIC, 40, me4000_eeprom_t) 947 struct me4000_eeprom)
948#define ME4000_AI_EEPROM_WRITE _IOW (ME4000_MAGIC, 40, \
949 struct me4000_eeprom)
939 950
940#define ME4000_AO_SIMULTANEOUS_EX_TRIG _IO (ME4000_MAGIC, 41) 951#define ME4000_AO_SIMULTANEOUS_EX_TRIG _IO (ME4000_MAGIC, 41)
941#define ME4000_AO_SIMULTANEOUS_SW _IO (ME4000_MAGIC, 42) 952#define ME4000_AO_SIMULTANEOUS_SW _IO (ME4000_MAGIC, 42)
942#define ME4000_AO_SIMULTANEOUS_DISABLE _IO (ME4000_MAGIC, 43) 953#define ME4000_AO_SIMULTANEOUS_DISABLE _IO (ME4000_MAGIC, 43)
943#define ME4000_AO_SIMULTANEOUS_UPDATE _IOW (ME4000_MAGIC, 44, me4000_ao_channel_list_t) 954#define ME4000_AO_SIMULTANEOUS_UPDATE _IOW (ME4000_MAGIC, 44, \
955 struct me4000_ao_channel_list)
944 956
945#define ME4000_AO_SYNCHRONOUS_EX_TRIG _IO (ME4000_MAGIC, 45) 957#define ME4000_AO_SYNCHRONOUS_EX_TRIG _IO (ME4000_MAGIC, 45)
946#define ME4000_AO_SYNCHRONOUS_SW _IO (ME4000_MAGIC, 46) 958#define ME4000_AO_SYNCHRONOUS_SW _IO (ME4000_MAGIC, 46)