1 // SPDX-License-Identifier: GPL-2.0-only
3 * cs.c -- Kernel Card Services - core services
5 * The initial developer of the original code is David A. Hinds
6 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
7 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
9 * (C) 1999 David A. Hinds
12 #include <linux/module.h>
13 #include <linux/moduleparam.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/string.h>
17 #include <linux/major.h>
18 #include <linux/errno.h>
19 #include <linux/slab.h>
21 #include <linux/interrupt.h>
22 #include <linux/timer.h>
23 #include <linux/ioport.h>
24 #include <linux/delay.h>
26 #include <linux/device.h>
27 #include <linux/kthread.h>
28 #include <linux/freezer.h>
31 #include <pcmcia/ss.h>
32 #include <pcmcia/cistpl.h>
33 #include <pcmcia/cisreg.h>
34 #include <pcmcia/ds.h>
35 #include "cs_internal.h"
38 /* Module parameters */
40 MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
41 MODULE_DESCRIPTION("Linux Kernel Card Services");
42 MODULE_LICENSE("GPL");
44 #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
46 INT_MODULE_PARM(setup_delay, 10); /* centiseconds */
47 INT_MODULE_PARM(resume_delay, 20); /* centiseconds */
48 INT_MODULE_PARM(shutdown_delay, 3); /* centiseconds */
49 INT_MODULE_PARM(vcc_settle, 40); /* centiseconds */
50 INT_MODULE_PARM(reset_time, 10); /* usecs */
51 INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */
52 INT_MODULE_PARM(unreset_check, 10); /* centiseconds */
53 INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
55 /* Access speed for attribute memory windows */
56 INT_MODULE_PARM(cis_speed, 300); /* ns */
59 socket_state_t dead_socket = {
60 .csc_mask = SS_DETECT,
62 EXPORT_SYMBOL(dead_socket);
65 /* List of all sockets, protected by a rwsem */
66 LIST_HEAD(pcmcia_socket_list);
67 EXPORT_SYMBOL(pcmcia_socket_list);
69 DECLARE_RWSEM(pcmcia_socket_list_rwsem);
70 EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
73 struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
75 struct device *dev = get_device(&skt->dev);
78 return dev_get_drvdata(dev);
80 EXPORT_SYMBOL(pcmcia_get_socket);
83 void pcmcia_put_socket(struct pcmcia_socket *skt)
85 put_device(&skt->dev);
87 EXPORT_SYMBOL(pcmcia_put_socket);
90 static void pcmcia_release_socket(struct device *dev)
92 struct pcmcia_socket *socket = dev_get_drvdata(dev);
94 complete(&socket->socket_released);
97 static int pccardd(void *__skt);
100 * pcmcia_register_socket - add a new pcmcia socket device
101 * @socket: the &socket to register
103 int pcmcia_register_socket(struct pcmcia_socket *socket)
105 struct task_struct *tsk;
108 if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops)
111 dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops);
113 /* try to obtain a socket number [yes, it gets ugly if we
114 * register more than 2^sizeof(unsigned int) pcmcia
115 * sockets... but the socket number is deprecated
116 * anyways, so I don't care] */
117 down_write(&pcmcia_socket_list_rwsem);
118 if (list_empty(&pcmcia_socket_list))
121 unsigned int found, i = 1;
122 struct pcmcia_socket *tmp;
125 list_for_each_entry(tmp, &pcmcia_socket_list, socket_list) {
131 socket->sock = i - 1;
133 list_add_tail(&socket->socket_list, &pcmcia_socket_list);
134 up_write(&pcmcia_socket_list_rwsem);
136 #ifndef CONFIG_CARDBUS
138 * If we do not support Cardbus, ensure that
139 * the Cardbus socket capability is disabled.
141 socket->features &= ~SS_CAP_CARDBUS;
144 /* set proper values in socket->dev */
145 dev_set_drvdata(&socket->dev, socket);
146 socket->dev.class = &pcmcia_socket_class;
147 dev_set_name(&socket->dev, "pcmcia_socket%u", socket->sock);
149 /* base address = 0, map = 0 */
150 socket->cis_mem.flags = 0;
151 socket->cis_mem.speed = cis_speed;
153 INIT_LIST_HEAD(&socket->cis_cache);
155 init_completion(&socket->socket_released);
156 init_completion(&socket->thread_done);
157 mutex_init(&socket->skt_mutex);
158 mutex_init(&socket->ops_mutex);
159 spin_lock_init(&socket->thread_lock);
161 if (socket->resource_ops->init) {
162 mutex_lock(&socket->ops_mutex);
163 ret = socket->resource_ops->init(socket);
164 mutex_unlock(&socket->ops_mutex);
169 tsk = kthread_run(pccardd, socket, "pccardd");
175 wait_for_completion(&socket->thread_done);
176 if (!socket->thread) {
177 dev_warn(&socket->dev,
178 "PCMCIA: warning: socket thread did not start\n");
182 pcmcia_parse_events(socket, SS_DETECT);
185 * Let's try to get the PCMCIA module for 16-bit PCMCIA support.
186 * If it fails, it doesn't matter -- we still have 32-bit CardBus
187 * support to offer, so this is not a failure mode.
189 request_module_nowait("pcmcia");
194 down_write(&pcmcia_socket_list_rwsem);
195 list_del(&socket->socket_list);
196 up_write(&pcmcia_socket_list_rwsem);
198 } /* pcmcia_register_socket */
199 EXPORT_SYMBOL(pcmcia_register_socket);
203 * pcmcia_unregister_socket - remove a pcmcia socket device
204 * @socket: the &socket to unregister
206 void pcmcia_unregister_socket(struct pcmcia_socket *socket)
211 dev_dbg(&socket->dev, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
214 kthread_stop(socket->thread);
216 /* remove from our own list */
217 down_write(&pcmcia_socket_list_rwsem);
218 list_del(&socket->socket_list);
219 up_write(&pcmcia_socket_list_rwsem);
221 /* wait for sysfs to drop all references */
222 if (socket->resource_ops->exit) {
223 mutex_lock(&socket->ops_mutex);
224 socket->resource_ops->exit(socket);
225 mutex_unlock(&socket->ops_mutex);
227 wait_for_completion(&socket->socket_released);
228 } /* pcmcia_unregister_socket */
229 EXPORT_SYMBOL(pcmcia_unregister_socket);
232 struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr)
234 struct pcmcia_socket *s;
236 down_read(&pcmcia_socket_list_rwsem);
237 list_for_each_entry(s, &pcmcia_socket_list, socket_list)
239 up_read(&pcmcia_socket_list_rwsem);
242 up_read(&pcmcia_socket_list_rwsem);
247 EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
249 static int socket_reset(struct pcmcia_socket *skt)
253 dev_dbg(&skt->dev, "reset\n");
255 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET;
256 skt->ops->set_socket(skt, &skt->socket);
257 udelay((long)reset_time);
259 skt->socket.flags &= ~SS_RESET;
260 skt->ops->set_socket(skt, &skt->socket);
262 msleep(unreset_delay * 10);
263 for (i = 0; i < unreset_limit; i++) {
264 skt->ops->get_status(skt, &status);
266 if (!(status & SS_DETECT))
269 if (status & SS_READY)
272 msleep(unreset_check * 10);
275 dev_err(&skt->dev, "time out after reset\n");
280 * socket_setup() and socket_shutdown() are called by the main event handler
281 * when card insertion and removal events are received.
282 * socket_setup() turns on socket power and resets the socket, in two stages.
283 * socket_shutdown() unconfigures a socket and turns off socket power.
285 static void socket_shutdown(struct pcmcia_socket *s)
289 dev_dbg(&s->dev, "shutdown\n");
292 s->callback->remove(s);
294 mutex_lock(&s->ops_mutex);
295 s->state &= SOCKET_INUSE | SOCKET_PRESENT;
296 msleep(shutdown_delay * 10);
297 s->state &= SOCKET_INUSE;
299 /* Blank out the socket state */
300 s->socket = dead_socket;
302 s->ops->set_socket(s, &s->socket);
308 /* From here on we can be sure that only we (that is, the
309 * pccardd thread) accesses this socket, and all (16-bit)
310 * PCMCIA interactions are gone. Therefore, release
311 * ops_mutex so that we don't get a sysfs-related lockdep
314 mutex_unlock(&s->ops_mutex);
316 #ifdef CONFIG_CARDBUS
320 /* give socket some time to power down */
323 s->ops->get_status(s, &status);
324 if (status & SS_POWERON) {
326 "*** DANGER *** unable to remove socket power\n");
329 s->state &= ~SOCKET_INUSE;
332 static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
336 dev_dbg(&skt->dev, "setup\n");
338 skt->ops->get_status(skt, &status);
339 if (!(status & SS_DETECT))
342 msleep(initial_delay * 10);
344 for (i = 0; i < 100; i++) {
345 skt->ops->get_status(skt, &status);
346 if (!(status & SS_DETECT))
349 if (!(status & SS_PENDING))
355 if (status & SS_PENDING) {
356 dev_err(&skt->dev, "voltage interrogation timed out\n");
360 if (status & SS_CARDBUS) {
361 if (!(skt->features & SS_CAP_CARDBUS)) {
362 dev_err(&skt->dev, "cardbus cards are not supported\n");
365 skt->state |= SOCKET_CARDBUS;
367 skt->state &= ~SOCKET_CARDBUS;
370 * Decode the card voltage requirements, and apply power to the card.
372 if (status & SS_3VCARD)
373 skt->socket.Vcc = skt->socket.Vpp = 33;
374 else if (!(status & SS_XVCARD))
375 skt->socket.Vcc = skt->socket.Vpp = 50;
377 dev_err(&skt->dev, "unsupported voltage key\n");
382 skt->power_hook(skt, HOOK_POWER_PRE);
384 skt->socket.flags = 0;
385 skt->ops->set_socket(skt, &skt->socket);
388 * Wait "vcc_settle" for the supply to stabilise.
390 msleep(vcc_settle * 10);
392 skt->ops->get_status(skt, &status);
393 if (!(status & SS_POWERON)) {
394 dev_err(&skt->dev, "unable to apply power\n");
398 status = socket_reset(skt);
401 skt->power_hook(skt, HOOK_POWER_POST);
407 * Handle card insertion. Setup the socket, reset the card,
408 * and then tell the rest of PCMCIA that a card is present.
410 static int socket_insert(struct pcmcia_socket *skt)
414 dev_dbg(&skt->dev, "insert\n");
416 mutex_lock(&skt->ops_mutex);
417 if (skt->state & SOCKET_INUSE) {
418 mutex_unlock(&skt->ops_mutex);
421 skt->state |= SOCKET_INUSE;
423 ret = socket_setup(skt, setup_delay);
425 skt->state |= SOCKET_PRESENT;
427 dev_notice(&skt->dev, "pccard: %s card inserted into slot %d\n",
428 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
431 #ifdef CONFIG_CARDBUS
432 if (skt->state & SOCKET_CARDBUS) {
434 skt->state |= SOCKET_CARDBUS_CONFIG;
437 dev_dbg(&skt->dev, "insert done\n");
438 mutex_unlock(&skt->ops_mutex);
440 if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
441 skt->callback->add(skt);
443 mutex_unlock(&skt->ops_mutex);
444 socket_shutdown(skt);
450 static int socket_suspend(struct pcmcia_socket *skt)
452 if ((skt->state & SOCKET_SUSPEND) && !(skt->state & SOCKET_IN_RESUME))
455 mutex_lock(&skt->ops_mutex);
456 /* store state on first suspend, but not after spurious wakeups */
457 if (!(skt->state & SOCKET_IN_RESUME))
458 skt->suspended_state = skt->state;
460 skt->socket = dead_socket;
461 skt->ops->set_socket(skt, &skt->socket);
462 if (skt->ops->suspend)
463 skt->ops->suspend(skt);
464 skt->state |= SOCKET_SUSPEND;
465 skt->state &= ~SOCKET_IN_RESUME;
466 mutex_unlock(&skt->ops_mutex);
470 static int socket_early_resume(struct pcmcia_socket *skt)
472 mutex_lock(&skt->ops_mutex);
473 skt->socket = dead_socket;
475 skt->ops->set_socket(skt, &skt->socket);
476 if (skt->state & SOCKET_PRESENT)
477 skt->resume_status = socket_setup(skt, resume_delay);
478 skt->state |= SOCKET_IN_RESUME;
479 mutex_unlock(&skt->ops_mutex);
483 static int socket_late_resume(struct pcmcia_socket *skt)
487 mutex_lock(&skt->ops_mutex);
488 skt->state &= ~(SOCKET_SUSPEND | SOCKET_IN_RESUME);
489 mutex_unlock(&skt->ops_mutex);
491 if (!(skt->state & SOCKET_PRESENT)) {
492 ret = socket_insert(skt);
498 if (skt->resume_status) {
499 socket_shutdown(skt);
503 if (skt->suspended_state != skt->state) {
505 "suspend state 0x%x != resume state 0x%x\n",
506 skt->suspended_state, skt->state);
508 socket_shutdown(skt);
509 return socket_insert(skt);
512 if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
513 ret = skt->callback->early_resume(skt);
518 * Finalize the resume. In case of a cardbus socket, we have
519 * to rebind the devices as we can't be certain that it has been
522 static int socket_complete_resume(struct pcmcia_socket *skt)
525 #ifdef CONFIG_CARDBUS
526 if (skt->state & SOCKET_CARDBUS) {
527 /* We can't be sure the CardBus card is the same
528 * as the one previously inserted. Therefore, remove
540 * Resume a socket. If a card is present, verify its CIS against
541 * our cached copy. If they are different, the card has been
542 * replaced, and we need to tell the drivers.
544 static int socket_resume(struct pcmcia_socket *skt)
547 if (!(skt->state & SOCKET_SUSPEND))
550 socket_early_resume(skt);
551 err = socket_late_resume(skt);
553 err = socket_complete_resume(skt);
557 static void socket_remove(struct pcmcia_socket *skt)
559 dev_notice(&skt->dev, "pccard: card ejected from slot %d\n", skt->sock);
560 socket_shutdown(skt);
564 * Process a socket card detect status change.
566 * If we don't have a card already present, delay the detect event for
567 * about 20ms (to be on the safe side) before reading the socket status.
569 * Some i82365-based systems send multiple SS_DETECT events during card
570 * insertion, and the "card present" status bit seems to bounce. This
571 * will probably be true with GPIO-based card detection systems after
572 * the product has aged.
574 static void socket_detect_change(struct pcmcia_socket *skt)
576 if (!(skt->state & SOCKET_SUSPEND)) {
579 if (!(skt->state & SOCKET_PRESENT))
582 skt->ops->get_status(skt, &status);
583 if ((skt->state & SOCKET_PRESENT) &&
584 !(status & SS_DETECT))
586 if (!(skt->state & SOCKET_PRESENT) &&
587 (status & SS_DETECT))
592 static int pccardd(void *__skt)
594 struct pcmcia_socket *skt = __skt;
597 skt->thread = current;
598 skt->socket = dead_socket;
600 skt->ops->set_socket(skt, &skt->socket);
602 /* register with the device core */
603 ret = device_register(&skt->dev);
605 dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
607 complete(&skt->thread_done);
610 ret = pccard_sysfs_add_socket(&skt->dev);
612 dev_warn(&skt->dev, "err %d adding socket attributes\n", ret);
614 complete(&skt->thread_done);
616 /* wait for userspace to catch up */
623 unsigned int sysfs_events;
625 spin_lock_irqsave(&skt->thread_lock, flags);
626 events = skt->thread_events;
627 skt->thread_events = 0;
628 sysfs_events = skt->sysfs_events;
629 skt->sysfs_events = 0;
630 spin_unlock_irqrestore(&skt->thread_lock, flags);
632 mutex_lock(&skt->skt_mutex);
633 if (events & SS_DETECT)
634 socket_detect_change(skt);
637 if (sysfs_events & PCMCIA_UEVENT_EJECT)
639 if (sysfs_events & PCMCIA_UEVENT_INSERT)
641 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) &&
642 !(skt->state & SOCKET_CARDBUS)) {
644 ret = skt->callback->suspend(skt);
652 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
653 !(skt->state & SOCKET_CARDBUS)) {
654 ret = socket_resume(skt);
655 if (!ret && skt->callback)
656 skt->callback->resume(skt);
658 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
659 !(skt->state & SOCKET_CARDBUS)) {
660 if (!ret && skt->callback)
661 skt->callback->requery(skt);
664 mutex_unlock(&skt->skt_mutex);
666 if (events || sysfs_events)
669 set_current_state(TASK_INTERRUPTIBLE);
670 if (kthread_should_stop())
677 /* make sure we are running before we exit */
678 __set_current_state(TASK_RUNNING);
680 /* shut down socket, if a device is still present */
681 if (skt->state & SOCKET_PRESENT) {
682 mutex_lock(&skt->skt_mutex);
684 mutex_unlock(&skt->skt_mutex);
687 /* remove from the device core */
688 pccard_sysfs_remove_socket(&skt->dev);
689 device_unregister(&skt->dev);
695 * Yenta (at least) probes interrupts before registering the socket and
696 * starting the handler thread.
698 void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
701 dev_dbg(&s->dev, "parse_events: events %08x\n", events);
703 spin_lock_irqsave(&s->thread_lock, flags);
704 s->thread_events |= events;
705 spin_unlock_irqrestore(&s->thread_lock, flags);
707 wake_up_process(s->thread);
709 } /* pcmcia_parse_events */
710 EXPORT_SYMBOL(pcmcia_parse_events);
713 * pcmcia_parse_uevents() - tell pccardd to issue manual commands
714 * @s: the PCMCIA socket we wan't to command
715 * @events: events to pass to pccardd
717 * userspace-issued insert, eject, suspend and resume commands must be
718 * handled by pccardd to avoid any sysfs-related deadlocks. Valid events
719 * are PCMCIA_UEVENT_EJECT (for eject), PCMCIA_UEVENT__INSERT (for insert),
720 * PCMCIA_UEVENT_RESUME (for resume), PCMCIA_UEVENT_SUSPEND (for suspend)
721 * and PCMCIA_UEVENT_REQUERY (for re-querying the PCMCIA card).
723 void pcmcia_parse_uevents(struct pcmcia_socket *s, u_int events)
726 dev_dbg(&s->dev, "parse_uevents: events %08x\n", events);
728 spin_lock_irqsave(&s->thread_lock, flags);
729 s->sysfs_events |= events;
730 spin_unlock_irqrestore(&s->thread_lock, flags);
732 wake_up_process(s->thread);
735 EXPORT_SYMBOL(pcmcia_parse_uevents);
738 /* register pcmcia_callback */
739 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
743 /* s->skt_mutex also protects s->callback */
744 mutex_lock(&s->skt_mutex);
755 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
760 mutex_unlock(&s->skt_mutex);
764 EXPORT_SYMBOL(pccard_register_pcmcia);
767 /* I'm not sure which "reset" function this is supposed to use,
768 * but for now, it uses the low-level interface's reset, not the
772 int pcmcia_reset_card(struct pcmcia_socket *skt)
776 dev_dbg(&skt->dev, "resetting socket\n");
778 mutex_lock(&skt->skt_mutex);
780 if (!(skt->state & SOCKET_PRESENT)) {
781 dev_dbg(&skt->dev, "can't reset, not present\n");
785 if (skt->state & SOCKET_SUSPEND) {
786 dev_dbg(&skt->dev, "can't reset, suspended\n");
790 if (skt->state & SOCKET_CARDBUS) {
791 dev_dbg(&skt->dev, "can't reset, is cardbus\n");
797 skt->callback->suspend(skt);
798 mutex_lock(&skt->ops_mutex);
799 ret = socket_reset(skt);
800 mutex_unlock(&skt->ops_mutex);
801 if ((ret == 0) && (skt->callback))
802 skt->callback->resume(skt);
806 mutex_unlock(&skt->skt_mutex);
810 EXPORT_SYMBOL(pcmcia_reset_card);
813 static int pcmcia_socket_uevent(const struct device *dev,
814 struct kobj_uevent_env *env)
816 const struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
818 if (add_uevent_var(env, "SOCKET_NO=%u", s->sock))
825 static struct completion pcmcia_unload;
827 static void pcmcia_release_socket_class(const struct class *data)
829 complete(&pcmcia_unload);
835 static int __pcmcia_pm_op(struct device *dev,
836 int (*callback) (struct pcmcia_socket *skt))
838 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
841 mutex_lock(&s->skt_mutex);
843 mutex_unlock(&s->skt_mutex);
848 static int pcmcia_socket_dev_suspend_noirq(struct device *dev)
850 return __pcmcia_pm_op(dev, socket_suspend);
853 static int pcmcia_socket_dev_resume_noirq(struct device *dev)
855 return __pcmcia_pm_op(dev, socket_early_resume);
858 static int __used pcmcia_socket_dev_resume(struct device *dev)
860 return __pcmcia_pm_op(dev, socket_late_resume);
863 static void __used pcmcia_socket_dev_complete(struct device *dev)
865 WARN(__pcmcia_pm_op(dev, socket_complete_resume),
866 "failed to complete resume");
869 static const struct dev_pm_ops pcmcia_socket_pm_ops = {
870 /* dev_resume may be called with IRQs enabled */
871 SET_SYSTEM_SLEEP_PM_OPS(NULL,
872 pcmcia_socket_dev_resume)
874 /* late suspend must be called with IRQs disabled */
875 .suspend_noirq = pcmcia_socket_dev_suspend_noirq,
876 .freeze_noirq = pcmcia_socket_dev_suspend_noirq,
877 .poweroff_noirq = pcmcia_socket_dev_suspend_noirq,
879 /* early resume must be called with IRQs disabled */
880 .resume_noirq = pcmcia_socket_dev_resume_noirq,
881 .thaw_noirq = pcmcia_socket_dev_resume_noirq,
882 .restore_noirq = pcmcia_socket_dev_resume_noirq,
883 .complete = pcmcia_socket_dev_complete,
886 #define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops)
888 #else /* CONFIG_PM */
890 #define PCMCIA_SOCKET_CLASS_PM_OPS NULL
892 #endif /* CONFIG_PM */
894 struct class pcmcia_socket_class = {
895 .name = "pcmcia_socket",
896 .dev_uevent = pcmcia_socket_uevent,
897 .dev_release = pcmcia_release_socket,
898 .class_release = pcmcia_release_socket_class,
899 .pm = PCMCIA_SOCKET_CLASS_PM_OPS,
901 EXPORT_SYMBOL(pcmcia_socket_class);
904 static int __init init_pcmcia_cs(void)
906 init_completion(&pcmcia_unload);
907 return class_register(&pcmcia_socket_class);
910 static void __exit exit_pcmcia_cs(void)
912 class_unregister(&pcmcia_socket_class);
913 wait_for_completion(&pcmcia_unload);
916 subsys_initcall(init_pcmcia_cs);
917 module_exit(exit_pcmcia_cs);