aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irmod.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/irda/irmod.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'net/irda/irmod.c')
-rw-r--r--net/irda/irmod.c185
1 files changed, 185 insertions, 0 deletions
diff --git a/net/irda/irmod.c b/net/irda/irmod.c
new file mode 100644
index 000000000000..6ffaed4544e9
--- /dev/null
+++ b/net/irda/irmod.c
@@ -0,0 +1,185 @@
1/*********************************************************************
2 *
3 * Filename: irmod.c
4 * Version: 0.9
5 * Description: IrDA stack main entry points
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Mon Dec 15 13:55:39 1997
9 * Modified at: Wed Jan 5 15:12:41 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 *
12 * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2004 Jean Tourrilhes <jt@hpl.hp.com>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * Neither Dag Brattli nor University of Tromsų admit liability nor
21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge.
23 *
24 ********************************************************************/
25
26/*
27 * This file contains the main entry points of the IrDA stack.
28 * They are in this file and not af_irda.c because some developpers
29 * are using the IrDA stack without the socket API (compiling out
30 * af_irda.c).
31 * Jean II
32 */
33
34#include <linux/config.h>
35#include <linux/module.h>
36#include <linux/moduleparam.h>
37
38#include <net/irda/irda.h>
39#include <net/irda/irmod.h> /* notify_t */
40#include <net/irda/irlap.h> /* irlap_init */
41#include <net/irda/irlmp.h> /* irlmp_init */
42#include <net/irda/iriap.h> /* iriap_init */
43#include <net/irda/irttp.h> /* irttp_init */
44#include <net/irda/irda_device.h> /* irda_device_init */
45
46/* irproc.c */
47extern void irda_proc_register(void);
48extern void irda_proc_unregister(void);
49/* irsysctl.c */
50extern int irda_sysctl_register(void);
51extern void irda_sysctl_unregister(void);
52/* af_irda.c */
53extern int irsock_init(void);
54extern void irsock_cleanup(void);
55/* irlap_frame.c */
56extern int irlap_driver_rcv(struct sk_buff *, struct net_device *,
57 struct packet_type *);
58
59/*
60 * Module parameters
61 */
62#ifdef CONFIG_IRDA_DEBUG
63unsigned int irda_debug = IRDA_DEBUG_LEVEL;
64module_param_named(debug, irda_debug, uint, 0);
65MODULE_PARM_DESC(debug, "IRDA debugging level");
66EXPORT_SYMBOL(irda_debug);
67#endif
68
69/* Packet type handler.
70 * Tell the kernel how IrDA packets should be handled.
71 */
72static struct packet_type irda_packet_type = {
73 .type = __constant_htons(ETH_P_IRDA),
74 .func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */
75};
76
77/*
78 * Function irda_notify_init (notify)
79 *
80 * Used for initializing the notify structure
81 *
82 */
83void irda_notify_init(notify_t *notify)
84{
85 notify->data_indication = NULL;
86 notify->udata_indication = NULL;
87 notify->connect_confirm = NULL;
88 notify->connect_indication = NULL;
89 notify->disconnect_indication = NULL;
90 notify->flow_indication = NULL;
91 notify->status_indication = NULL;
92 notify->instance = NULL;
93 strlcpy(notify->name, "Unknown", sizeof(notify->name));
94}
95EXPORT_SYMBOL(irda_notify_init);
96
97/*
98 * Function irda_init (void)
99 *
100 * Protocol stack initialisation entry point.
101 * Initialise the various components of the IrDA stack
102 */
103static int __init irda_init(void)
104{
105 IRDA_DEBUG(0, "%s()\n", __FUNCTION__);
106
107 /* Lower layer of the stack */
108 irlmp_init();
109 irlap_init();
110
111 /* Higher layers of the stack */
112 iriap_init();
113 irttp_init();
114 irsock_init();
115
116 /* Add IrDA packet type (Start receiving packets) */
117 dev_add_pack(&irda_packet_type);
118
119 /* External APIs */
120#ifdef CONFIG_PROC_FS
121 irda_proc_register();
122#endif
123#ifdef CONFIG_SYSCTL
124 irda_sysctl_register();
125#endif
126
127 /* Driver/dongle support */
128 irda_device_init();
129
130 return 0;
131}
132
133/*
134 * Function irda_cleanup (void)
135 *
136 * Protocol stack cleanup/removal entry point.
137 * Cleanup the various components of the IrDA stack
138 */
139static void __exit irda_cleanup(void)
140{
141 /* Remove External APIs */
142#ifdef CONFIG_SYSCTL
143 irda_sysctl_unregister();
144#endif
145#ifdef CONFIG_PROC_FS
146 irda_proc_unregister();
147#endif
148
149 /* Remove IrDA packet type (stop receiving packets) */
150 dev_remove_pack(&irda_packet_type);
151
152 /* Remove higher layers */
153 irsock_cleanup();
154 irttp_cleanup();
155 iriap_cleanup();
156
157 /* Remove lower layers */
158 irda_device_cleanup();
159 irlap_cleanup(); /* Must be done before irlmp_cleanup()! DB */
160
161 /* Remove middle layer */
162 irlmp_cleanup();
163}
164
165/*
166 * The IrDA stack must be initialised *before* drivers get initialised,
167 * and *before* higher protocols (IrLAN/IrCOMM/IrNET) get initialised,
168 * otherwise bad things will happen (hashbins will be NULL for example).
169 * Those modules are at module_init()/device_initcall() level.
170 *
171 * On the other hand, it needs to be initialised *after* the basic
172 * networking, the /proc/net filesystem and sysctl module. Those are
173 * currently initialised in .../init/main.c (before initcalls).
174 * Also, IrDA drivers needs to be initialised *after* the random number
175 * generator (main stack and higher layer init don't need it anymore).
176 *
177 * Jean II
178 */
179subsys_initcall(irda_init);
180module_exit(irda_cleanup);
181
182MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>");
183MODULE_DESCRIPTION("The Linux IrDA Protocol Stack");
184MODULE_LICENSE("GPL");
185MODULE_ALIAS_NETPROTO(PF_IRDA);