2 * cs.c -- Kernel Card Services - core services
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * The initial developer of the original 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.
12 * (C) 1999 David A. Hinds
15 #include <linux/module.h>
16 #include <linux/moduleparam.h>
17 #include <linux/init.h>
18 #include <linux/kernel.h>
19 #include <linux/string.h>
20 #include <linux/major.h>
21 #include <linux/errno.h>
22 #include <linux/slab.h>
24 #include <linux/interrupt.h>
25 #include <linux/timer.h>
26 #include <linux/ioport.h>
27 #include <linux/delay.h>
29 #include <linux/pci.h>
30 #include <linux/device.h>
31 #include <linux/kthread.h>
32 #include <asm/system.h>
35 #define IN_CARD_SERVICES
36 #include <pcmcia/cs_types.h>
37 #include <pcmcia/ss.h>
38 #include <pcmcia/cs.h>
39 #include <pcmcia/bulkmem.h>
40 #include <pcmcia/cistpl.h>
41 #include <pcmcia/cisreg.h>
42 #include <pcmcia/ds.h>
43 #include "cs_internal.h"
46 /* Module parameters */
48 MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
49 MODULE_DESCRIPTION("Linux Kernel Card Services");
50 MODULE_LICENSE("GPL");
52 #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
54 INT_MODULE_PARM(setup_delay, 10); /* centiseconds */
55 INT_MODULE_PARM(resume_delay, 20); /* centiseconds */
56 INT_MODULE_PARM(shutdown_delay, 3); /* centiseconds */
57 INT_MODULE_PARM(vcc_settle, 40); /* centiseconds */
58 INT_MODULE_PARM(reset_time, 10); /* usecs */
59 INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */
60 INT_MODULE_PARM(unreset_check, 10); /* centiseconds */
61 INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
63 /* Access speed for attribute memory windows */
64 INT_MODULE_PARM(cis_speed, 300); /* ns */
69 module_param(pc_debug, int, 0644);
71 int cs_debug_level(int level)
73 return pc_debug > level;
78 socket_state_t dead_socket = {
79 .csc_mask = SS_DETECT,
81 EXPORT_SYMBOL(dead_socket);
84 /* List of all sockets, protected by a rwsem */
85 LIST_HEAD(pcmcia_socket_list);
86 EXPORT_SYMBOL(pcmcia_socket_list);
88 DECLARE_RWSEM(pcmcia_socket_list_rwsem);
89 EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
93 * Low-level PCMCIA socket drivers need to register with the PCCard
94 * core using pcmcia_register_socket.
96 * socket drivers are expected to use the following callbacks in their
98 * - pcmcia_socket_dev_suspend
99 * - pcmcia_socket_dev_resume
100 * These functions check for the appropriate struct pcmcia_soket arrays,
101 * and pass them to the low-level functions pcmcia_{suspend,resume}_socket
103 static int socket_resume(struct pcmcia_socket *skt);
104 static int socket_suspend(struct pcmcia_socket *skt);
106 int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state)
108 struct pcmcia_socket *socket;
110 down_read(&pcmcia_socket_list_rwsem);
111 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
112 if (socket->dev.dev != dev)
114 mutex_lock(&socket->skt_mutex);
115 socket_suspend(socket);
116 mutex_unlock(&socket->skt_mutex);
118 up_read(&pcmcia_socket_list_rwsem);
122 EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
124 int pcmcia_socket_dev_resume(struct device *dev)
126 struct pcmcia_socket *socket;
128 down_read(&pcmcia_socket_list_rwsem);
129 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
130 if (socket->dev.dev != dev)
132 mutex_lock(&socket->skt_mutex);
133 socket_resume(socket);
134 mutex_unlock(&socket->skt_mutex);
136 up_read(&pcmcia_socket_list_rwsem);
140 EXPORT_SYMBOL(pcmcia_socket_dev_resume);
143 struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt)
145 struct class_device *cl_dev = class_device_get(&skt->dev);
148 skt = class_get_devdata(cl_dev);
149 if (!try_module_get(skt->owner)) {
150 class_device_put(&skt->dev);
155 EXPORT_SYMBOL(pcmcia_get_socket);
158 void pcmcia_put_socket(struct pcmcia_socket *skt)
160 module_put(skt->owner);
161 class_device_put(&skt->dev);
163 EXPORT_SYMBOL(pcmcia_put_socket);
166 static void pcmcia_release_socket(struct class_device *class_dev)
168 struct pcmcia_socket *socket = class_get_devdata(class_dev);
170 complete(&socket->socket_released);
173 static int pccardd(void *__skt);
176 * pcmcia_register_socket - add a new pcmcia socket device
178 int pcmcia_register_socket(struct pcmcia_socket *socket)
180 struct task_struct *tsk;
183 if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops)
186 cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops);
188 spin_lock_init(&socket->lock);
190 if (socket->resource_ops->init) {
191 ret = socket->resource_ops->init(socket);
196 /* try to obtain a socket number [yes, it gets ugly if we
197 * register more than 2^sizeof(unsigned int) pcmcia
198 * sockets... but the socket number is deprecated
199 * anyways, so I don't care] */
200 down_write(&pcmcia_socket_list_rwsem);
201 if (list_empty(&pcmcia_socket_list))
204 unsigned int found, i = 1;
205 struct pcmcia_socket *tmp;
208 list_for_each_entry(tmp, &pcmcia_socket_list, socket_list) {
214 socket->sock = i - 1;
216 list_add_tail(&socket->socket_list, &pcmcia_socket_list);
217 up_write(&pcmcia_socket_list_rwsem);
219 #ifndef CONFIG_CARDBUS
221 * If we do not support Cardbus, ensure that
222 * the Cardbus socket capability is disabled.
224 socket->features &= ~SS_CAP_CARDBUS;
227 /* set proper values in socket->dev */
228 socket->dev.class_data = socket;
229 socket->dev.class = &pcmcia_socket_class;
230 snprintf(socket->dev.class_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock);
232 /* base address = 0, map = 0 */
233 socket->cis_mem.flags = 0;
234 socket->cis_mem.speed = cis_speed;
236 INIT_LIST_HEAD(&socket->cis_cache);
238 init_completion(&socket->socket_released);
239 init_completion(&socket->thread_done);
240 init_waitqueue_head(&socket->thread_wait);
241 mutex_init(&socket->skt_mutex);
242 spin_lock_init(&socket->thread_lock);
244 tsk = kthread_run(pccardd, socket, "pccardd");
250 wait_for_completion(&socket->thread_done);
251 if (!socket->thread) {
252 printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket);
256 pcmcia_parse_events(socket, SS_DETECT);
261 down_write(&pcmcia_socket_list_rwsem);
262 list_del(&socket->socket_list);
263 up_write(&pcmcia_socket_list_rwsem);
265 } /* pcmcia_register_socket */
266 EXPORT_SYMBOL(pcmcia_register_socket);
270 * pcmcia_unregister_socket - remove a pcmcia socket device
272 void pcmcia_unregister_socket(struct pcmcia_socket *socket)
277 cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
279 if (socket->thread) {
280 wake_up(&socket->thread_wait);
281 kthread_stop(socket->thread);
283 release_cis_mem(socket);
285 /* remove from our own list */
286 down_write(&pcmcia_socket_list_rwsem);
287 list_del(&socket->socket_list);
288 up_write(&pcmcia_socket_list_rwsem);
290 /* wait for sysfs to drop all references */
291 release_resource_db(socket);
292 wait_for_completion(&socket->socket_released);
293 } /* pcmcia_unregister_socket */
294 EXPORT_SYMBOL(pcmcia_unregister_socket);
297 struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr)
299 struct pcmcia_socket *s;
301 down_read(&pcmcia_socket_list_rwsem);
302 list_for_each_entry(s, &pcmcia_socket_list, socket_list)
304 up_read(&pcmcia_socket_list_rwsem);
307 up_read(&pcmcia_socket_list_rwsem);
312 EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
315 * The central event handler. Send_event() sends an event to the
316 * 16-bit subsystem, which then calls the relevant device drivers.
317 * Parse_events() interprets the event bits from
318 * a card status change report. Do_shutdown() handles the high
319 * priority stuff associated with a card removal.
322 /* NOTE: send_event needs to be called with skt->sem held. */
324 static int send_event(struct pcmcia_socket *s, event_t event, int priority)
328 if (s->state & SOCKET_CARDBUS)
331 cs_dbg(s, 1, "send_event(event %d, pri %d, callback 0x%p)\n",
332 event, priority, s->callback);
336 if (!try_module_get(s->callback->owner))
339 ret = s->callback->event(s, event, priority);
341 module_put(s->callback->owner);
346 static void socket_remove_drivers(struct pcmcia_socket *skt)
348 cs_dbg(skt, 4, "remove_drivers\n");
350 send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
353 static int socket_reset(struct pcmcia_socket *skt)
357 cs_dbg(skt, 4, "reset\n");
359 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET;
360 skt->ops->set_socket(skt, &skt->socket);
361 udelay((long)reset_time);
363 skt->socket.flags &= ~SS_RESET;
364 skt->ops->set_socket(skt, &skt->socket);
366 msleep(unreset_delay * 10);
367 for (i = 0; i < unreset_limit; i++) {
368 skt->ops->get_status(skt, &status);
370 if (!(status & SS_DETECT))
373 if (status & SS_READY)
376 msleep(unreset_check * 10);
379 cs_err(skt, "time out after reset.\n");
380 return CS_GENERAL_FAILURE;
384 * socket_setup() and socket_shutdown() are called by the main event handler
385 * when card insertion and removal events are received.
386 * socket_setup() turns on socket power and resets the socket, in two stages.
387 * socket_shutdown() unconfigures a socket and turns off socket power.
389 static void socket_shutdown(struct pcmcia_socket *s)
393 cs_dbg(s, 4, "shutdown\n");
395 socket_remove_drivers(s);
396 s->state &= SOCKET_INUSE | SOCKET_PRESENT;
397 msleep(shutdown_delay * 10);
398 s->state &= SOCKET_INUSE;
400 /* Blank out the socket state */
401 s->socket = dead_socket;
403 s->ops->set_socket(s, &s->socket);
404 s->irq.AssignedIRQ = s->irq.Config = 0;
406 destroy_cis_cache(s);
407 #ifdef CONFIG_CARDBUS
412 s->ops->get_status(s, &status);
413 if (status & SS_POWERON) {
414 printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s);
420 static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
424 cs_dbg(skt, 4, "setup\n");
426 skt->ops->get_status(skt, &status);
427 if (!(status & SS_DETECT))
430 msleep(initial_delay * 10);
432 for (i = 0; i < 100; i++) {
433 skt->ops->get_status(skt, &status);
434 if (!(status & SS_DETECT))
437 if (!(status & SS_PENDING))
443 if (status & SS_PENDING) {
444 cs_err(skt, "voltage interrogation timed out.\n");
445 return CS_GENERAL_FAILURE;
448 if (status & SS_CARDBUS) {
449 if (!(skt->features & SS_CAP_CARDBUS)) {
450 cs_err(skt, "cardbus cards are not supported.\n");
453 skt->state |= SOCKET_CARDBUS;
457 * Decode the card voltage requirements, and apply power to the card.
459 if (status & SS_3VCARD)
460 skt->socket.Vcc = skt->socket.Vpp = 33;
461 else if (!(status & SS_XVCARD))
462 skt->socket.Vcc = skt->socket.Vpp = 50;
464 cs_err(skt, "unsupported voltage key.\n");
469 skt->power_hook(skt, HOOK_POWER_PRE);
471 skt->socket.flags = 0;
472 skt->ops->set_socket(skt, &skt->socket);
475 * Wait "vcc_settle" for the supply to stabilise.
477 msleep(vcc_settle * 10);
479 skt->ops->get_status(skt, &status);
480 if (!(status & SS_POWERON)) {
481 cs_err(skt, "unable to apply power.\n");
485 status = socket_reset(skt);
488 skt->power_hook(skt, HOOK_POWER_POST);
494 * Handle card insertion. Setup the socket, reset the card,
495 * and then tell the rest of PCMCIA that a card is present.
497 static int socket_insert(struct pcmcia_socket *skt)
501 cs_dbg(skt, 4, "insert\n");
503 if (!cs_socket_get(skt))
506 ret = socket_setup(skt, setup_delay);
507 if (ret == CS_SUCCESS) {
508 skt->state |= SOCKET_PRESENT;
510 printk(KERN_NOTICE "pccard: %s card inserted into slot %d\n",
511 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
514 #ifdef CONFIG_CARDBUS
515 if (skt->state & SOCKET_CARDBUS) {
517 skt->state |= SOCKET_CARDBUS_CONFIG;
520 cs_dbg(skt, 4, "insert done\n");
522 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
524 socket_shutdown(skt);
530 static int socket_suspend(struct pcmcia_socket *skt)
532 if (skt->state & SOCKET_SUSPEND)
535 send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
536 skt->socket = dead_socket;
537 skt->ops->set_socket(skt, &skt->socket);
538 if (skt->ops->suspend)
539 skt->ops->suspend(skt);
540 skt->state |= SOCKET_SUSPEND;
546 * Resume a socket. If a card is present, verify its CIS against
547 * our cached copy. If they are different, the card has been
548 * replaced, and we need to tell the drivers.
550 static int socket_resume(struct pcmcia_socket *skt)
554 if (!(skt->state & SOCKET_SUSPEND))
557 skt->socket = dead_socket;
559 skt->ops->set_socket(skt, &skt->socket);
561 if (!(skt->state & SOCKET_PRESENT)) {
562 skt->state &= ~SOCKET_SUSPEND;
563 return socket_insert(skt);
566 ret = socket_setup(skt, resume_delay);
567 if (ret == CS_SUCCESS) {
569 * FIXME: need a better check here for cardbus cards.
571 if (verify_cis_cache(skt) != 0) {
572 cs_dbg(skt, 4, "cis mismatch - different card\n");
573 socket_remove_drivers(skt);
574 destroy_cis_cache(skt);
576 * Workaround: give DS time to schedule removal.
577 * Remove me once the 100ms delay is eliminated
581 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
583 cs_dbg(skt, 4, "cis matches cache\n");
584 send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
587 socket_shutdown(skt);
590 skt->state &= ~SOCKET_SUSPEND;
595 static void socket_remove(struct pcmcia_socket *skt)
597 printk(KERN_NOTICE "pccard: card ejected from slot %d\n", skt->sock);
598 socket_shutdown(skt);
602 * Process a socket card detect status change.
604 * If we don't have a card already present, delay the detect event for
605 * about 20ms (to be on the safe side) before reading the socket status.
607 * Some i82365-based systems send multiple SS_DETECT events during card
608 * insertion, and the "card present" status bit seems to bounce. This
609 * will probably be true with GPIO-based card detection systems after
610 * the product has aged.
612 static void socket_detect_change(struct pcmcia_socket *skt)
614 if (!(skt->state & SOCKET_SUSPEND)) {
617 if (!(skt->state & SOCKET_PRESENT))
620 skt->ops->get_status(skt, &status);
621 if ((skt->state & SOCKET_PRESENT) &&
622 !(status & SS_DETECT))
624 if (!(skt->state & SOCKET_PRESENT) &&
625 (status & SS_DETECT))
630 static int pccardd(void *__skt)
632 struct pcmcia_socket *skt = __skt;
633 DECLARE_WAITQUEUE(wait, current);
636 skt->thread = current;
637 skt->socket = dead_socket;
639 skt->ops->set_socket(skt, &skt->socket);
641 /* register with the device core */
642 ret = class_device_register(&skt->dev);
644 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n",
647 complete(&skt->thread_done);
651 add_wait_queue(&skt->thread_wait, &wait);
652 complete(&skt->thread_done);
658 set_current_state(TASK_INTERRUPTIBLE);
660 spin_lock_irqsave(&skt->thread_lock, flags);
661 events = skt->thread_events;
662 skt->thread_events = 0;
663 spin_unlock_irqrestore(&skt->thread_lock, flags);
666 mutex_lock(&skt->skt_mutex);
667 if (events & SS_DETECT)
668 socket_detect_change(skt);
669 if (events & SS_BATDEAD)
670 send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW);
671 if (events & SS_BATWARN)
672 send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW);
673 if (events & SS_READY)
674 send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW);
675 mutex_unlock(&skt->skt_mutex);
679 if (kthread_should_stop())
685 /* make sure we are running before we exit */
686 set_current_state(TASK_RUNNING);
688 remove_wait_queue(&skt->thread_wait, &wait);
690 /* remove from the device core */
691 class_device_unregister(&skt->dev);
697 * Yenta (at least) probes interrupts before registering the socket and
698 * starting the handler thread.
700 void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
703 cs_dbg(s, 4, "parse_events: events %08x\n", events);
705 spin_lock_irqsave(&s->thread_lock, flags);
706 s->thread_events |= events;
707 spin_unlock_irqrestore(&s->thread_lock, flags);
709 wake_up(&s->thread_wait);
711 } /* pcmcia_parse_events */
712 EXPORT_SYMBOL(pcmcia_parse_events);
715 /* register pcmcia_callback */
716 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
720 /* s->skt_mutex also protects s->callback */
721 mutex_lock(&s->skt_mutex);
732 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
733 send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
737 mutex_unlock(&s->skt_mutex);
741 EXPORT_SYMBOL(pccard_register_pcmcia);
744 /* I'm not sure which "reset" function this is supposed to use,
745 * but for now, it uses the low-level interface's reset, not the
749 int pccard_reset_card(struct pcmcia_socket *skt)
753 cs_dbg(skt, 1, "resetting socket\n");
755 mutex_lock(&skt->skt_mutex);
757 if (!(skt->state & SOCKET_PRESENT)) {
761 if (skt->state & SOCKET_SUSPEND) {
765 if (skt->state & SOCKET_CARDBUS) {
766 ret = CS_UNSUPPORTED_FUNCTION;
770 ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW);
772 send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW);
774 skt->callback->suspend(skt);
775 if (socket_reset(skt) == CS_SUCCESS) {
776 send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW);
778 skt->callback->resume(skt);
784 mutex_unlock(&skt->skt_mutex);
788 EXPORT_SYMBOL(pccard_reset_card);
791 /* These shut down or wake up a socket. They are sort of user
792 * initiated versions of the APM suspend and resume actions.
794 int pcmcia_suspend_card(struct pcmcia_socket *skt)
798 cs_dbg(skt, 1, "suspending socket\n");
800 mutex_lock(&skt->skt_mutex);
802 if (!(skt->state & SOCKET_PRESENT)) {
806 if (skt->state & SOCKET_CARDBUS) {
807 ret = CS_UNSUPPORTED_FUNCTION;
811 ret = skt->callback->suspend(skt);
815 ret = socket_suspend(skt);
817 mutex_unlock(&skt->skt_mutex);
821 EXPORT_SYMBOL(pcmcia_suspend_card);
824 int pcmcia_resume_card(struct pcmcia_socket *skt)
828 cs_dbg(skt, 1, "waking up socket\n");
830 mutex_lock(&skt->skt_mutex);
832 if (!(skt->state & SOCKET_PRESENT)) {
836 if (skt->state & SOCKET_CARDBUS) {
837 ret = CS_UNSUPPORTED_FUNCTION;
840 ret = socket_resume(skt);
841 if (!ret && skt->callback)
842 skt->callback->resume(skt);
844 mutex_unlock(&skt->skt_mutex);
848 EXPORT_SYMBOL(pcmcia_resume_card);
851 /* These handle user requests to eject or insert a card. */
852 int pcmcia_eject_card(struct pcmcia_socket *skt)
856 cs_dbg(skt, 1, "user eject request\n");
858 mutex_lock(&skt->skt_mutex);
860 if (!(skt->state & SOCKET_PRESENT)) {
865 ret = send_event(skt, CS_EVENT_EJECTION_REQUEST, CS_EVENT_PRI_LOW);
874 mutex_unlock(&skt->skt_mutex);
878 EXPORT_SYMBOL(pcmcia_eject_card);
881 int pcmcia_insert_card(struct pcmcia_socket *skt)
885 cs_dbg(skt, 1, "user insert request\n");
887 mutex_lock(&skt->skt_mutex);
889 if (skt->state & SOCKET_PRESENT) {
893 if (socket_insert(skt) == CS_NO_CARD) {
899 mutex_unlock(&skt->skt_mutex);
903 EXPORT_SYMBOL(pcmcia_insert_card);
906 static int pcmcia_socket_uevent(struct class_device *dev, char **envp,
907 int num_envp, char *buffer, int buffer_size)
909 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
910 int i = 0, length = 0;
912 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
913 &length, "SOCKET_NO=%u", s->sock))
922 static struct completion pcmcia_unload;
924 static void pcmcia_release_socket_class(struct class *data)
926 complete(&pcmcia_unload);
930 struct class pcmcia_socket_class = {
931 .name = "pcmcia_socket",
932 .uevent = pcmcia_socket_uevent,
933 .release = pcmcia_release_socket,
934 .class_release = pcmcia_release_socket_class,
936 EXPORT_SYMBOL(pcmcia_socket_class);
939 static int __init init_pcmcia_cs(void)
943 init_completion(&pcmcia_unload);
944 ret = class_register(&pcmcia_socket_class);
947 return class_interface_register(&pccard_sysfs_interface);
950 static void __exit exit_pcmcia_cs(void)
952 class_interface_unregister(&pccard_sysfs_interface);
953 class_unregister(&pcmcia_socket_class);
955 wait_for_completion(&pcmcia_unload);
958 subsys_initcall(init_pcmcia_cs);
959 module_exit(exit_pcmcia_cs);