]>
Commit | Line | Data |
---|---|---|
d1d3cb32 DVC |
1 | /* |
2 | comedi/drivers/ni_daq_dio24.c | |
3 | Driver for National Instruments PCMCIA DAQ-Card DIO-24 | |
4 | Copyright (C) 2002 Daniel Vecino Castel <dvecino@able.es> | |
5 | ||
6 | PCMCIA crap at end of file is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13 | |
7 | from the pcmcia package. | |
8 | The initial developer of the pcmcia dummy_cs.c code is David A. Hinds | |
9 | <dahinds@users.sourceforge.net>. Portions created by David A. Hinds | |
10 | are Copyright (C) 1999 David A. Hinds. All Rights Reserved. | |
11 | ||
12 | This program is free software; you can redistribute it and/or modify | |
13 | it under the terms of the GNU General Public License as published by | |
14 | the Free Software Foundation; either version 2 of the License, or | |
15 | (at your option) any later version. | |
16 | ||
17 | This program is distributed in the hope that it will be useful, | |
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | GNU General Public License for more details. | |
21 | ||
22 | You should have received a copy of the GNU General Public License | |
23 | along with this program; if not, write to the Free Software | |
24 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 | ||
26 | ************************************************************************ | |
27 | */ | |
28 | /* | |
29 | Driver: ni_daq_dio24 | |
30 | Description: National Instruments PCMCIA DAQ-Card DIO-24 | |
31 | Author: Daniel Vecino Castel <dvecino@able.es> | |
32 | Devices: [National Instruments] PCMCIA DAQ-Card DIO-24 (ni_daq_dio24) | |
33 | Status: ? | |
34 | Updated: Thu, 07 Nov 2002 21:53:06 -0800 | |
35 | ||
36 | This is just a wrapper around the 8255.o driver to properly handle | |
37 | the PCMCIA interface. | |
38 | */ | |
39 | ||
0a85b6f0 | 40 | /* #define LABPC_DEBUG *//* enable debugging messages */ |
d1d3cb32 DVC |
41 | #undef LABPC_DEBUG |
42 | ||
25436dc9 | 43 | #include <linux/interrupt.h> |
5a0e3ad6 | 44 | #include <linux/slab.h> |
d1d3cb32 DVC |
45 | #include "../comedidev.h" |
46 | ||
47 | #include <linux/ioport.h> | |
d1d3cb32 DVC |
48 | |
49 | #include "8255.h" | |
50 | ||
51 | #include <pcmcia/cs_types.h> | |
52 | #include <pcmcia/cs.h> | |
53 | #include <pcmcia/cistpl.h> | |
54 | #include <pcmcia/cisreg.h> | |
55 | #include <pcmcia/ds.h> | |
56 | ||
57 | static struct pcmcia_device *pcmcia_cur_dev = NULL; | |
58 | ||
2696fb57 | 59 | #define DIO24_SIZE 4 /* size of io region used by board */ |
d1d3cb32 | 60 | |
da91b269 BP |
61 | static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it); |
62 | static int dio24_detach(struct comedi_device *dev); | |
d1d3cb32 DVC |
63 | |
64 | enum dio24_bustype { pcmcia_bustype }; | |
65 | ||
cf4c8d1b | 66 | struct dio24_board_struct { |
d1d3cb32 | 67 | const char *name; |
2696fb57 BP |
68 | int device_id; /* device id for pcmcia board */ |
69 | enum dio24_bustype bustype; /* PCMCIA */ | |
70 | int have_dio; /* have 8255 chip */ | |
71 | /* function pointers so we can use inb/outb or readb/writeb as appropriate */ | |
d1d3cb32 DVC |
72 | unsigned int (*read_byte) (unsigned int address); |
73 | void (*write_byte) (unsigned int byte, unsigned int address); | |
cf4c8d1b | 74 | }; |
d1d3cb32 | 75 | |
cf4c8d1b | 76 | static const struct dio24_board_struct dio24_boards[] = { |
d1d3cb32 | 77 | { |
0a85b6f0 MT |
78 | .name = "daqcard-dio24", |
79 | .device_id = 0x475c, /* 0x10b is manufacturer id, 0x475c is device id */ | |
80 | .bustype = pcmcia_bustype, | |
81 | .have_dio = 1, | |
82 | }, | |
d1d3cb32 | 83 | { |
0a85b6f0 MT |
84 | .name = "ni_daq_dio24", |
85 | .device_id = 0x475c, /* 0x10b is manufacturer id, 0x475c is device id */ | |
86 | .bustype = pcmcia_bustype, | |
87 | .have_dio = 1, | |
88 | }, | |
d1d3cb32 DVC |
89 | }; |
90 | ||
91 | /* | |
92 | * Useful for shorthand access to the particular board structure | |
93 | */ | |
cf4c8d1b | 94 | #define thisboard ((const struct dio24_board_struct *)dev->board_ptr) |
d1d3cb32 | 95 | |
344d23e9 BP |
96 | struct dio24_private { |
97 | ||
d1d3cb32 | 98 | int data; /* number of data points left to be taken */ |
344d23e9 BP |
99 | }; |
100 | ||
344d23e9 | 101 | #define devpriv ((struct dio24_private *)dev->private) |
d1d3cb32 | 102 | |
139dfbdf | 103 | static struct comedi_driver driver_dio24 = { |
68c3dbff BP |
104 | .driver_name = "ni_daq_dio24", |
105 | .module = THIS_MODULE, | |
106 | .attach = dio24_attach, | |
107 | .detach = dio24_detach, | |
8629efa4 | 108 | .num_names = ARRAY_SIZE(dio24_boards), |
68c3dbff BP |
109 | .board_name = &dio24_boards[0].name, |
110 | .offset = sizeof(struct dio24_board_struct), | |
d1d3cb32 DVC |
111 | }; |
112 | ||
da91b269 | 113 | static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) |
d1d3cb32 | 114 | { |
34c43922 | 115 | struct comedi_subdevice *s; |
d1d3cb32 DVC |
116 | unsigned long iobase = 0; |
117 | #ifdef incomplete | |
118 | unsigned int irq = 0; | |
119 | #endif | |
120 | struct pcmcia_device *link; | |
121 | ||
122 | /* allocate and initialize dev->private */ | |
344d23e9 | 123 | if (alloc_private(dev, sizeof(struct dio24_private)) < 0) |
d1d3cb32 DVC |
124 | return -ENOMEM; |
125 | ||
2696fb57 | 126 | /* get base address, irq etc. based on bustype */ |
d1d3cb32 DVC |
127 | switch (thisboard->bustype) { |
128 | case pcmcia_bustype: | |
129 | link = pcmcia_cur_dev; /* XXX hack */ | |
130 | if (!link) | |
131 | return -EIO; | |
132 | iobase = link->io.BasePort1; | |
133 | #ifdef incomplete | |
134 | irq = link->irq.AssignedIRQ; | |
135 | #endif | |
136 | break; | |
137 | default: | |
138 | printk("bug! couldn't determine board type\n"); | |
139 | return -EINVAL; | |
140 | break; | |
141 | } | |
142 | printk("comedi%d: ni_daq_dio24: %s, io 0x%lx", dev->minor, | |
0a85b6f0 | 143 | thisboard->name, iobase); |
d1d3cb32 DVC |
144 | #ifdef incomplete |
145 | if (irq) { | |
146 | printk(", irq %u", irq); | |
147 | } | |
148 | #endif | |
149 | ||
150 | printk("\n"); | |
151 | ||
152 | if (iobase == 0) { | |
153 | printk("io base address is zero!\n"); | |
154 | return -EINVAL; | |
155 | } | |
156 | ||
157 | dev->iobase = iobase; | |
158 | ||
159 | #ifdef incomplete | |
160 | /* grab our IRQ */ | |
161 | dev->irq = irq; | |
162 | #endif | |
163 | ||
164 | dev->board_name = thisboard->name; | |
165 | ||
166 | if (alloc_subdevices(dev, 1) < 0) | |
167 | return -ENOMEM; | |
168 | ||
169 | /* 8255 dio */ | |
170 | s = dev->subdevices + 0; | |
171 | subdev_8255_init(dev, s, NULL, dev->iobase); | |
172 | ||
173 | return 0; | |
174 | }; | |
175 | ||
da91b269 | 176 | static int dio24_detach(struct comedi_device *dev) |
d1d3cb32 DVC |
177 | { |
178 | printk("comedi%d: ni_daq_dio24: remove\n", dev->minor); | |
179 | ||
180 | if (dev->subdevices) | |
181 | subdev_8255_cleanup(dev, dev->subdevices + 0); | |
182 | ||
183 | if (thisboard->bustype != pcmcia_bustype && dev->iobase) | |
184 | release_region(dev->iobase, DIO24_SIZE); | |
185 | if (dev->irq) | |
5f74ea14 | 186 | free_irq(dev->irq, dev); |
d1d3cb32 DVC |
187 | |
188 | return 0; | |
189 | }; | |
190 | ||
55a19b39 | 191 | /* PCMCIA crap -- watch your words! */ |
d1d3cb32 DVC |
192 | |
193 | static void dio24_config(struct pcmcia_device *link); | |
194 | static void dio24_release(struct pcmcia_device *link); | |
195 | static int dio24_cs_suspend(struct pcmcia_device *p_dev); | |
196 | static int dio24_cs_resume(struct pcmcia_device *p_dev); | |
197 | ||
198 | /* | |
199 | The attach() and detach() entry points are used to create and destroy | |
200 | "instances" of the driver, where each instance represents everything | |
201 | needed to manage one actual PCMCIA card. | |
202 | */ | |
203 | ||
204 | static int dio24_cs_attach(struct pcmcia_device *); | |
205 | static void dio24_cs_detach(struct pcmcia_device *); | |
206 | ||
207 | /* | |
208 | You'll also need to prototype all the functions that will actually | |
209 | be used to talk to your device. See 'memory_cs' for a good example | |
210 | of a fully self-sufficient driver; the other drivers rely more or | |
211 | less on other parts of the kernel. | |
212 | */ | |
213 | ||
214 | /* | |
215 | The dev_info variable is the "key" that is used to match up this | |
216 | device driver with appropriate cards, through the card configuration | |
217 | database. | |
218 | */ | |
219 | ||
220 | static const dev_info_t dev_info = "ni_daq_dio24"; | |
221 | ||
2ec9f875 | 222 | struct local_info_t { |
d1d3cb32 DVC |
223 | struct pcmcia_device *link; |
224 | dev_node_t node; | |
225 | int stop; | |
226 | struct bus_operations *bus; | |
2ec9f875 | 227 | }; |
d1d3cb32 DVC |
228 | |
229 | /*====================================================================== | |
230 | ||
231 | dio24_cs_attach() creates an "instance" of the driver, allocating | |
232 | local data structures for one device. The device is registered | |
233 | with Card Services. | |
234 | ||
235 | The dev_link structure is initialized, but we don't actually | |
236 | configure the card at this point -- we wait until we receive a | |
237 | card insertion event. | |
238 | ||
239 | ======================================================================*/ | |
240 | ||
241 | static int dio24_cs_attach(struct pcmcia_device *link) | |
242 | { | |
2ec9f875 | 243 | struct local_info_t *local; |
d1d3cb32 DVC |
244 | |
245 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); | |
246 | ||
55a19b39 | 247 | dev_dbg(&link->dev, "dio24_cs_attach()\n"); |
d1d3cb32 DVC |
248 | |
249 | /* Allocate space for private device-specific data */ | |
2ec9f875 | 250 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
d1d3cb32 DVC |
251 | if (!local) |
252 | return -ENOMEM; | |
253 | local->link = link; | |
254 | link->priv = local; | |
255 | ||
256 | /* Interrupt setup */ | |
3d1c2884 | 257 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
d1d3cb32 DVC |
258 | link->irq.Handler = NULL; |
259 | ||
260 | /* | |
261 | General socket configuration defaults can go here. In this | |
262 | client, we assume very little, and rely on the CIS for almost | |
263 | everything. In most clients, many details (i.e., number, sizes, | |
264 | and attributes of IO windows) are fixed by the nature of the | |
265 | device, and can be hard-wired here. | |
266 | */ | |
267 | link->conf.Attributes = 0; | |
268 | link->conf.IntType = INT_MEMORY_AND_IO; | |
269 | ||
270 | pcmcia_cur_dev = link; | |
271 | ||
272 | dio24_config(link); | |
273 | ||
274 | return 0; | |
275 | } /* dio24_cs_attach */ | |
276 | ||
277 | /*====================================================================== | |
278 | ||
279 | This deletes a driver "instance". The device is de-registered | |
280 | with Card Services. If it has been released, all local data | |
281 | structures are freed. Otherwise, the structures will be freed | |
282 | when the device is released. | |
283 | ||
284 | ======================================================================*/ | |
285 | ||
286 | static void dio24_cs_detach(struct pcmcia_device *link) | |
287 | { | |
288 | ||
289 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n"); | |
290 | ||
55a19b39 | 291 | dev_dbg(&link->dev, "dio24_cs_detach\n"); |
d1d3cb32 DVC |
292 | |
293 | if (link->dev_node) { | |
0a85b6f0 | 294 | ((struct local_info_t *)link->priv)->stop = 1; |
d1d3cb32 DVC |
295 | dio24_release(link); |
296 | } | |
297 | ||
298 | /* This points to the parent local_info_t struct */ | |
299 | if (link->priv) | |
300 | kfree(link->priv); | |
301 | ||
302 | } /* dio24_cs_detach */ | |
303 | ||
304 | /*====================================================================== | |
305 | ||
306 | dio24_config() is scheduled to run after a CARD_INSERTION event | |
307 | is received, to configure the PCMCIA socket, and to make the | |
308 | device available to the system. | |
309 | ||
310 | ======================================================================*/ | |
311 | ||
55a19b39 DB |
312 | static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, |
313 | cistpl_cftable_entry_t *cfg, | |
314 | cistpl_cftable_entry_t *dflt, | |
315 | unsigned int vcc, | |
316 | void *priv_data) | |
d1d3cb32 | 317 | { |
55a19b39 | 318 | win_req_t *req = priv_data; |
d1d3cb32 | 319 | memreq_t map; |
d1d3cb32 | 320 | |
55a19b39 DB |
321 | if (cfg->index == 0) |
322 | return -ENODEV; | |
c3744138 | 323 | |
55a19b39 DB |
324 | /* Does this card need audio output? */ |
325 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | |
326 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; | |
327 | p_dev->conf.Status = CCSR_AUDIO_ENA; | |
d1d3cb32 | 328 | } |
c3744138 | 329 | |
55a19b39 DB |
330 | /* Do we need to allocate an interrupt? */ |
331 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) | |
332 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | |
333 | ||
334 | /* IO window settings */ | |
335 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | |
336 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | |
337 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | |
338 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | |
339 | if (!(io->flags & CISTPL_IO_8BIT)) | |
340 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | |
341 | if (!(io->flags & CISTPL_IO_16BIT)) | |
342 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | |
343 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | |
344 | p_dev->io.BasePort1 = io->win[0].base; | |
345 | p_dev->io.NumPorts1 = io->win[0].len; | |
346 | if (io->nwin > 1) { | |
347 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | |
348 | p_dev->io.BasePort2 = io->win[1].base; | |
349 | p_dev->io.NumPorts2 = io->win[1].len; | |
350 | } | |
351 | /* This reserves IO space but doesn't actually enable it */ | |
352 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | |
353 | return -ENODEV; | |
d1d3cb32 | 354 | } |
c3744138 | 355 | |
55a19b39 DB |
356 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
357 | cistpl_mem_t *mem = | |
358 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | |
359 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | |
360 | req->Attributes |= WIN_ENABLE; | |
361 | req->Base = mem->win[0].host_addr; | |
362 | req->Size = mem->win[0].len; | |
363 | if (req->Size < 0x1000) | |
364 | req->Size = 0x1000; | |
365 | req->AccessSpeed = 0; | |
6838b03f | 366 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) |
55a19b39 DB |
367 | return -ENODEV; |
368 | map.Page = 0; | |
369 | map.CardOffset = mem->win[0].card_addr; | |
868575d1 | 370 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) |
55a19b39 | 371 | return -ENODEV; |
d1d3cb32 | 372 | } |
55a19b39 DB |
373 | /* If we got this far, we're cool! */ |
374 | return 0; | |
375 | } | |
d1d3cb32 | 376 | |
55a19b39 DB |
377 | static void dio24_config(struct pcmcia_device *link) |
378 | { | |
379 | struct local_info_t *dev = link->priv; | |
380 | int ret; | |
381 | win_req_t req; | |
d1d3cb32 | 382 | |
55a19b39 | 383 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); |
d1d3cb32 | 384 | |
55a19b39 | 385 | dev_dbg(&link->dev, "dio24_config\n"); |
c3744138 | 386 | |
55a19b39 DB |
387 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); |
388 | if (ret) { | |
389 | dev_warn(&link->dev, "no configuration found\n"); | |
390 | goto failed; | |
d1d3cb32 DVC |
391 | } |
392 | ||
393 | /* | |
394 | Allocate an interrupt line. Note that this does not assign a | |
395 | handler to the interrupt, unless the 'Handler' member of the | |
396 | irq structure is initialized. | |
397 | */ | |
c3744138 | 398 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
55a19b39 DB |
399 | ret = pcmcia_request_irq(link, &link->irq); |
400 | if (ret) | |
401 | goto failed; | |
c3744138 | 402 | } |
d1d3cb32 DVC |
403 | |
404 | /* | |
405 | This actually configures the PCMCIA socket -- setting up | |
406 | the I/O windows and the interrupt mapping, and putting the | |
407 | card and host interface into "Memory and IO" mode. | |
408 | */ | |
55a19b39 DB |
409 | ret = pcmcia_request_configuration(link, &link->conf); |
410 | if (ret) | |
411 | goto failed; | |
d1d3cb32 DVC |
412 | |
413 | /* | |
414 | At this point, the dev_node_t structure(s) need to be | |
415 | initialized and arranged in a linked list at link->dev. | |
416 | */ | |
417 | sprintf(dev->node.dev_name, "ni_daq_dio24"); | |
418 | dev->node.major = dev->node.minor = 0; | |
419 | link->dev_node = &dev->node; | |
420 | ||
421 | /* Finally, report what we've done */ | |
422 | printk(KERN_INFO "%s: index 0x%02x", | |
0a85b6f0 | 423 | dev->node.dev_name, link->conf.ConfigIndex); |
d1d3cb32 DVC |
424 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
425 | printk(", irq %d", link->irq.AssignedIRQ); | |
426 | if (link->io.NumPorts1) | |
427 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | |
0a85b6f0 | 428 | link->io.BasePort1 + link->io.NumPorts1 - 1); |
d1d3cb32 DVC |
429 | if (link->io.NumPorts2) |
430 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | |
0a85b6f0 | 431 | link->io.BasePort2 + link->io.NumPorts2 - 1); |
d1d3cb32 DVC |
432 | if (link->win) |
433 | printk(", mem 0x%06lx-0x%06lx", req.Base, | |
0a85b6f0 | 434 | req.Base + req.Size - 1); |
d1d3cb32 DVC |
435 | printk("\n"); |
436 | ||
437 | return; | |
438 | ||
55a19b39 | 439 | failed: |
d1d3cb32 DVC |
440 | printk(KERN_INFO "Fallo"); |
441 | dio24_release(link); | |
442 | ||
443 | } /* dio24_config */ | |
444 | ||
445 | static void dio24_release(struct pcmcia_device *link) | |
446 | { | |
55a19b39 | 447 | dev_dbg(&link->dev, "dio24_release\n"); |
d1d3cb32 DVC |
448 | |
449 | pcmcia_disable_device(link); | |
450 | } /* dio24_release */ | |
451 | ||
452 | /*====================================================================== | |
453 | ||
454 | The card status event handler. Mostly, this schedules other | |
455 | stuff to run after an event is received. | |
456 | ||
457 | When a CARD_REMOVAL event is received, we immediately set a | |
458 | private flag to block future accesses to this device. All the | |
459 | functions that actually access the device should check this flag | |
460 | to make sure the card is still present. | |
461 | ||
462 | ======================================================================*/ | |
463 | ||
464 | static int dio24_cs_suspend(struct pcmcia_device *link) | |
465 | { | |
2ec9f875 | 466 | struct local_info_t *local = link->priv; |
d1d3cb32 DVC |
467 | |
468 | /* Mark the device as stopped, to block IO until later */ | |
469 | local->stop = 1; | |
470 | return 0; | |
471 | } /* dio24_cs_suspend */ | |
472 | ||
473 | static int dio24_cs_resume(struct pcmcia_device *link) | |
474 | { | |
2ec9f875 | 475 | struct local_info_t *local = link->priv; |
d1d3cb32 DVC |
476 | |
477 | local->stop = 0; | |
478 | return 0; | |
479 | } /* dio24_cs_resume */ | |
480 | ||
481 | /*====================================================================*/ | |
482 | ||
483 | static struct pcmcia_device_id dio24_cs_ids[] = { | |
484 | /* N.B. These IDs should match those in dio24_boards */ | |
485 | PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c), /* daqcard-dio24 */ | |
486 | PCMCIA_DEVICE_NULL | |
487 | }; | |
488 | ||
489 | MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids); | |
490 | ||
491 | struct pcmcia_driver dio24_cs_driver = { | |
492 | .probe = dio24_cs_attach, | |
493 | .remove = dio24_cs_detach, | |
494 | .suspend = dio24_cs_suspend, | |
495 | .resume = dio24_cs_resume, | |
496 | .id_table = dio24_cs_ids, | |
497 | .owner = THIS_MODULE, | |
498 | .drv = { | |
0a85b6f0 | 499 | .name = dev_info, |
d1d3cb32 DVC |
500 | }, |
501 | }; | |
502 | ||
503 | static int __init init_dio24_cs(void) | |
504 | { | |
505 | printk("ni_daq_dio24: HOLA SOY YO!\n"); | |
d1d3cb32 DVC |
506 | pcmcia_register_driver(&dio24_cs_driver); |
507 | return 0; | |
508 | } | |
509 | ||
510 | static void __exit exit_dio24_cs(void) | |
511 | { | |
d1d3cb32 DVC |
512 | pcmcia_unregister_driver(&dio24_cs_driver); |
513 | } | |
514 | ||
515 | int __init init_module(void) | |
516 | { | |
517 | int ret; | |
518 | ||
519 | ret = init_dio24_cs(); | |
520 | if (ret < 0) | |
521 | return ret; | |
522 | ||
523 | return comedi_driver_register(&driver_dio24); | |
524 | } | |
525 | ||
526 | void __exit cleanup_module(void) | |
527 | { | |
528 | exit_dio24_cs(); | |
529 | comedi_driver_unregister(&driver_dio24); | |
530 | } |