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/device.h>
30 #include <linux/kthread.h>
31 #include <linux/freezer.h>
34 #include <pcmcia/ss.h>
35 #include <pcmcia/cistpl.h>
36 #include <pcmcia/cisreg.h>
37 #include <pcmcia/ds.h>
38 #include "cs_internal.h"
41 /* Module parameters */
43 MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
44 MODULE_DESCRIPTION("Linux Kernel Card Services");
45 MODULE_LICENSE("GPL");
47 #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
49 INT_MODULE_PARM(setup_delay, 10); /* centiseconds */
50 INT_MODULE_PARM(resume_delay, 20); /* centiseconds */
51 INT_MODULE_PARM(shutdown_delay, 3); /* centiseconds */
52 INT_MODULE_PARM(vcc_settle, 40); /* centiseconds */
53 INT_MODULE_PARM(reset_time, 10); /* usecs */
54 INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */
55 INT_MODULE_PARM(unreset_check, 10); /* centiseconds */
56 INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
58 /* Access speed for attribute memory windows */
59 INT_MODULE_PARM(cis_speed, 300); /* ns */
62 socket_state_t dead_socket = {
63 .csc_mask = SS_DETECT,
65 EXPORT_SYMBOL(dead_socket);
68 /* List of all sockets, protected by a rwsem */
69 LIST_HEAD(pcmcia_socket_list);
70 EXPORT_SYMBOL(pcmcia_socket_list);
72 DECLARE_RWSEM(pcmcia_socket_list_rwsem);
73 EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
76 struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
78 struct device *dev = get_device(&skt->dev);
81 return dev_get_drvdata(dev);
83 EXPORT_SYMBOL(pcmcia_get_socket);
86 void pcmcia_put_socket(struct pcmcia_socket *skt)
88 put_device(&skt->dev);
90 EXPORT_SYMBOL(pcmcia_put_socket);
93 static void pcmcia_release_socket(struct device *dev)
95 struct pcmcia_socket *socket = dev_get_drvdata(dev);
97 complete(&socket->socket_released);
100 static int pccardd(void *__skt);
103 * pcmcia_register_socket - add a new pcmcia socket device
104 * @socket: the &socket to register
106 int pcmcia_register_socket(struct pcmcia_socket *socket)
108 struct task_struct *tsk;
111 if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops)
114 dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops);
116 /* try to obtain a socket number [yes, it gets ugly if we
117 * register more than 2^sizeof(unsigned int) pcmcia
118 * sockets... but the socket number is deprecated
119 * anyways, so I don't care] */
120 down_write(&pcmcia_socket_list_rwsem);
121 if (list_empty(&pcmcia_socket_list))
124 unsigned int found, i = 1;
125 struct pcmcia_socket *tmp;
128 list_for_each_entry(tmp, &pcmcia_socket_list, socket_list) {
134 socket->sock = i - 1;
136 list_add_tail(&socket->socket_list, &pcmcia_socket_list);
137 up_write(&pcmcia_socket_list_rwsem);
139 #ifndef CONFIG_CARDBUS
141 * If we do not support Cardbus, ensure that
142 * the Cardbus socket capability is disabled.
144 socket->features &= ~SS_CAP_CARDBUS;
147 /* set proper values in socket->dev */
148 dev_set_drvdata(&socket->dev, socket);
149 socket->dev.class = &pcmcia_socket_class;
150 dev_set_name(&socket->dev, "pcmcia_socket%u", socket->sock);
152 /* base address = 0, map = 0 */
153 socket->cis_mem.flags = 0;
154 socket->cis_mem.speed = cis_speed;
156 INIT_LIST_HEAD(&socket->cis_cache);
158 init_completion(&socket->socket_released);
159 init_completion(&socket->thread_done);
160 mutex_init(&socket->skt_mutex);
161 mutex_init(&socket->ops_mutex);
162 spin_lock_init(&socket->thread_lock);
164 if (socket->resource_ops->init) {
165 mutex_lock(&socket->ops_mutex);
166 ret = socket->resource_ops->init(socket);
167 mutex_unlock(&socket->ops_mutex);
172 tsk = kthread_run(pccardd, socket, "pccardd");
178 wait_for_completion(&socket->thread_done);
179 if (!socket->thread) {
180 dev_warn(&socket->dev,
181 "PCMCIA: warning: socket thread did not start\n");
185 pcmcia_parse_events(socket, SS_DETECT);
188 * Let's try to get the PCMCIA module for 16-bit PCMCIA support.
189 * If it fails, it doesn't matter -- we still have 32-bit CardBus
190 * support to offer, so this is not a failure mode.
192 request_module_nowait("pcmcia");
197 down_write(&pcmcia_socket_list_rwsem);
198 list_del(&socket->socket_list);
199 up_write(&pcmcia_socket_list_rwsem);
201 } /* pcmcia_register_socket */
202 EXPORT_SYMBOL(pcmcia_register_socket);
206 * pcmcia_unregister_socket - remove a pcmcia socket device
207 * @socket: the &socket to unregister
209 void pcmcia_unregister_socket(struct pcmcia_socket *socket)
214 dev_dbg(&socket->dev, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
217 kthread_stop(socket->thread);
219 /* remove from our own list */
220 down_write(&pcmcia_socket_list_rwsem);
221 list_del(&socket->socket_list);
222 up_write(&pcmcia_socket_list_rwsem);
224 /* wait for sysfs to drop all references */
225 if (socket->resource_ops->exit) {
226 mutex_lock(&socket->ops_mutex);
227 socket->resource_ops->exit(socket);
228 mutex_unlock(&socket->ops_mutex);
230 wait_for_completion(&socket->socket_released);
231 } /* pcmcia_unregister_socket */
232 EXPORT_SYMBOL(pcmcia_unregister_socket);
235 struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr)
237 struct pcmcia_socket *s;
239 down_read(&pcmcia_socket_list_rwsem);
240 list_for_each_entry(s, &pcmcia_socket_list, socket_list)
242 up_read(&pcmcia_socket_list_rwsem);
245 up_read(&pcmcia_socket_list_rwsem);
250 EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
252 static int socket_reset(struct pcmcia_socket *skt)
256 dev_dbg(&skt->dev, "reset\n");
258 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET;
259 skt->ops->set_socket(skt, &skt->socket);
260 udelay((long)reset_time);
262 skt->socket.flags &= ~SS_RESET;
263 skt->ops->set_socket(skt, &skt->socket);
265 msleep(unreset_delay * 10);
266 for (i = 0; i < unreset_limit; i++) {
267 skt->ops->get_status(skt, &status);
269 if (!(status & SS_DETECT))
272 if (status & SS_READY)
275 msleep(unreset_check * 10);
278 dev_err(&skt->dev, "time out after reset\n");
283 * socket_setup() and socket_shutdown() are called by the main event handler
284 * when card insertion and removal events are received.
285 * socket_setup() turns on socket power and resets the socket, in two stages.
286 * socket_shutdown() unconfigures a socket and turns off socket power.
288 static void socket_shutdown(struct pcmcia_socket *s)
292 dev_dbg(&s->dev, "shutdown\n");
295 s->callback->remove(s);
297 mutex_lock(&s->ops_mutex);
298 s->state &= SOCKET_INUSE | SOCKET_PRESENT;
299 msleep(shutdown_delay * 10);
300 s->state &= SOCKET_INUSE;
302 /* Blank out the socket state */
303 s->socket = dead_socket;
305 s->ops->set_socket(s, &s->socket);
311 /* From here on we can be sure that only we (that is, the
312 * pccardd thread) accesses this socket, and all (16-bit)
313 * PCMCIA interactions are gone. Therefore, release
314 * ops_mutex so that we don't get a sysfs-related lockdep
317 mutex_unlock(&s->ops_mutex);
319 #ifdef CONFIG_CARDBUS
323 /* give socket some time to power down */
326 s->ops->get_status(s, &status);
327 if (status & SS_POWERON) {
329 "*** DANGER *** unable to remove socket power\n");
332 s->state &= ~SOCKET_INUSE;
335 static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
339 dev_dbg(&skt->dev, "setup\n");
341 skt->ops->get_status(skt, &status);
342 if (!(status & SS_DETECT))
345 msleep(initial_delay * 10);
347 for (i = 0; i < 100; i++) {
348 skt->ops->get_status(skt, &status);
349 if (!(status & SS_DETECT))
352 if (!(status & SS_PENDING))
358 if (status & SS_PENDING) {
359 dev_err(&skt->dev, "voltage interrogation timed out\n");
363 if (status & SS_CARDBUS) {
364 if (!(skt->features & SS_CAP_CARDBUS)) {
365 dev_err(&skt->dev, "cardbus cards are not supported\n");
368 skt->state |= SOCKET_CARDBUS;
370 skt->state &= ~SOCKET_CARDBUS;
373 * Decode the card voltage requirements, and apply power to the card.
375 if (status & SS_3VCARD)
376 skt->socket.Vcc = skt->socket.Vpp = 33;
377 else if (!(status & SS_XVCARD))
378 skt->socket.Vcc = skt->socket.Vpp = 50;
380 dev_err(&skt->dev, "unsupported voltage key\n");
385 skt->power_hook(skt, HOOK_POWER_PRE);
387 skt->socket.flags = 0;
388 skt->ops->set_socket(skt, &skt->socket);
391 * Wait "vcc_settle" for the supply to stabilise.
393 msleep(vcc_settle * 10);
395 skt->ops->get_status(skt, &status);
396 if (!(status & SS_POWERON)) {
397 dev_err(&skt->dev, "unable to apply power\n");
401 status = socket_reset(skt);
404 skt->power_hook(skt, HOOK_POWER_POST);
410 * Handle card insertion. Setup the socket, reset the card,
411 * and then tell the rest of PCMCIA that a card is present.
413 static int socket_insert(struct pcmcia_socket *skt)
417 dev_dbg(&skt->dev, "insert\n");
419 mutex_lock(&skt->ops_mutex);
420 if (skt->state & SOCKET_INUSE) {
421 mutex_unlock(&skt->ops_mutex);
424 skt->state |= SOCKET_INUSE;
426 ret = socket_setup(skt, setup_delay);
428 skt->state |= SOCKET_PRESENT;
430 dev_notice(&skt->dev, "pccard: %s card inserted into slot %d\n",
431 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
434 #ifdef CONFIG_CARDBUS
435 if (skt->state & SOCKET_CARDBUS) {
437 skt->state |= SOCKET_CARDBUS_CONFIG;
440 dev_dbg(&skt->dev, "insert done\n");
441 mutex_unlock(&skt->ops_mutex);
443 if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
444 skt->callback->add(skt);
446 mutex_unlock(&skt->ops_mutex);
447 socket_shutdown(skt);
453 static int socket_suspend(struct pcmcia_socket *skt)
455 if ((skt->state & SOCKET_SUSPEND) && !(skt->state & SOCKET_IN_RESUME))
458 mutex_lock(&skt->ops_mutex);
459 /* store state on first suspend, but not after spurious wakeups */
460 if (!(skt->state & SOCKET_IN_RESUME))
461 skt->suspended_state = skt->state;
463 skt->socket = dead_socket;
464 skt->ops->set_socket(skt, &skt->socket);
465 if (skt->ops->suspend)
466 skt->ops->suspend(skt);
467 skt->state |= SOCKET_SUSPEND;
468 skt->state &= ~SOCKET_IN_RESUME;
469 mutex_unlock(&skt->ops_mutex);
473 static int socket_early_resume(struct pcmcia_socket *skt)
475 mutex_lock(&skt->ops_mutex);
476 skt->socket = dead_socket;
478 skt->ops->set_socket(skt, &skt->socket);
479 if (skt->state & SOCKET_PRESENT)
480 skt->resume_status = socket_setup(skt, resume_delay);
481 skt->state |= SOCKET_IN_RESUME;
482 mutex_unlock(&skt->ops_mutex);
486 static int socket_late_resume(struct pcmcia_socket *skt)
490 mutex_lock(&skt->ops_mutex);
491 skt->state &= ~(SOCKET_SUSPEND | SOCKET_IN_RESUME);
492 mutex_unlock(&skt->ops_mutex);
494 if (!(skt->state & SOCKET_PRESENT)) {
495 ret = socket_insert(skt);
501 if (skt->resume_status) {
502 socket_shutdown(skt);
506 if (skt->suspended_state != skt->state) {
508 "suspend state 0x%x != resume state 0x%x\n",
509 skt->suspended_state, skt->state);
511 socket_shutdown(skt);
512 return socket_insert(skt);
515 if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
516 ret = skt->callback->early_resume(skt);
521 * Finalize the resume. In case of a cardbus socket, we have
522 * to rebind the devices as we can't be certain that it has been
525 static int socket_complete_resume(struct pcmcia_socket *skt)
528 #ifdef CONFIG_CARDBUS
529 if (skt->state & SOCKET_CARDBUS) {
530 /* We can't be sure the CardBus card is the same
531 * as the one previously inserted. Therefore, remove
543 * Resume a socket. If a card is present, verify its CIS against
544 * our cached copy. If they are different, the card has been
545 * replaced, and we need to tell the drivers.
547 static int socket_resume(struct pcmcia_socket *skt)
550 if (!(skt->state & SOCKET_SUSPEND))
553 socket_early_resume(skt);
554 err = socket_late_resume(skt);
556 err = socket_complete_resume(skt);
560 static void socket_remove(struct pcmcia_socket *skt)
562 dev_notice(&skt->dev, "pccard: card ejected from slot %d\n", skt->sock);
563 socket_shutdown(skt);
567 * Process a socket card detect status change.
569 * If we don't have a card already present, delay the detect event for
570 * about 20ms (to be on the safe side) before reading the socket status.
572 * Some i82365-based systems send multiple SS_DETECT events during card
573 * insertion, and the "card present" status bit seems to bounce. This
574 * will probably be true with GPIO-based card detection systems after
575 * the product has aged.
577 static void socket_detect_change(struct pcmcia_socket *skt)
579 if (!(skt->state & SOCKET_SUSPEND)) {
582 if (!(skt->state & SOCKET_PRESENT))
585 skt->ops->get_status(skt, &status);
586 if ((skt->state & SOCKET_PRESENT) &&
587 !(status & SS_DETECT))
589 if (!(skt->state & SOCKET_PRESENT) &&
590 (status & SS_DETECT))
595 static int pccardd(void *__skt)
597 struct pcmcia_socket *skt = __skt;
600 skt->thread = current;
601 skt->socket = dead_socket;
603 skt->ops->set_socket(skt, &skt->socket);
605 /* register with the device core */
606 ret = device_register(&skt->dev);
608 dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
610 complete(&skt->thread_done);
613 ret = pccard_sysfs_add_socket(&skt->dev);
615 dev_warn(&skt->dev, "err %d adding socket attributes\n", ret);
617 complete(&skt->thread_done);
619 /* wait for userspace to catch up */
626 unsigned int sysfs_events;
628 spin_lock_irqsave(&skt->thread_lock, flags);
629 events = skt->thread_events;
630 skt->thread_events = 0;
631 sysfs_events = skt->sysfs_events;
632 skt->sysfs_events = 0;
633 spin_unlock_irqrestore(&skt->thread_lock, flags);
635 mutex_lock(&skt->skt_mutex);
636 if (events & SS_DETECT)
637 socket_detect_change(skt);
640 if (sysfs_events & PCMCIA_UEVENT_EJECT)
642 if (sysfs_events & PCMCIA_UEVENT_INSERT)
644 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) &&
645 !(skt->state & SOCKET_CARDBUS)) {
647 ret = skt->callback->suspend(skt);
655 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
656 !(skt->state & SOCKET_CARDBUS)) {
657 ret = socket_resume(skt);
658 if (!ret && skt->callback)
659 skt->callback->resume(skt);
661 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
662 !(skt->state & SOCKET_CARDBUS)) {
663 if (!ret && skt->callback)
664 skt->callback->requery(skt);
667 mutex_unlock(&skt->skt_mutex);
669 if (events || sysfs_events)
672 if (kthread_should_stop())
675 set_current_state(TASK_INTERRUPTIBLE);
679 /* make sure we are running */
680 __set_current_state(TASK_RUNNING);
685 /* shut down socket, if a device is still present */
686 if (skt->state & SOCKET_PRESENT) {
687 mutex_lock(&skt->skt_mutex);
689 mutex_unlock(&skt->skt_mutex);
692 /* remove from the device core */
693 pccard_sysfs_remove_socket(&skt->dev);
694 device_unregister(&skt->dev);
700 * Yenta (at least) probes interrupts before registering the socket and
701 * starting the handler thread.
703 void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
706 dev_dbg(&s->dev, "parse_events: events %08x\n", events);
708 spin_lock_irqsave(&s->thread_lock, flags);
709 s->thread_events |= events;
710 spin_unlock_irqrestore(&s->thread_lock, flags);
712 wake_up_process(s->thread);
714 } /* pcmcia_parse_events */
715 EXPORT_SYMBOL(pcmcia_parse_events);
718 * pcmcia_parse_uevents() - tell pccardd to issue manual commands
719 * @s: the PCMCIA socket we wan't to command
720 * @events: events to pass to pccardd
722 * userspace-issued insert, eject, suspend and resume commands must be
723 * handled by pccardd to avoid any sysfs-related deadlocks. Valid events
724 * are PCMCIA_UEVENT_EJECT (for eject), PCMCIA_UEVENT__INSERT (for insert),
725 * PCMCIA_UEVENT_RESUME (for resume), PCMCIA_UEVENT_SUSPEND (for suspend)
726 * and PCMCIA_UEVENT_REQUERY (for re-querying the PCMCIA card).
728 void pcmcia_parse_uevents(struct pcmcia_socket *s, u_int events)
731 dev_dbg(&s->dev, "parse_uevents: events %08x\n", events);
733 spin_lock_irqsave(&s->thread_lock, flags);
734 s->sysfs_events |= events;
735 spin_unlock_irqrestore(&s->thread_lock, flags);
737 wake_up_process(s->thread);
740 EXPORT_SYMBOL(pcmcia_parse_uevents);
743 /* register pcmcia_callback */
744 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
748 /* s->skt_mutex also protects s->callback */
749 mutex_lock(&s->skt_mutex);
760 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
765 mutex_unlock(&s->skt_mutex);
769 EXPORT_SYMBOL(pccard_register_pcmcia);
772 /* I'm not sure which "reset" function this is supposed to use,
773 * but for now, it uses the low-level interface's reset, not the
777 int pcmcia_reset_card(struct pcmcia_socket *skt)
781 dev_dbg(&skt->dev, "resetting socket\n");
783 mutex_lock(&skt->skt_mutex);
785 if (!(skt->state & SOCKET_PRESENT)) {
786 dev_dbg(&skt->dev, "can't reset, not present\n");
790 if (skt->state & SOCKET_SUSPEND) {
791 dev_dbg(&skt->dev, "can't reset, suspended\n");
795 if (skt->state & SOCKET_CARDBUS) {
796 dev_dbg(&skt->dev, "can't reset, is cardbus\n");
802 skt->callback->suspend(skt);
803 mutex_lock(&skt->ops_mutex);
804 ret = socket_reset(skt);
805 mutex_unlock(&skt->ops_mutex);
806 if ((ret == 0) && (skt->callback))
807 skt->callback->resume(skt);
811 mutex_unlock(&skt->skt_mutex);
815 EXPORT_SYMBOL(pcmcia_reset_card);
818 static int pcmcia_socket_uevent(struct device *dev,
819 struct kobj_uevent_env *env)
821 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
823 if (add_uevent_var(env, "SOCKET_NO=%u", s->sock))
830 static struct completion pcmcia_unload;
832 static void pcmcia_release_socket_class(struct class *data)
834 complete(&pcmcia_unload);
840 static int __pcmcia_pm_op(struct device *dev,
841 int (*callback) (struct pcmcia_socket *skt))
843 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
846 mutex_lock(&s->skt_mutex);
848 mutex_unlock(&s->skt_mutex);
853 static int pcmcia_socket_dev_suspend_noirq(struct device *dev)
855 return __pcmcia_pm_op(dev, socket_suspend);
858 static int pcmcia_socket_dev_resume_noirq(struct device *dev)
860 return __pcmcia_pm_op(dev, socket_early_resume);
863 static int __used pcmcia_socket_dev_resume(struct device *dev)
865 return __pcmcia_pm_op(dev, socket_late_resume);
868 static void __used pcmcia_socket_dev_complete(struct device *dev)
870 WARN(__pcmcia_pm_op(dev, socket_complete_resume),
871 "failed to complete resume");
874 static const struct dev_pm_ops pcmcia_socket_pm_ops = {
875 /* dev_resume may be called with IRQs enabled */
876 SET_SYSTEM_SLEEP_PM_OPS(NULL,
877 pcmcia_socket_dev_resume)
879 /* late suspend must be called with IRQs disabled */
880 .suspend_noirq = pcmcia_socket_dev_suspend_noirq,
881 .freeze_noirq = pcmcia_socket_dev_suspend_noirq,
882 .poweroff_noirq = pcmcia_socket_dev_suspend_noirq,
884 /* early resume must be called with IRQs disabled */
885 .resume_noirq = pcmcia_socket_dev_resume_noirq,
886 .thaw_noirq = pcmcia_socket_dev_resume_noirq,
887 .restore_noirq = pcmcia_socket_dev_resume_noirq,
888 .complete = pcmcia_socket_dev_complete,
891 #define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops)
893 #else /* CONFIG_PM */
895 #define PCMCIA_SOCKET_CLASS_PM_OPS NULL
897 #endif /* CONFIG_PM */
899 struct class pcmcia_socket_class = {
900 .name = "pcmcia_socket",
901 .dev_uevent = pcmcia_socket_uevent,
902 .dev_release = pcmcia_release_socket,
903 .class_release = pcmcia_release_socket_class,
904 .pm = PCMCIA_SOCKET_CLASS_PM_OPS,
906 EXPORT_SYMBOL(pcmcia_socket_class);
909 static int __init init_pcmcia_cs(void)
911 init_completion(&pcmcia_unload);
912 return class_register(&pcmcia_socket_class);
915 static void __exit exit_pcmcia_cs(void)
917 class_unregister(&pcmcia_socket_class);
918 wait_for_completion(&pcmcia_unload);
921 subsys_initcall(init_pcmcia_cs);
922 module_exit(exit_pcmcia_cs);