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 <asm/system.h>
34 #define IN_CARD_SERVICES
35 #include <pcmcia/cs_types.h>
36 #include <pcmcia/ss.h>
37 #include <pcmcia/cs.h>
38 #include <pcmcia/bulkmem.h>
39 #include <pcmcia/cistpl.h>
40 #include <pcmcia/cisreg.h>
41 #include <pcmcia/ds.h>
42 #include "cs_internal.h"
45 /* Module parameters */
47 MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
48 MODULE_DESCRIPTION("Linux Kernel Card Services");
49 MODULE_LICENSE("GPL");
51 #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
53 INT_MODULE_PARM(setup_delay, 10); /* centiseconds */
54 INT_MODULE_PARM(resume_delay, 20); /* centiseconds */
55 INT_MODULE_PARM(shutdown_delay, 3); /* centiseconds */
56 INT_MODULE_PARM(vcc_settle, 40); /* centiseconds */
57 INT_MODULE_PARM(reset_time, 10); /* usecs */
58 INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */
59 INT_MODULE_PARM(unreset_check, 10); /* centiseconds */
60 INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
62 /* Access speed for attribute memory windows */
63 INT_MODULE_PARM(cis_speed, 300); /* ns */
68 module_param(pc_debug, int, 0644);
70 int cs_debug_level(int level)
72 return pc_debug > level;
77 socket_state_t dead_socket = {
78 .csc_mask = SS_DETECT,
80 EXPORT_SYMBOL(dead_socket);
83 /* List of all sockets, protected by a rwsem */
84 LIST_HEAD(pcmcia_socket_list);
85 EXPORT_SYMBOL(pcmcia_socket_list);
87 DECLARE_RWSEM(pcmcia_socket_list_rwsem);
88 EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
92 * Low-level PCMCIA socket drivers need to register with the PCCard
93 * core using pcmcia_register_socket.
95 * socket drivers are expected to use the following callbacks in their
97 * - pcmcia_socket_dev_suspend
98 * - pcmcia_socket_dev_resume
99 * These functions check for the appropriate struct pcmcia_soket arrays,
100 * and pass them to the low-level functions pcmcia_{suspend,resume}_socket
102 static int socket_resume(struct pcmcia_socket *skt);
103 static int socket_suspend(struct pcmcia_socket *skt);
105 int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state)
107 struct pcmcia_socket *socket;
109 down_read(&pcmcia_socket_list_rwsem);
110 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
111 if (socket->dev.dev != dev)
113 mutex_lock(&socket->skt_mutex);
114 socket_suspend(socket);
115 mutex_unlock(&socket->skt_mutex);
117 up_read(&pcmcia_socket_list_rwsem);
121 EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
123 int pcmcia_socket_dev_resume(struct device *dev)
125 struct pcmcia_socket *socket;
127 down_read(&pcmcia_socket_list_rwsem);
128 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
129 if (socket->dev.dev != dev)
131 mutex_lock(&socket->skt_mutex);
132 socket_resume(socket);
133 mutex_unlock(&socket->skt_mutex);
135 up_read(&pcmcia_socket_list_rwsem);
139 EXPORT_SYMBOL(pcmcia_socket_dev_resume);
142 struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt)
144 struct class_device *cl_dev = class_device_get(&skt->dev);
147 skt = class_get_devdata(cl_dev);
148 if (!try_module_get(skt->owner)) {
149 class_device_put(&skt->dev);
154 EXPORT_SYMBOL(pcmcia_get_socket);
157 void pcmcia_put_socket(struct pcmcia_socket *skt)
159 module_put(skt->owner);
160 class_device_put(&skt->dev);
162 EXPORT_SYMBOL(pcmcia_put_socket);
165 static void pcmcia_release_socket(struct class_device *class_dev)
167 struct pcmcia_socket *socket = class_get_devdata(class_dev);
169 complete(&socket->socket_released);
172 static int pccardd(void *__skt);
175 * pcmcia_register_socket - add a new pcmcia socket device
177 int pcmcia_register_socket(struct pcmcia_socket *socket)
181 if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops)
184 cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops);
186 spin_lock_init(&socket->lock);
188 if (socket->resource_ops->init) {
189 ret = socket->resource_ops->init(socket);
194 /* try to obtain a socket number [yes, it gets ugly if we
195 * register more than 2^sizeof(unsigned int) pcmcia
196 * sockets... but the socket number is deprecated
197 * anyways, so I don't care] */
198 down_write(&pcmcia_socket_list_rwsem);
199 if (list_empty(&pcmcia_socket_list))
202 unsigned int found, i = 1;
203 struct pcmcia_socket *tmp;
206 list_for_each_entry(tmp, &pcmcia_socket_list, socket_list) {
212 socket->sock = i - 1;
214 list_add_tail(&socket->socket_list, &pcmcia_socket_list);
215 up_write(&pcmcia_socket_list_rwsem);
217 #ifndef CONFIG_CARDBUS
219 * If we do not support Cardbus, ensure that
220 * the Cardbus socket capability is disabled.
222 socket->features &= ~SS_CAP_CARDBUS;
225 /* set proper values in socket->dev */
226 socket->dev.class_data = socket;
227 socket->dev.class = &pcmcia_socket_class;
228 snprintf(socket->dev.class_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock);
230 /* base address = 0, map = 0 */
231 socket->cis_mem.flags = 0;
232 socket->cis_mem.speed = cis_speed;
234 INIT_LIST_HEAD(&socket->cis_cache);
236 init_completion(&socket->socket_released);
237 init_completion(&socket->thread_done);
238 init_waitqueue_head(&socket->thread_wait);
239 mutex_init(&socket->skt_mutex);
240 spin_lock_init(&socket->thread_lock);
242 ret = kernel_thread(pccardd, socket, CLONE_KERNEL);
246 wait_for_completion(&socket->thread_done);
247 if(!socket->thread) {
248 printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket);
251 pcmcia_parse_events(socket, SS_DETECT);
256 down_write(&pcmcia_socket_list_rwsem);
257 list_del(&socket->socket_list);
258 up_write(&pcmcia_socket_list_rwsem);
260 } /* pcmcia_register_socket */
261 EXPORT_SYMBOL(pcmcia_register_socket);
265 * pcmcia_unregister_socket - remove a pcmcia socket device
267 void pcmcia_unregister_socket(struct pcmcia_socket *socket)
272 cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
274 if (socket->thread) {
275 init_completion(&socket->thread_done);
276 socket->thread = NULL;
277 wake_up(&socket->thread_wait);
278 wait_for_completion(&socket->thread_done);
280 release_cis_mem(socket);
282 /* remove from our own list */
283 down_write(&pcmcia_socket_list_rwsem);
284 list_del(&socket->socket_list);
285 up_write(&pcmcia_socket_list_rwsem);
287 /* wait for sysfs to drop all references */
288 release_resource_db(socket);
289 wait_for_completion(&socket->socket_released);
290 } /* pcmcia_unregister_socket */
291 EXPORT_SYMBOL(pcmcia_unregister_socket);
294 struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr)
296 struct pcmcia_socket *s;
298 down_read(&pcmcia_socket_list_rwsem);
299 list_for_each_entry(s, &pcmcia_socket_list, socket_list)
301 up_read(&pcmcia_socket_list_rwsem);
304 up_read(&pcmcia_socket_list_rwsem);
309 EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
312 * The central event handler. Send_event() sends an event to the
313 * 16-bit subsystem, which then calls the relevant device drivers.
314 * Parse_events() interprets the event bits from
315 * a card status change report. Do_shutdown() handles the high
316 * priority stuff associated with a card removal.
319 /* NOTE: send_event needs to be called with skt->sem held. */
321 static int send_event(struct pcmcia_socket *s, event_t event, int priority)
325 if (s->state & SOCKET_CARDBUS)
328 cs_dbg(s, 1, "send_event(event %d, pri %d, callback 0x%p)\n",
329 event, priority, s->callback);
333 if (!try_module_get(s->callback->owner))
336 ret = s->callback->event(s, event, priority);
338 module_put(s->callback->owner);
343 static void socket_remove_drivers(struct pcmcia_socket *skt)
345 cs_dbg(skt, 4, "remove_drivers\n");
347 send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
350 static int socket_reset(struct pcmcia_socket *skt)
354 cs_dbg(skt, 4, "reset\n");
356 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET;
357 skt->ops->set_socket(skt, &skt->socket);
358 udelay((long)reset_time);
360 skt->socket.flags &= ~SS_RESET;
361 skt->ops->set_socket(skt, &skt->socket);
363 msleep(unreset_delay * 10);
364 for (i = 0; i < unreset_limit; i++) {
365 skt->ops->get_status(skt, &status);
367 if (!(status & SS_DETECT))
370 if (status & SS_READY)
373 msleep(unreset_check * 10);
376 cs_err(skt, "time out after reset.\n");
377 return CS_GENERAL_FAILURE;
381 * socket_setup() and socket_shutdown() are called by the main event handler
382 * when card insertion and removal events are received.
383 * socket_setup() turns on socket power and resets the socket, in two stages.
384 * socket_shutdown() unconfigures a socket and turns off socket power.
386 static void socket_shutdown(struct pcmcia_socket *s)
390 cs_dbg(s, 4, "shutdown\n");
392 socket_remove_drivers(s);
393 s->state &= SOCKET_INUSE | SOCKET_PRESENT;
394 msleep(shutdown_delay * 10);
395 s->state &= SOCKET_INUSE;
397 /* Blank out the socket state */
398 s->socket = dead_socket;
400 s->ops->set_socket(s, &s->socket);
401 s->irq.AssignedIRQ = s->irq.Config = 0;
403 destroy_cis_cache(s);
404 #ifdef CONFIG_CARDBUS
409 s->ops->get_status(s, &status);
410 if (status & SS_POWERON) {
411 printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s);
417 static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
421 cs_dbg(skt, 4, "setup\n");
423 skt->ops->get_status(skt, &status);
424 if (!(status & SS_DETECT))
427 msleep(initial_delay * 10);
429 for (i = 0; i < 100; i++) {
430 skt->ops->get_status(skt, &status);
431 if (!(status & SS_DETECT))
434 if (!(status & SS_PENDING))
440 if (status & SS_PENDING) {
441 cs_err(skt, "voltage interrogation timed out.\n");
442 return CS_GENERAL_FAILURE;
445 if (status & SS_CARDBUS) {
446 if (!(skt->features & SS_CAP_CARDBUS)) {
447 cs_err(skt, "cardbus cards are not supported.\n");
450 skt->state |= SOCKET_CARDBUS;
454 * Decode the card voltage requirements, and apply power to the card.
456 if (status & SS_3VCARD)
457 skt->socket.Vcc = skt->socket.Vpp = 33;
458 else if (!(status & SS_XVCARD))
459 skt->socket.Vcc = skt->socket.Vpp = 50;
461 cs_err(skt, "unsupported voltage key.\n");
466 skt->power_hook(skt, HOOK_POWER_PRE);
468 skt->socket.flags = 0;
469 skt->ops->set_socket(skt, &skt->socket);
472 * Wait "vcc_settle" for the supply to stabilise.
474 msleep(vcc_settle * 10);
476 skt->ops->get_status(skt, &status);
477 if (!(status & SS_POWERON)) {
478 cs_err(skt, "unable to apply power.\n");
482 status = socket_reset(skt);
485 skt->power_hook(skt, HOOK_POWER_POST);
491 * Handle card insertion. Setup the socket, reset the card,
492 * and then tell the rest of PCMCIA that a card is present.
494 static int socket_insert(struct pcmcia_socket *skt)
498 cs_dbg(skt, 4, "insert\n");
500 if (!cs_socket_get(skt))
503 ret = socket_setup(skt, setup_delay);
504 if (ret == CS_SUCCESS) {
505 skt->state |= SOCKET_PRESENT;
507 printk(KERN_NOTICE "pccard: %s card inserted into slot %d\n",
508 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
511 #ifdef CONFIG_CARDBUS
512 if (skt->state & SOCKET_CARDBUS) {
514 skt->state |= SOCKET_CARDBUS_CONFIG;
517 cs_dbg(skt, 4, "insert done\n");
519 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
521 socket_shutdown(skt);
527 static int socket_suspend(struct pcmcia_socket *skt)
529 if (skt->state & SOCKET_SUSPEND)
532 send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
533 skt->socket = dead_socket;
534 skt->ops->set_socket(skt, &skt->socket);
535 if (skt->ops->suspend)
536 skt->ops->suspend(skt);
537 skt->state |= SOCKET_SUSPEND;
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)
551 if (!(skt->state & SOCKET_SUSPEND))
554 skt->socket = dead_socket;
556 skt->ops->set_socket(skt, &skt->socket);
558 if (!(skt->state & SOCKET_PRESENT)) {
559 skt->state &= ~SOCKET_SUSPEND;
560 return socket_insert(skt);
563 ret = socket_setup(skt, resume_delay);
564 if (ret == CS_SUCCESS) {
566 * FIXME: need a better check here for cardbus cards.
568 if (verify_cis_cache(skt) != 0) {
569 cs_dbg(skt, 4, "cis mismatch - different card\n");
570 socket_remove_drivers(skt);
571 destroy_cis_cache(skt);
573 * Workaround: give DS time to schedule removal.
574 * Remove me once the 100ms delay is eliminated
578 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
580 cs_dbg(skt, 4, "cis matches cache\n");
581 send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
584 socket_shutdown(skt);
587 skt->state &= ~SOCKET_SUSPEND;
592 static void socket_remove(struct pcmcia_socket *skt)
594 printk(KERN_NOTICE "pccard: card ejected from slot %d\n", skt->sock);
595 socket_shutdown(skt);
599 * Process a socket card detect status change.
601 * If we don't have a card already present, delay the detect event for
602 * about 20ms (to be on the safe side) before reading the socket status.
604 * Some i82365-based systems send multiple SS_DETECT events during card
605 * insertion, and the "card present" status bit seems to bounce. This
606 * will probably be true with GPIO-based card detection systems after
607 * the product has aged.
609 static void socket_detect_change(struct pcmcia_socket *skt)
611 if (!(skt->state & SOCKET_SUSPEND)) {
614 if (!(skt->state & SOCKET_PRESENT))
617 skt->ops->get_status(skt, &status);
618 if ((skt->state & SOCKET_PRESENT) &&
619 !(status & SS_DETECT))
621 if (!(skt->state & SOCKET_PRESENT) &&
622 (status & SS_DETECT))
627 static int pccardd(void *__skt)
629 struct pcmcia_socket *skt = __skt;
630 DECLARE_WAITQUEUE(wait, current);
633 daemonize("pccardd");
635 skt->thread = current;
636 skt->socket = dead_socket;
638 skt->ops->set_socket(skt, &skt->socket);
640 /* register with the device core */
641 ret = class_device_register(&skt->dev);
643 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n",
646 complete_and_exit(&skt->thread_done, 0);
649 add_wait_queue(&skt->thread_wait, &wait);
650 complete(&skt->thread_done);
656 set_current_state(TASK_INTERRUPTIBLE);
658 spin_lock_irqsave(&skt->thread_lock, flags);
659 events = skt->thread_events;
660 skt->thread_events = 0;
661 spin_unlock_irqrestore(&skt->thread_lock, flags);
664 mutex_lock(&skt->skt_mutex);
665 if (events & SS_DETECT)
666 socket_detect_change(skt);
667 if (events & SS_BATDEAD)
668 send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW);
669 if (events & SS_BATWARN)
670 send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW);
671 if (events & SS_READY)
672 send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW);
673 mutex_unlock(&skt->skt_mutex);
683 /* make sure we are running before we exit */
684 set_current_state(TASK_RUNNING);
686 remove_wait_queue(&skt->thread_wait, &wait);
688 /* remove from the device core */
689 class_device_unregister(&skt->dev);
691 complete_and_exit(&skt->thread_done, 0);
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)
700 cs_dbg(s, 4, "parse_events: events %08x\n", events);
702 spin_lock(&s->thread_lock);
703 s->thread_events |= events;
704 spin_unlock(&s->thread_lock);
706 wake_up(&s->thread_wait);
708 } /* pcmcia_parse_events */
709 EXPORT_SYMBOL(pcmcia_parse_events);
712 /* register pcmcia_callback */
713 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
717 /* s->skt_mutex also protects s->callback */
718 mutex_lock(&s->skt_mutex);
729 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
730 send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
734 mutex_unlock(&s->skt_mutex);
738 EXPORT_SYMBOL(pccard_register_pcmcia);
741 /* I'm not sure which "reset" function this is supposed to use,
742 * but for now, it uses the low-level interface's reset, not the
746 int pccard_reset_card(struct pcmcia_socket *skt)
750 cs_dbg(skt, 1, "resetting socket\n");
752 mutex_lock(&skt->skt_mutex);
754 if (!(skt->state & SOCKET_PRESENT)) {
758 if (skt->state & SOCKET_SUSPEND) {
762 if (skt->state & SOCKET_CARDBUS) {
763 ret = CS_UNSUPPORTED_FUNCTION;
767 ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW);
769 send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW);
771 skt->callback->suspend(skt);
772 if (socket_reset(skt) == CS_SUCCESS) {
773 send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW);
775 skt->callback->resume(skt);
781 mutex_unlock(&skt->skt_mutex);
785 EXPORT_SYMBOL(pccard_reset_card);
788 /* These shut down or wake up a socket. They are sort of user
789 * initiated versions of the APM suspend and resume actions.
791 int pcmcia_suspend_card(struct pcmcia_socket *skt)
795 cs_dbg(skt, 1, "suspending socket\n");
797 mutex_lock(&skt->skt_mutex);
799 if (!(skt->state & SOCKET_PRESENT)) {
803 if (skt->state & SOCKET_CARDBUS) {
804 ret = CS_UNSUPPORTED_FUNCTION;
808 ret = skt->callback->suspend(skt);
812 ret = socket_suspend(skt);
814 mutex_unlock(&skt->skt_mutex);
818 EXPORT_SYMBOL(pcmcia_suspend_card);
821 int pcmcia_resume_card(struct pcmcia_socket *skt)
825 cs_dbg(skt, 1, "waking up socket\n");
827 mutex_lock(&skt->skt_mutex);
829 if (!(skt->state & SOCKET_PRESENT)) {
833 if (skt->state & SOCKET_CARDBUS) {
834 ret = CS_UNSUPPORTED_FUNCTION;
837 ret = socket_resume(skt);
838 if (!ret && skt->callback)
839 skt->callback->resume(skt);
841 mutex_unlock(&skt->skt_mutex);
845 EXPORT_SYMBOL(pcmcia_resume_card);
848 /* These handle user requests to eject or insert a card. */
849 int pcmcia_eject_card(struct pcmcia_socket *skt)
853 cs_dbg(skt, 1, "user eject request\n");
855 mutex_lock(&skt->skt_mutex);
857 if (!(skt->state & SOCKET_PRESENT)) {
862 ret = send_event(skt, CS_EVENT_EJECTION_REQUEST, CS_EVENT_PRI_LOW);
871 mutex_unlock(&skt->skt_mutex);
875 EXPORT_SYMBOL(pcmcia_eject_card);
878 int pcmcia_insert_card(struct pcmcia_socket *skt)
882 cs_dbg(skt, 1, "user insert request\n");
884 mutex_lock(&skt->skt_mutex);
886 if (skt->state & SOCKET_PRESENT) {
890 if (socket_insert(skt) == CS_NO_CARD) {
896 mutex_unlock(&skt->skt_mutex);
900 EXPORT_SYMBOL(pcmcia_insert_card);
903 static int pcmcia_socket_uevent(struct class_device *dev, char **envp,
904 int num_envp, char *buffer, int buffer_size)
906 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
907 int i = 0, length = 0;
909 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
910 &length, "SOCKET_NO=%u", s->sock))
919 static struct completion pcmcia_unload;
921 static void pcmcia_release_socket_class(struct class *data)
923 complete(&pcmcia_unload);
927 struct class pcmcia_socket_class = {
928 .name = "pcmcia_socket",
929 .uevent = pcmcia_socket_uevent,
930 .release = pcmcia_release_socket,
931 .class_release = pcmcia_release_socket_class,
933 EXPORT_SYMBOL(pcmcia_socket_class);
936 static int __init init_pcmcia_cs(void)
940 init_completion(&pcmcia_unload);
941 ret = class_register(&pcmcia_socket_class);
944 return class_interface_register(&pccard_sysfs_interface);
947 static void __exit exit_pcmcia_cs(void)
949 class_interface_unregister(&pccard_sysfs_interface);
950 class_unregister(&pcmcia_socket_class);
952 wait_for_completion(&pcmcia_unload);
955 subsys_initcall(init_pcmcia_cs);
956 module_exit(exit_pcmcia_cs);