18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * IPWireless 3G PCMCIA Network Driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Original code
68c2ecf20Sopenharmony_ci *   by Stephen Blackheath <stephen@blacksapphire.com>,
78c2ecf20Sopenharmony_ci *      Ben Martel <benm@symmetric.co.nz>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Copyrighted as follows:
108c2ecf20Sopenharmony_ci *   Copyright (C) 2004 by Symmetric Systems Ltd (NZ)
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Various driver changes and rewrites, port to new kernels
138c2ecf20Sopenharmony_ci *   Copyright (C) 2006-2007 Jiri Kosina
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * Misc code cleanups and updates
168c2ecf20Sopenharmony_ci *   Copyright (C) 2007 David Sterba
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include "hardware.h"
208c2ecf20Sopenharmony_ci#include "network.h"
218c2ecf20Sopenharmony_ci#include "main.h"
228c2ecf20Sopenharmony_ci#include "tty.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <linux/delay.h>
258c2ecf20Sopenharmony_ci#include <linux/init.h>
268c2ecf20Sopenharmony_ci#include <linux/io.h>
278c2ecf20Sopenharmony_ci#include <linux/kernel.h>
288c2ecf20Sopenharmony_ci#include <linux/module.h>
298c2ecf20Sopenharmony_ci#include <linux/sched.h>
308c2ecf20Sopenharmony_ci#include <linux/slab.h>
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#include <pcmcia/cisreg.h>
338c2ecf20Sopenharmony_ci#include <pcmcia/device_id.h>
348c2ecf20Sopenharmony_ci#include <pcmcia/ss.h>
358c2ecf20Sopenharmony_ci#include <pcmcia/ds.h>
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistatic const struct pcmcia_device_id ipw_ids[] = {
388c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100),
398c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0200),
408c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_NULL
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pcmcia, ipw_ids);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic void ipwireless_detach(struct pcmcia_device *link);
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*
478c2ecf20Sopenharmony_ci * Module params
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_ci/* Debug mode: more verbose, print sent/recv bytes */
508c2ecf20Sopenharmony_ciint ipwireless_debug;
518c2ecf20Sopenharmony_ciint ipwireless_loopback;
528c2ecf20Sopenharmony_ciint ipwireless_out_queue = 10;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cimodule_param_named(debug, ipwireless_debug, int, 0);
558c2ecf20Sopenharmony_cimodule_param_named(loopback, ipwireless_loopback, int, 0);
568c2ecf20Sopenharmony_cimodule_param_named(out_queue, ipwireless_out_queue, int, 0);
578c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug, "switch on debug messages [0]");
588c2ecf20Sopenharmony_ciMODULE_PARM_DESC(loopback,
598c2ecf20Sopenharmony_ci		"debug: enable ras_raw channel [0]");
608c2ecf20Sopenharmony_ciMODULE_PARM_DESC(out_queue, "debug: set size of outgoing PPP queue [10]");
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* Executes in process context. */
638c2ecf20Sopenharmony_cistatic void signalled_reboot_work(struct work_struct *work_reboot)
648c2ecf20Sopenharmony_ci{
658c2ecf20Sopenharmony_ci	struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev,
668c2ecf20Sopenharmony_ci			work_reboot);
678c2ecf20Sopenharmony_ci	struct pcmcia_device *link = ipw->link;
688c2ecf20Sopenharmony_ci	pcmcia_reset_card(link->socket);
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic void signalled_reboot_callback(void *callback_data)
728c2ecf20Sopenharmony_ci{
738c2ecf20Sopenharmony_ci	struct ipw_dev *ipw = (struct ipw_dev *) callback_data;
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	/* Delegate to process context. */
768c2ecf20Sopenharmony_ci	schedule_work(&ipw->work_reboot);
778c2ecf20Sopenharmony_ci}
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistatic int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data)
808c2ecf20Sopenharmony_ci{
818c2ecf20Sopenharmony_ci	struct ipw_dev *ipw = priv_data;
828c2ecf20Sopenharmony_ci	int ret;
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
858c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	/* 0x40 causes it to generate level mode interrupts. */
888c2ecf20Sopenharmony_ci	/* 0x04 enables IREQ pin. */
898c2ecf20Sopenharmony_ci	p_dev->config_index |= 0x44;
908c2ecf20Sopenharmony_ci	p_dev->io_lines = 16;
918c2ecf20Sopenharmony_ci	ret = pcmcia_request_io(p_dev);
928c2ecf20Sopenharmony_ci	if (ret)
938c2ecf20Sopenharmony_ci		return ret;
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	if (!request_region(p_dev->resource[0]->start,
968c2ecf20Sopenharmony_ci			    resource_size(p_dev->resource[0]),
978c2ecf20Sopenharmony_ci			    IPWIRELESS_PCCARD_NAME)) {
988c2ecf20Sopenharmony_ci		ret = -EBUSY;
998c2ecf20Sopenharmony_ci		goto exit;
1008c2ecf20Sopenharmony_ci	}
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci	p_dev->resource[2]->flags |=
1038c2ecf20Sopenharmony_ci		WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0);
1068c2ecf20Sopenharmony_ci	if (ret != 0)
1078c2ecf20Sopenharmony_ci		goto exit1;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci	ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr);
1108c2ecf20Sopenharmony_ci	if (ret != 0)
1118c2ecf20Sopenharmony_ci		goto exit1;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100;
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci	ipw->common_memory = ioremap(p_dev->resource[2]->start,
1168c2ecf20Sopenharmony_ci				resource_size(p_dev->resource[2]));
1178c2ecf20Sopenharmony_ci	if (!ipw->common_memory) {
1188c2ecf20Sopenharmony_ci		ret = -ENOMEM;
1198c2ecf20Sopenharmony_ci		goto exit1;
1208c2ecf20Sopenharmony_ci	}
1218c2ecf20Sopenharmony_ci	if (!request_mem_region(p_dev->resource[2]->start,
1228c2ecf20Sopenharmony_ci				resource_size(p_dev->resource[2]),
1238c2ecf20Sopenharmony_ci				IPWIRELESS_PCCARD_NAME)) {
1248c2ecf20Sopenharmony_ci		ret = -EBUSY;
1258c2ecf20Sopenharmony_ci		goto exit2;
1268c2ecf20Sopenharmony_ci	}
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM |
1298c2ecf20Sopenharmony_ci					WIN_ENABLE;
1308c2ecf20Sopenharmony_ci	p_dev->resource[3]->end = 0; /* this used to be 0x1000 */
1318c2ecf20Sopenharmony_ci	ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0);
1328c2ecf20Sopenharmony_ci	if (ret != 0)
1338c2ecf20Sopenharmony_ci		goto exit3;
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci	ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0);
1368c2ecf20Sopenharmony_ci	if (ret != 0)
1378c2ecf20Sopenharmony_ci		goto exit3;
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci	ipw->attr_memory = ioremap(p_dev->resource[3]->start,
1408c2ecf20Sopenharmony_ci				resource_size(p_dev->resource[3]));
1418c2ecf20Sopenharmony_ci	if (!ipw->attr_memory) {
1428c2ecf20Sopenharmony_ci		ret = -ENOMEM;
1438c2ecf20Sopenharmony_ci		goto exit3;
1448c2ecf20Sopenharmony_ci	}
1458c2ecf20Sopenharmony_ci	if (!request_mem_region(p_dev->resource[3]->start,
1468c2ecf20Sopenharmony_ci				resource_size(p_dev->resource[3]),
1478c2ecf20Sopenharmony_ci				IPWIRELESS_PCCARD_NAME)) {
1488c2ecf20Sopenharmony_ci		ret = -EBUSY;
1498c2ecf20Sopenharmony_ci		goto exit4;
1508c2ecf20Sopenharmony_ci	}
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	return 0;
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ciexit4:
1558c2ecf20Sopenharmony_ci	iounmap(ipw->attr_memory);
1568c2ecf20Sopenharmony_ciexit3:
1578c2ecf20Sopenharmony_ci	release_mem_region(p_dev->resource[2]->start,
1588c2ecf20Sopenharmony_ci			resource_size(p_dev->resource[2]));
1598c2ecf20Sopenharmony_ciexit2:
1608c2ecf20Sopenharmony_ci	iounmap(ipw->common_memory);
1618c2ecf20Sopenharmony_ciexit1:
1628c2ecf20Sopenharmony_ci	release_region(p_dev->resource[0]->start,
1638c2ecf20Sopenharmony_ci		       resource_size(p_dev->resource[0]));
1648c2ecf20Sopenharmony_ciexit:
1658c2ecf20Sopenharmony_ci	pcmcia_disable_device(p_dev);
1668c2ecf20Sopenharmony_ci	return ret;
1678c2ecf20Sopenharmony_ci}
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_cistatic int config_ipwireless(struct ipw_dev *ipw)
1708c2ecf20Sopenharmony_ci{
1718c2ecf20Sopenharmony_ci	struct pcmcia_device *link = ipw->link;
1728c2ecf20Sopenharmony_ci	int ret = 0;
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci	ipw->is_v2_card = 0;
1758c2ecf20Sopenharmony_ci	link->config_flags |= CONF_AUTO_SET_IO | CONF_AUTO_SET_IOMEM |
1768c2ecf20Sopenharmony_ci		CONF_ENABLE_IRQ;
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	ret = pcmcia_loop_config(link, ipwireless_probe, ipw);
1798c2ecf20Sopenharmony_ci	if (ret != 0)
1808c2ecf20Sopenharmony_ci		return ret;
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	INIT_WORK(&ipw->work_reboot, signalled_reboot_work);
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci	ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start,
1858c2ecf20Sopenharmony_ci				    ipw->attr_memory, ipw->common_memory,
1868c2ecf20Sopenharmony_ci				    ipw->is_v2_card, signalled_reboot_callback,
1878c2ecf20Sopenharmony_ci				    ipw);
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	ret = pcmcia_request_irq(link, ipwireless_interrupt);
1908c2ecf20Sopenharmony_ci	if (ret != 0)
1918c2ecf20Sopenharmony_ci		goto exit;
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n",
1948c2ecf20Sopenharmony_ci			ipw->is_v2_card ? "V2/V3" : "V1");
1958c2ecf20Sopenharmony_ci	printk(KERN_INFO IPWIRELESS_PCCARD_NAME
1968c2ecf20Sopenharmony_ci		": I/O ports %pR, irq %d\n", link->resource[0],
1978c2ecf20Sopenharmony_ci			(unsigned int) link->irq);
1988c2ecf20Sopenharmony_ci	if (ipw->attr_memory && ipw->common_memory)
1998c2ecf20Sopenharmony_ci		printk(KERN_INFO IPWIRELESS_PCCARD_NAME
2008c2ecf20Sopenharmony_ci			": attr memory %pR, common memory %pR\n",
2018c2ecf20Sopenharmony_ci			link->resource[3],
2028c2ecf20Sopenharmony_ci			link->resource[2]);
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci	ipw->network = ipwireless_network_create(ipw->hardware);
2058c2ecf20Sopenharmony_ci	if (!ipw->network)
2068c2ecf20Sopenharmony_ci		goto exit;
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci	ipw->tty = ipwireless_tty_create(ipw->hardware, ipw->network);
2098c2ecf20Sopenharmony_ci	if (!ipw->tty)
2108c2ecf20Sopenharmony_ci		goto exit;
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci	ipwireless_init_hardware_v2_v3(ipw->hardware);
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci	/*
2158c2ecf20Sopenharmony_ci	 * Do the RequestConfiguration last, because it enables interrupts.
2168c2ecf20Sopenharmony_ci	 * Then we don't get any interrupts before we're ready for them.
2178c2ecf20Sopenharmony_ci	 */
2188c2ecf20Sopenharmony_ci	ret = pcmcia_enable_device(link);
2198c2ecf20Sopenharmony_ci	if (ret != 0)
2208c2ecf20Sopenharmony_ci		goto exit;
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	return 0;
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ciexit:
2258c2ecf20Sopenharmony_ci	if (ipw->common_memory) {
2268c2ecf20Sopenharmony_ci		release_mem_region(link->resource[2]->start,
2278c2ecf20Sopenharmony_ci				resource_size(link->resource[2]));
2288c2ecf20Sopenharmony_ci		iounmap(ipw->common_memory);
2298c2ecf20Sopenharmony_ci	}
2308c2ecf20Sopenharmony_ci	if (ipw->attr_memory) {
2318c2ecf20Sopenharmony_ci		release_mem_region(link->resource[3]->start,
2328c2ecf20Sopenharmony_ci				resource_size(link->resource[3]));
2338c2ecf20Sopenharmony_ci		iounmap(ipw->attr_memory);
2348c2ecf20Sopenharmony_ci	}
2358c2ecf20Sopenharmony_ci	pcmcia_disable_device(link);
2368c2ecf20Sopenharmony_ci	return -1;
2378c2ecf20Sopenharmony_ci}
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistatic void release_ipwireless(struct ipw_dev *ipw)
2408c2ecf20Sopenharmony_ci{
2418c2ecf20Sopenharmony_ci	release_region(ipw->link->resource[0]->start,
2428c2ecf20Sopenharmony_ci		       resource_size(ipw->link->resource[0]));
2438c2ecf20Sopenharmony_ci	if (ipw->common_memory) {
2448c2ecf20Sopenharmony_ci		release_mem_region(ipw->link->resource[2]->start,
2458c2ecf20Sopenharmony_ci				resource_size(ipw->link->resource[2]));
2468c2ecf20Sopenharmony_ci		iounmap(ipw->common_memory);
2478c2ecf20Sopenharmony_ci	}
2488c2ecf20Sopenharmony_ci	if (ipw->attr_memory) {
2498c2ecf20Sopenharmony_ci		release_mem_region(ipw->link->resource[3]->start,
2508c2ecf20Sopenharmony_ci				resource_size(ipw->link->resource[3]));
2518c2ecf20Sopenharmony_ci		iounmap(ipw->attr_memory);
2528c2ecf20Sopenharmony_ci	}
2538c2ecf20Sopenharmony_ci	pcmcia_disable_device(ipw->link);
2548c2ecf20Sopenharmony_ci}
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/*
2578c2ecf20Sopenharmony_ci * ipwireless_attach() creates an "instance" of the driver, allocating
2588c2ecf20Sopenharmony_ci * local data structures for one device (one interface).  The device
2598c2ecf20Sopenharmony_ci * is registered with Card Services.
2608c2ecf20Sopenharmony_ci *
2618c2ecf20Sopenharmony_ci * The pcmcia_device structure is initialized, but we don't actually
2628c2ecf20Sopenharmony_ci * configure the card at this point -- we wait until we receive a
2638c2ecf20Sopenharmony_ci * card insertion event.
2648c2ecf20Sopenharmony_ci */
2658c2ecf20Sopenharmony_cistatic int ipwireless_attach(struct pcmcia_device *link)
2668c2ecf20Sopenharmony_ci{
2678c2ecf20Sopenharmony_ci	struct ipw_dev *ipw;
2688c2ecf20Sopenharmony_ci	int ret;
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci	ipw = kzalloc(sizeof(struct ipw_dev), GFP_KERNEL);
2718c2ecf20Sopenharmony_ci	if (!ipw)
2728c2ecf20Sopenharmony_ci		return -ENOMEM;
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci	ipw->link = link;
2758c2ecf20Sopenharmony_ci	link->priv = ipw;
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	ipw->hardware = ipwireless_hardware_create();
2788c2ecf20Sopenharmony_ci	if (!ipw->hardware) {
2798c2ecf20Sopenharmony_ci		kfree(ipw);
2808c2ecf20Sopenharmony_ci		return -ENOMEM;
2818c2ecf20Sopenharmony_ci	}
2828c2ecf20Sopenharmony_ci	/* RegisterClient will call config_ipwireless */
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	ret = config_ipwireless(ipw);
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci	if (ret != 0) {
2878c2ecf20Sopenharmony_ci		ipwireless_detach(link);
2888c2ecf20Sopenharmony_ci		return ret;
2898c2ecf20Sopenharmony_ci	}
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci	return 0;
2928c2ecf20Sopenharmony_ci}
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/*
2958c2ecf20Sopenharmony_ci * This deletes a driver "instance".  The device is de-registered with
2968c2ecf20Sopenharmony_ci * Card Services.  If it has been released, all local data structures
2978c2ecf20Sopenharmony_ci * are freed.  Otherwise, the structures will be freed when the device
2988c2ecf20Sopenharmony_ci * is released.
2998c2ecf20Sopenharmony_ci */
3008c2ecf20Sopenharmony_cistatic void ipwireless_detach(struct pcmcia_device *link)
3018c2ecf20Sopenharmony_ci{
3028c2ecf20Sopenharmony_ci	struct ipw_dev *ipw = link->priv;
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	release_ipwireless(ipw);
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci	if (ipw->tty != NULL)
3078c2ecf20Sopenharmony_ci		ipwireless_tty_free(ipw->tty);
3088c2ecf20Sopenharmony_ci	if (ipw->network != NULL)
3098c2ecf20Sopenharmony_ci		ipwireless_network_free(ipw->network);
3108c2ecf20Sopenharmony_ci	if (ipw->hardware != NULL)
3118c2ecf20Sopenharmony_ci		ipwireless_hardware_free(ipw->hardware);
3128c2ecf20Sopenharmony_ci	kfree(ipw);
3138c2ecf20Sopenharmony_ci}
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_cistatic struct pcmcia_driver me = {
3168c2ecf20Sopenharmony_ci	.owner		= THIS_MODULE,
3178c2ecf20Sopenharmony_ci	.probe          = ipwireless_attach,
3188c2ecf20Sopenharmony_ci	.remove         = ipwireless_detach,
3198c2ecf20Sopenharmony_ci	.name		= IPWIRELESS_PCCARD_NAME,
3208c2ecf20Sopenharmony_ci	.id_table       = ipw_ids
3218c2ecf20Sopenharmony_ci};
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci/*
3248c2ecf20Sopenharmony_ci * Module insertion : initialisation of the module.
3258c2ecf20Sopenharmony_ci * Register the card with cardmgr...
3268c2ecf20Sopenharmony_ci */
3278c2ecf20Sopenharmony_cistatic int __init init_ipwireless(void)
3288c2ecf20Sopenharmony_ci{
3298c2ecf20Sopenharmony_ci	int ret;
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci	ret = ipwireless_tty_init();
3328c2ecf20Sopenharmony_ci	if (ret != 0)
3338c2ecf20Sopenharmony_ci		return ret;
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	ret = pcmcia_register_driver(&me);
3368c2ecf20Sopenharmony_ci	if (ret != 0)
3378c2ecf20Sopenharmony_ci		ipwireless_tty_release();
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	return ret;
3408c2ecf20Sopenharmony_ci}
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci/*
3438c2ecf20Sopenharmony_ci * Module removal
3448c2ecf20Sopenharmony_ci */
3458c2ecf20Sopenharmony_cistatic void __exit exit_ipwireless(void)
3468c2ecf20Sopenharmony_ci{
3478c2ecf20Sopenharmony_ci	pcmcia_unregister_driver(&me);
3488c2ecf20Sopenharmony_ci	ipwireless_tty_release();
3498c2ecf20Sopenharmony_ci}
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_cimodule_init(init_ipwireless);
3528c2ecf20Sopenharmony_cimodule_exit(exit_ipwireless);
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ciMODULE_AUTHOR(IPWIRELESS_PCMCIA_AUTHOR);
3558c2ecf20Sopenharmony_ciMODULE_DESCRIPTION(IPWIRELESS_PCCARD_NAME " " IPWIRELESS_PCMCIA_VERSION);
3568c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
357