Commit ffdaa8c0 authored by Jean Tourrilhes's avatar Jean Tourrilhes Committed by Linus Torvalds

IrDA update 2/2: big header and initcall cleanup

        o [FEATURE] Use new kernel init/exit style, should fix static builds
        o [FEATURE] Reduce header dependancies
                                                Before  After
                net/irda/.depend                14917   13617 B
                drivers/net/irda/.depend        16134   14293 B
                irda full recompile             3'13    3'10
parent 26d0a7ee
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
/* /*
...@@ -110,7 +109,7 @@ int __init actisys_init(void) ...@@ -110,7 +109,7 @@ int __init actisys_init(void)
return 0; return 0;
} }
void actisys_cleanup(void) void __exit actisys_cleanup(void)
{ {
/* We have to remove both dongles */ /* We have to remove both dongles */
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
...@@ -269,7 +268,6 @@ static int actisys_reset(struct irda_task *task) ...@@ -269,7 +268,6 @@ static int actisys_reset(struct irda_task *task)
return ret; return ret;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> - Jean Tourrilhes <jt@hpl.hp.com>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> - Jean Tourrilhes <jt@hpl.hp.com>");
MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver"); MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -281,10 +279,7 @@ MODULE_LICENSE("GPL"); ...@@ -281,10 +279,7 @@ MODULE_LICENSE("GPL");
* Initialize Actisys module * Initialize Actisys module
* *
*/ */
int init_module(void) module_init(actisys_init);
{
return actisys_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -292,8 +287,4 @@ int init_module(void) ...@@ -292,8 +287,4 @@ int init_module(void)
* Cleanup Actisys module * Cleanup Actisys module
* *
*/ */
void cleanup_module(void) module_exit(actisys_cleanup);
{
actisys_cleanup();
}
#endif /* MODULE */
...@@ -40,8 +40,6 @@ ...@@ -40,8 +40,6 @@
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap_frame.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/ali-ircc.h> #include <net/irda/ali-ircc.h>
...@@ -88,9 +86,7 @@ static char *dongle_types[] = { ...@@ -88,9 +86,7 @@ static char *dongle_types[] = {
/* Some prototypes */ /* Some prototypes */
static int ali_ircc_open(int i, chipio_t *info); static int ali_ircc_open(int i, chipio_t *info);
#ifdef MODULE
static int ali_ircc_close(struct ali_ircc_cb *self); static int ali_ircc_close(struct ali_ircc_cb *self);
#endif /* MODULE */
static int ali_ircc_setup(chipio_t *info); static int ali_ircc_setup(chipio_t *info);
static int ali_ircc_is_receiving(struct ali_ircc_cb *self); static int ali_ircc_is_receiving(struct ali_ircc_cb *self);
...@@ -228,8 +224,7 @@ int __init ali_ircc_init(void) ...@@ -228,8 +224,7 @@ int __init ali_ircc_init(void)
* Close all configured chips * Close all configured chips
* *
*/ */
#ifdef MODULE static void __exit ali_ircc_cleanup(void)
static void ali_ircc_cleanup(void)
{ {
int i; int i;
...@@ -244,7 +239,6 @@ static void ali_ircc_cleanup(void) ...@@ -244,7 +239,6 @@ static void ali_ircc_cleanup(void)
IRDA_DEBUG(2, __FUNCTION__ "(), ----------------- End -----------------\n"); IRDA_DEBUG(2, __FUNCTION__ "(), ----------------- End -----------------\n");
} }
#endif /* MODULE */
/* /*
* Function ali_ircc_open (int i, chipio_t *inf) * Function ali_ircc_open (int i, chipio_t *inf)
...@@ -387,14 +381,13 @@ static int ali_ircc_open(int i, chipio_t *info) ...@@ -387,14 +381,13 @@ static int ali_ircc_open(int i, chipio_t *info)
} }
#ifdef MODULE
/* /*
* Function ali_ircc_close (self) * Function ali_ircc_close (self)
* *
* Close driver instance * Close driver instance
* *
*/ */
static int ali_ircc_close(struct ali_ircc_cb *self) static int __exit ali_ircc_close(struct ali_ircc_cb *self)
{ {
int iobase; int iobase;
...@@ -428,7 +421,6 @@ static int ali_ircc_close(struct ali_ircc_cb *self) ...@@ -428,7 +421,6 @@ static int ali_ircc_close(struct ali_ircc_cb *self)
return 0; return 0;
} }
#endif /* MODULE */
/* /*
* Function ali_ircc_init_43 (chip, info) * Function ali_ircc_init_43 (chip, info)
...@@ -2288,7 +2280,6 @@ static void FIR2SIR(int iobase) ...@@ -2288,7 +2280,6 @@ static void FIR2SIR(int iobase)
IRDA_DEBUG(1, __FUNCTION__ "(), ----------------- End ------------------\n"); IRDA_DEBUG(1, __FUNCTION__ "(), ----------------- End ------------------\n");
} }
#ifdef MODULE
MODULE_AUTHOR("Benjamin Kong <benjamin_kong@ali.com.tw>"); MODULE_AUTHOR("Benjamin Kong <benjamin_kong@ali.com.tw>");
MODULE_DESCRIPTION("ALi FIR Controller Driver"); MODULE_DESCRIPTION("ALi FIR Controller Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -2301,13 +2292,5 @@ MODULE_PARM_DESC(irq, "IRQ lines"); ...@@ -2301,13 +2292,5 @@ MODULE_PARM_DESC(irq, "IRQ lines");
MODULE_PARM(dma, "1-4i"); MODULE_PARM(dma, "1-4i");
MODULE_PARM_DESC(dma, "DMA channels"); MODULE_PARM_DESC(dma, "DMA channels");
int init_module(void) module_init(ali_ircc_init);
{ module_exit(ali_ircc_cleanup);
return ali_ircc_init();
}
void cleanup_module(void)
{
ali_ircc_cleanup();
}
#endif /* MODULE */
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -123,7 +122,5 @@ MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>"); ...@@ -123,7 +122,5 @@ MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>");
MODULE_DESCRIPTION("EP7211 I/R driver"); MODULE_DESCRIPTION("EP7211 I/R driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifdef MODULE
module_init(ep7211_ir_init); module_init(ep7211_ir_init);
#endif /* MODULE */
module_exit(ep7211_ir_cleanup); module_exit(ep7211_ir_cleanup);
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
static void esi_open(dongle_t *self, struct qos_info *qos); static void esi_open(dongle_t *self, struct qos_info *qos);
...@@ -60,7 +59,7 @@ int __init esi_init(void) ...@@ -60,7 +59,7 @@ int __init esi_init(void)
return irda_device_register_dongle(&dongle); return irda_device_register_dongle(&dongle);
} }
void esi_cleanup(void) void __exit esi_cleanup(void)
{ {
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
...@@ -133,7 +132,6 @@ static int esi_reset(struct irda_task *task) ...@@ -133,7 +132,6 @@ static int esi_reset(struct irda_task *task)
return 0; return 0;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver"); MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -144,10 +142,7 @@ MODULE_LICENSE("GPL"); ...@@ -144,10 +142,7 @@ MODULE_LICENSE("GPL");
* Initialize ESI module * Initialize ESI module
* *
*/ */
int init_module(void) module_init(esi_init);
{
return esi_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -155,9 +150,5 @@ int init_module(void) ...@@ -155,9 +150,5 @@ int init_module(void)
* Cleanup ESI module * Cleanup ESI module
* *
*/ */
void cleanup_module(void) module_exit(esi_cleanup);
{
esi_cleanup();
}
#endif /* MODULE */
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/irtty.h> #include <net/irda/irtty.h>
...@@ -79,7 +78,7 @@ int __init girbil_init(void) ...@@ -79,7 +78,7 @@ int __init girbil_init(void)
return irda_device_register_dongle(&dongle); return irda_device_register_dongle(&dongle);
} }
void girbil_cleanup(void) void __exit girbil_cleanup(void)
{ {
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
...@@ -231,7 +230,6 @@ static int girbil_reset(struct irda_task *task) ...@@ -231,7 +230,6 @@ static int girbil_reset(struct irda_task *task)
return ret; return ret;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver"); MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -243,10 +241,7 @@ MODULE_LICENSE("GPL"); ...@@ -243,10 +241,7 @@ MODULE_LICENSE("GPL");
* Initialize Girbil module * Initialize Girbil module
* *
*/ */
int init_module(void) module_init(girbil_init);
{
return girbil_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -254,8 +249,5 @@ int init_module(void) ...@@ -254,8 +249,5 @@ int init_module(void)
* Cleanup Girbil module * Cleanup Girbil module
* *
*/ */
void cleanup_module(void) module_exit(girbil_cleanup);
{
girbil_cleanup();
}
#endif /* MODULE */
...@@ -65,11 +65,6 @@ ...@@ -65,11 +65,6 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <net/irda/irda.h>
#include <net/irda/irlap.h>
#include <net/irda/irda_device.h>
#include <net/irda/wrapper.h>
#include <net/irda/irda-usb.h> #include <net/irda/irda-usb.h>
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irport.h> #include <net/irda/irport.h>
...@@ -121,8 +120,7 @@ int __init irport_init(void) ...@@ -121,8 +120,7 @@ int __init irport_init(void)
* Close all configured ports * Close all configured ports
* *
*/ */
#ifdef MODULE static void __exit irport_cleanup(void)
static void irport_cleanup(void)
{ {
int i; int i;
...@@ -133,7 +131,6 @@ static void irport_cleanup(void) ...@@ -133,7 +131,6 @@ static void irport_cleanup(void)
irport_close(dev_self[i]); irport_close(dev_self[i]);
} }
} }
#endif /* MODULE */
struct irport_cb * struct irport_cb *
irport_open(int i, unsigned int iobase, unsigned int irq) irport_open(int i, unsigned int iobase, unsigned int irq)
...@@ -1026,7 +1023,6 @@ static struct net_device_stats *irport_net_get_stats(struct net_device *dev) ...@@ -1026,7 +1023,6 @@ static struct net_device_stats *irport_net_get_stats(struct net_device *dev)
return &self->stats; return &self->stats;
} }
#ifdef MODULE
MODULE_PARM(io, "1-4i"); MODULE_PARM(io, "1-4i");
MODULE_PARM_DESC(io, "Base I/O addresses"); MODULE_PARM_DESC(io, "Base I/O addresses");
MODULE_PARM(irq, "1-4i"); MODULE_PARM(irq, "1-4i");
...@@ -1036,15 +1032,6 @@ MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); ...@@ -1036,15 +1032,6 @@ MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Half duplex serial driver for IrDA SIR mode"); MODULE_DESCRIPTION("Half duplex serial driver for IrDA SIR mode");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(irport_init);
void cleanup_module(void) module_exit(irport_cleanup);
{
irport_cleanup();
}
int init_module(void)
{
return irport_init();
}
#endif /* MODULE */
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irtty.h> #include <net/irda/irtty.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/timer.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
static hashbin_t *irtty = NULL; static hashbin_t *irtty = NULL;
...@@ -113,8 +112,7 @@ int __init irtty_init(void) ...@@ -113,8 +112,7 @@ int __init irtty_init(void)
* Called when the irda module is removed. Here we remove all instances * Called when the irda module is removed. Here we remove all instances
* of the driver, and the master array. * of the driver, and the master array.
*/ */
#ifdef MODULE static void __exit irtty_cleanup(void)
static void irtty_cleanup(void)
{ {
int ret; int ret;
...@@ -132,7 +130,6 @@ static void irtty_cleanup(void) ...@@ -132,7 +130,6 @@ static void irtty_cleanup(void)
*/ */
hashbin_delete(irtty, NULL); hashbin_delete(irtty, NULL);
} }
#endif /* MODULE */
/* /*
* Function irtty_open(tty) * Function irtty_open(tty)
...@@ -1058,8 +1055,6 @@ static struct net_device_stats *irtty_net_get_stats(struct net_device *dev) ...@@ -1058,8 +1055,6 @@ static struct net_device_stats *irtty_net_get_stats(struct net_device *dev)
return &self->stats; return &self->stats;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("IrDA TTY device driver"); MODULE_DESCRIPTION("IrDA TTY device driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1074,10 +1069,7 @@ MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time"); ...@@ -1074,10 +1069,7 @@ MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
* Initialize IrTTY module * Initialize IrTTY module
* *
*/ */
int init_module(void) module_init(irtty_init);
{
return irtty_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -1085,9 +1077,4 @@ int init_module(void) ...@@ -1085,9 +1077,4 @@ int init_module(void)
* Cleanup IrTTY module * Cleanup IrTTY module
* *
*/ */
void cleanup_module(void) module_exit(irtty_cleanup);
{
irtty_cleanup();
}
#endif /* MODULE */
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
...@@ -63,7 +62,7 @@ int __init litelink_init(void) ...@@ -63,7 +62,7 @@ int __init litelink_init(void)
return irda_device_register_dongle(&dongle); return irda_device_register_dongle(&dongle);
} }
void litelink_cleanup(void) void __exit litelink_cleanup(void)
{ {
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
...@@ -163,7 +162,6 @@ static int litelink_reset(struct irda_task *task) ...@@ -163,7 +162,6 @@ static int litelink_reset(struct irda_task *task)
return 0; return 0;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Parallax Litelink dongle driver"); MODULE_DESCRIPTION("Parallax Litelink dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -175,10 +173,7 @@ MODULE_LICENSE("GPL"); ...@@ -175,10 +173,7 @@ MODULE_LICENSE("GPL");
* Initialize Litelink module * Initialize Litelink module
* *
*/ */
int init_module(void) module_init(litelink_init);
{
return litelink_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -186,8 +181,4 @@ int init_module(void) ...@@ -186,8 +181,4 @@ int init_module(void)
* Cleanup Litelink module * Cleanup Litelink module
* *
*/ */
void cleanup_module(void) module_exit(litelink_cleanup);
{
litelink_cleanup();
}
#endif /* MODULE */
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/irtty.h> #include <net/irda/irtty.h>
...@@ -56,7 +55,7 @@ int __init mcp2120_init(void) ...@@ -56,7 +55,7 @@ int __init mcp2120_init(void)
return irda_device_register_dongle(&dongle); return irda_device_register_dongle(&dongle);
} }
void mcp2120_cleanup(void) void __exit mcp2120_cleanup(void)
{ {
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
...@@ -222,7 +221,6 @@ static int mcp2120_reset(struct irda_task *task) ...@@ -222,7 +221,6 @@ static int mcp2120_reset(struct irda_task *task)
return ret; return ret;
} }
#ifdef MODULE
MODULE_AUTHOR("Felix Tang <tangf@eyetap.org>"); MODULE_AUTHOR("Felix Tang <tangf@eyetap.org>");
MODULE_DESCRIPTION("Microchip MCP2120"); MODULE_DESCRIPTION("Microchip MCP2120");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -234,10 +232,7 @@ MODULE_LICENSE("GPL"); ...@@ -234,10 +232,7 @@ MODULE_LICENSE("GPL");
* Initialize MCP2120 module * Initialize MCP2120 module
* *
*/ */
int init_module(void) module_init(mcp2120_init);
{
return mcp2120_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -245,8 +240,4 @@ int init_module(void) ...@@ -245,8 +240,4 @@ int init_module(void)
* Cleanup MCP2120 module * Cleanup MCP2120 module
* *
*/ */
void cleanup_module(void) module_exit(mcp2120_cleanup);
{
mcp2120_cleanup();
}
#endif /* MODULE */
...@@ -61,8 +61,6 @@ ...@@ -61,8 +61,6 @@
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap_frame.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/nsc-ircc.h> #include <net/irda/nsc-ircc.h>
...@@ -123,9 +121,7 @@ static char *dongle_types[] = { ...@@ -123,9 +121,7 @@ static char *dongle_types[] = {
/* Some prototypes */ /* Some prototypes */
static int nsc_ircc_open(int i, chipio_t *info); static int nsc_ircc_open(int i, chipio_t *info);
#ifdef MODULE
static int nsc_ircc_close(struct nsc_ircc_cb *self); static int nsc_ircc_close(struct nsc_ircc_cb *self);
#endif /* MODULE */
static int nsc_ircc_setup(chipio_t *info); static int nsc_ircc_setup(chipio_t *info);
static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self); static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self);
static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self); static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self);
...@@ -225,8 +221,7 @@ int __init nsc_ircc_init(void) ...@@ -225,8 +221,7 @@ int __init nsc_ircc_init(void)
* Close all configured chips * Close all configured chips
* *
*/ */
#ifdef MODULE static void __exit nsc_ircc_cleanup(void)
static void nsc_ircc_cleanup(void)
{ {
int i; int i;
...@@ -237,7 +232,6 @@ static void nsc_ircc_cleanup(void) ...@@ -237,7 +232,6 @@ static void nsc_ircc_cleanup(void)
nsc_ircc_close(dev_self[i]); nsc_ircc_close(dev_self[i]);
} }
} }
#endif /* MODULE */
/* /*
* Function nsc_ircc_open (iobase, irq) * Function nsc_ircc_open (iobase, irq)
...@@ -245,7 +239,7 @@ static void nsc_ircc_cleanup(void) ...@@ -245,7 +239,7 @@ static void nsc_ircc_cleanup(void)
* Open driver instance * Open driver instance
* *
*/ */
static int nsc_ircc_open(int i, chipio_t *info) static int __init nsc_ircc_open(int i, chipio_t *info)
{ {
struct net_device *dev; struct net_device *dev;
struct nsc_ircc_cb *self; struct nsc_ircc_cb *self;
...@@ -384,14 +378,13 @@ static int nsc_ircc_open(int i, chipio_t *info) ...@@ -384,14 +378,13 @@ static int nsc_ircc_open(int i, chipio_t *info)
return 0; return 0;
} }
#ifdef MODULE
/* /*
* Function nsc_ircc_close (self) * Function nsc_ircc_close (self)
* *
* Close driver instance * Close driver instance
* *
*/ */
static int nsc_ircc_close(struct nsc_ircc_cb *self) static int __exit nsc_ircc_close(struct nsc_ircc_cb *self)
{ {
int iobase; int iobase;
...@@ -424,7 +417,6 @@ static int nsc_ircc_close(struct nsc_ircc_cb *self) ...@@ -424,7 +417,6 @@ static int nsc_ircc_close(struct nsc_ircc_cb *self)
return 0; return 0;
} }
#endif /* MODULE */
/* /*
* Function nsc_ircc_init_108 (iobase, cfg_base, irq, dma) * Function nsc_ircc_init_108 (iobase, cfg_base, irq, dma)
...@@ -2046,7 +2038,6 @@ static int nsc_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data) ...@@ -2046,7 +2038,6 @@ static int nsc_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data)
return 0; return 0;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("NSC IrDA Device Driver"); MODULE_DESCRIPTION("NSC IrDA Device Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -2063,14 +2054,6 @@ MODULE_PARM_DESC(dma, "DMA channels"); ...@@ -2063,14 +2054,6 @@ MODULE_PARM_DESC(dma, "DMA channels");
MODULE_PARM(dongle_id, "i"); MODULE_PARM(dongle_id, "i");
MODULE_PARM_DESC(dongle_id, "Type-id of used dongle"); MODULE_PARM_DESC(dongle_id, "Type-id of used dongle");
int init_module(void) module_init(nsc_ircc_init);
{ module_exit(nsc_ircc_cleanup);
return nsc_ircc_init();
}
void cleanup_module(void)
{
nsc_ircc_cleanup();
}
#endif /* MODULE */
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <linux/irda.h> #include <linux/irda.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
/* /*
...@@ -90,7 +89,7 @@ int __init old_belkin_init(void) ...@@ -90,7 +89,7 @@ int __init old_belkin_init(void)
return irda_device_register_dongle(&dongle); return irda_device_register_dongle(&dongle);
} }
void old_belkin_cleanup(void) void __exit old_belkin_cleanup(void)
{ {
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
...@@ -149,7 +148,6 @@ static int old_belkin_reset(struct irda_task *task) ...@@ -149,7 +148,6 @@ static int old_belkin_reset(struct irda_task *task)
return 0; return 0;
} }
#ifdef MODULE
MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>"); MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>");
MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver"); MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -161,10 +159,7 @@ MODULE_LICENSE("GPL"); ...@@ -161,10 +159,7 @@ MODULE_LICENSE("GPL");
* Initialize Old-Belkin module * Initialize Old-Belkin module
* *
*/ */
int init_module(void) module_init(old_belkin_init);
{
return old_belkin_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -172,9 +167,4 @@ int init_module(void) ...@@ -172,9 +167,4 @@ int init_module(void)
* Cleanup Old-Belkin module * Cleanup Old-Belkin module
* *
*/ */
void cleanup_module(void) module_exit(old_belkin_cleanup);
{
old_belkin_cleanup();
}
#endif /* MODULE */
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
...@@ -1078,9 +1077,7 @@ static void sa1100_irda_net_uninit(struct net_device *dev) ...@@ -1078,9 +1077,7 @@ static void sa1100_irda_net_uninit(struct net_device *dev)
kfree(si); kfree(si);
} }
#ifdef MODULE
static static
#endif
int __init sa1100_irda_init(void) int __init sa1100_irda_init(void)
{ {
struct net_device *dev; struct net_device *dev;
...@@ -1181,10 +1178,8 @@ static int __init sa1100ir_setup(char *line) ...@@ -1181,10 +1178,8 @@ static int __init sa1100ir_setup(char *line)
__setup("sa1100ir=", sa1100ir_setup); __setup("sa1100ir=", sa1100ir_setup);
#ifdef MODULE
module_init(sa1100_irda_init); module_init(sa1100_irda_init);
module_exit(sa1100_irda_exit); module_exit(sa1100_irda_exit);
#endif
MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
MODULE_DESCRIPTION("StrongARM SA1100 IrDA driver"); MODULE_DESCRIPTION("StrongARM SA1100 IrDA driver");
......
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap_frame.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/smc-ircc.h> #include <net/irda/smc-ircc.h>
#include <net/irda/irport.h> #include <net/irda/irport.h>
...@@ -1160,15 +1158,12 @@ static int ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data) ...@@ -1160,15 +1158,12 @@ static int ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data)
return 0; return 0;
} }
#ifdef MODULE
/* /*
* Function ircc_close (self) * Function ircc_close (self)
* *
* Close driver instance * Close driver instance
* *
*/ */
#ifdef MODULE
static int __exit ircc_close(struct ircc_cb *self) static int __exit ircc_close(struct ircc_cb *self)
{ {
int iobase; int iobase;
...@@ -1207,7 +1202,6 @@ static int __exit ircc_close(struct ircc_cb *self) ...@@ -1207,7 +1202,6 @@ static int __exit ircc_close(struct ircc_cb *self)
return 0; return 0;
} }
#endif /* MODULE */
int __init smc_init(void) int __init smc_init(void)
{ {
...@@ -1243,5 +1237,3 @@ MODULE_PARM(ircc_sir, "1-4i"); ...@@ -1243,5 +1237,3 @@ MODULE_PARM(ircc_sir, "1-4i");
MODULE_PARM_DESC(ircc_sir, "SIR Base Address"); MODULE_PARM_DESC(ircc_sir, "SIR Base Address");
MODULE_PARM(ircc_cfg, "1-4i"); MODULE_PARM(ircc_cfg, "1-4i");
MODULE_PARM_DESC(ircc_cfg, "Configuration register base address"); MODULE_PARM_DESC(ircc_cfg, "Configuration register base address");
#endif /* MODULE */
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/irtty.h> #include <net/irda/irtty.h>
...@@ -60,7 +59,7 @@ int __init tekram_init(void) ...@@ -60,7 +59,7 @@ int __init tekram_init(void)
return irda_device_register_dongle(&dongle); return irda_device_register_dongle(&dongle);
} }
void tekram_cleanup(void) void __exit tekram_cleanup(void)
{ {
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
...@@ -264,7 +263,6 @@ int tekram_reset(struct irda_task *task) ...@@ -264,7 +263,6 @@ int tekram_reset(struct irda_task *task)
return ret; return ret;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Tekram IrMate IR-210B dongle driver"); MODULE_DESCRIPTION("Tekram IrMate IR-210B dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -275,10 +273,7 @@ MODULE_LICENSE("GPL"); ...@@ -275,10 +273,7 @@ MODULE_LICENSE("GPL");
* Initialize Tekram module * Initialize Tekram module
* *
*/ */
int init_module(void) module_init(tekram_init);
{
return tekram_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -286,8 +281,4 @@ int init_module(void) ...@@ -286,8 +281,4 @@ int init_module(void)
* Cleanup Tekram module * Cleanup Tekram module
* *
*/ */
void cleanup_module(void) module_exit(tekram_cleanup);
{
tekram_cleanup();
}
#endif /* MODULE */
...@@ -69,8 +69,6 @@ static char *rcsid = "$Id: toshoboe.c,v 1.91 1999/06/29 14:21:06 root Exp $"; ...@@ -69,8 +69,6 @@ static char *rcsid = "$Id: toshoboe.c,v 1.91 1999/06/29 14:21:06 root Exp $";
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap_frame.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <linux/pm.h> #include <linux/pm.h>
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irlap.h>
#include <net/irda/vlsi_ir.h> #include <net/irda/vlsi_ir.h>
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/w83977af.h> #include <net/irda/w83977af.h>
...@@ -135,8 +134,7 @@ int __init w83977af_init(void) ...@@ -135,8 +134,7 @@ int __init w83977af_init(void)
* Close all configured chips * Close all configured chips
* *
*/ */
#ifdef MODULE void __exit w83977af_cleanup(void)
void w83977af_cleanup(void)
{ {
int i; int i;
...@@ -147,7 +145,6 @@ void w83977af_cleanup(void) ...@@ -147,7 +145,6 @@ void w83977af_cleanup(void)
w83977af_close(dev_self[i]); w83977af_close(dev_self[i]);
} }
} }
#endif /* MODULE */
/* /*
* Function w83977af_open (iobase, irq) * Function w83977af_open (iobase, irq)
...@@ -1374,8 +1371,6 @@ static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev) ...@@ -1374,8 +1371,6 @@ static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev)
return &self->stats; return &self->stats;
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver"); MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1394,10 +1389,7 @@ MODULE_PARM_DESC(irq, "IRQ lines"); ...@@ -1394,10 +1389,7 @@ MODULE_PARM_DESC(irq, "IRQ lines");
* *
* *
*/ */
int init_module(void) module_init(w83977af_init);
{
return w83977af_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -1405,8 +1397,4 @@ int init_module(void) ...@@ -1405,8 +1397,4 @@ int init_module(void)
* *
* *
*/ */
void cleanup_module(void) module_exit(w83977af_cleanup);
{
w83977af_cleanup();
}
#endif /* MODULE */
/*********************************************************************
*
* Filename: af_irda.h
* Version: 1.0
* Description: IrDA sockets declarations
* Status: Stable
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Dec 9 21:13:12 1997
* Modified at: Fri Jan 28 13:16:32 2000
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms admit liability nor
* provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
#ifndef AF_IRDA_H
#define AF_IRDA_H
#include <linux/irda.h>
#include <net/irda/irda.h>
#include <net/irda/iriap.h> /* struct iriap_cb */
#include <net/irda/irias_object.h> /* struct ias_value */
#include <net/irda/irlmp.h> /* struct lsap_cb */
#include <net/irda/irttp.h> /* struct tsap_cb */
#include <net/irda/discovery.h> /* struct discovery_t */
/* IrDA Socket */
struct irda_sock {
__u32 saddr; /* my local address */
__u32 daddr; /* peer address */
struct lsap_cb *lsap; /* LSAP used by Ultra */
__u8 pid; /* Protocol IP (PID) used by Ultra */
struct tsap_cb *tsap; /* TSAP used by this connection */
__u8 dtsap_sel; /* remote TSAP address */
__u8 stsap_sel; /* local TSAP address */
__u32 max_sdu_size_rx;
__u32 max_sdu_size_tx;
__u32 max_data_size;
__u8 max_header_size;
struct qos_info qos_tx;
__u16 mask; /* Hint bits mask */
__u16 hints; /* Hint bits */
__u32 ckey; /* IrLMP client handle */
__u32 skey; /* IrLMP service handle */
struct ias_object *ias_obj; /* Our service name + lsap in IAS */
struct iriap_cb *iriap; /* Used to query remote IAS */
struct ias_value *ias_result; /* Result of remote IAS query */
hashbin_t *cachelog; /* Result of discovery query */
struct discovery_t *cachediscovery; /* Result of selective discovery query */
int nslots; /* Number of slots to use for discovery */
int errno; /* status of the IAS query */
struct sock *sk;
wait_queue_head_t query_wait; /* Wait for the answer to a query */
struct timer_list watchdog; /* Timeout for discovery */
LOCAL_FLOW tx_flow;
LOCAL_FLOW rx_flow;
};
#define irda_sk(__sk) ((struct irda_sock *)(__sk)->protinfo)
#endif /* AF_IRDA_H */
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* *
* Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -34,11 +35,23 @@ ...@@ -34,11 +35,23 @@
#include <asm/param.h> #include <asm/param.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irqueue.h> #include <net/irda/irqueue.h> /* irda_queue_t */
#include <net/irda/irlap_event.h> /* LAP_REASON */
#define DISCOVERY_EXPIRE_TIMEOUT (2*sysctl_discovery_timeout*HZ) #define DISCOVERY_EXPIRE_TIMEOUT (2*sysctl_discovery_timeout*HZ)
#define DISCOVERY_DEFAULT_SLOTS 0 #define DISCOVERY_DEFAULT_SLOTS 0
/*
* This type is used by the protocols that transmit 16 bits words in
* little endian format. A little endian machine stores MSB of word in
* byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0]
* and LSB in byte[1].
*/
typedef union {
__u16 word;
__u8 byte[2];
} __u16_host_order;
/* Types of discovery */ /* Types of discovery */
typedef enum { typedef enum {
DISCOVERY_LOG, /* What's in our discovery log */ DISCOVERY_LOG, /* What's in our discovery log */
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define IRCOMM_CORE_H #define IRCOMM_CORE_H
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irqueue.h>
#include <net/irda/ircomm_event.h> #include <net/irda/ircomm_event.h>
#define IRCOMM_MAGIC 0x98347298 #define IRCOMM_MAGIC 0x98347298
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#ifndef IRCOMM_EVENT_H #ifndef IRCOMM_EVENT_H
#define IRCOMM_EVENT_H #define IRCOMM_EVENT_H
#include <net/irda/irmod.h>
typedef enum { typedef enum {
IRCOMM_IDLE, IRCOMM_IDLE,
IRCOMM_WAITI, IRCOMM_WAITI,
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/termios.h> #include <linux/termios.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/tty.h> /* struct tty_struct */
#include <net/irda/irias_object.h> #include <net/irda/irias_object.h>
#include <net/irda/ircomm_core.h> #include <net/irda/ircomm_core.h>
......
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
#include <linux/time.h> #include <linux/time.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irlap.h> #include <net/irda/irda_device.h> /* struct irlap_cb */
#include <net/irda/irda_device.h>
#define RX_COPY_THRESHOLD 200 #define RX_COPY_THRESHOLD 200
#define IRDA_USB_MAX_MTU 2051 #define IRDA_USB_MAX_MTU 2051
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* *
* Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -27,16 +27,13 @@ ...@@ -27,16 +27,13 @@
#define NET_IRDA_H #define NET_IRDA_H
#include <linux/config.h> #include <linux/config.h>
#include <linux/skbuff.h> #include <linux/skbuff.h> /* struct sk_buff */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/if.h> #include <linux/if.h> /* sa_family_t in <linux/irda.h> */
#include <linux/irda.h> #include <linux/irda.h>
typedef __u32 magic_t; typedef __u32 magic_t;
#include <net/irda/qos.h>
#include <net/irda/irqueue.h>
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif #endif
...@@ -57,8 +54,8 @@ typedef __u32 magic_t; ...@@ -57,8 +54,8 @@ typedef __u32 magic_t;
#ifndef IRDA_ALIGN #ifndef IRDA_ALIGN
# define IRDA_ALIGN __attribute__((aligned)) # define IRDA_ALIGN __attribute__((aligned))
#endif #endif
#ifndef PACK #ifndef IRDA_PACK
# define PACK __attribute__((packed)) # define IRDA_PACK __attribute__((packed))
#endif #endif
...@@ -116,151 +113,4 @@ if(!(expr)) do { \ ...@@ -116,151 +113,4 @@ if(!(expr)) do { \
#define IAS_IRCOMM_ID 0x2343 #define IAS_IRCOMM_ID 0x2343
#define IAS_IRLPT_ID 0x9876 #define IAS_IRLPT_ID 0x9876
typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
/* A few forward declarations (to make compiler happy) */
struct tsap_cb; /* in <net/irda/irttp.h> */
struct lsap_cb; /* in <net/irda/irlmp.h> */
struct iriap_cb; /* in <net/irda/iriap.h> */
struct ias_value; /* in <net/irda/irias_object.h> */
struct discovery_t; /* in <net/irda/discovery.h> */
/* IrDA Socket */
struct irda_sock {
__u32 saddr; /* my local address */
__u32 daddr; /* peer address */
struct lsap_cb *lsap; /* LSAP used by Ultra */
__u8 pid; /* Protocol IP (PID) used by Ultra */
struct tsap_cb *tsap; /* TSAP used by this connection */
__u8 dtsap_sel; /* remote TSAP address */
__u8 stsap_sel; /* local TSAP address */
__u32 max_sdu_size_rx;
__u32 max_sdu_size_tx;
__u32 max_data_size;
__u8 max_header_size;
struct qos_info qos_tx;
__u16 mask; /* Hint bits mask */
__u16 hints; /* Hint bits */
__u32 ckey; /* IrLMP client handle */
__u32 skey; /* IrLMP service handle */
struct ias_object *ias_obj; /* Our service name + lsap in IAS */
struct iriap_cb *iriap; /* Used to query remote IAS */
struct ias_value *ias_result; /* Result of remote IAS query */
hashbin_t *cachelog; /* Result of discovery query */
struct discovery_t *cachediscovery; /* Result of selective discovery query */
int nslots; /* Number of slots to use for discovery */
int errno; /* status of the IAS query */
struct sock *sk;
wait_queue_head_t query_wait; /* Wait for the answer to a query */
struct timer_list watchdog; /* Timeout for discovery */
LOCAL_FLOW tx_flow;
LOCAL_FLOW rx_flow;
};
#define irda_sk(__sk) ((struct irda_sock *)(__sk)->protinfo)
/*
* This type is used by the protocols that transmit 16 bits words in
* little endian format. A little endian machine stores MSB of word in
* byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0]
* and LSB in byte[1].
*/
typedef union {
__u16 word;
__u8 byte[2];
} __u16_host_order;
/*
* Per-packet information we need to hide inside sk_buff
* (must not exceed 48 bytes, check with struct sk_buff)
*/
struct irda_skb_cb {
magic_t magic; /* Be sure that we can trust the information */
__u32 next_speed; /* The Speed to be set *after* this frame */
__u16 mtt; /* Minimum turn around time */
__u16 xbofs; /* Number of xbofs required, used by SIR mode */
__u16 next_xbofs; /* Number of xbofs required *after* this frame */
void *context; /* May be used by drivers */
void (*destructor)(struct sk_buff *skb); /* Used for flow control */
__u16 xbofs_delay; /* Number of xbofs used for generating the mtt */
__u8 line; /* Used by IrCOMM in IrLPT mode */
};
/* Misc status information */
typedef enum {
STATUS_OK,
STATUS_ABORTED,
STATUS_NO_ACTIVITY,
STATUS_NOISY,
STATUS_REMOTE,
} LINK_STATUS;
typedef enum {
LOCK_NO_CHANGE,
LOCK_LOCKED,
LOCK_UNLOCKED,
} LOCK_STATUS;
typedef enum { /* FIXME check the two first reason codes */
LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */
LAP_NO_RESPONSE, /* To many retransmits without response */
LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */
LAP_FOUND_NONE, /* No devices were discovered */
LAP_MEDIA_BUSY,
LAP_PRIMARY_CONFLICT,
} LAP_REASON;
/*
* IrLMP disconnect reasons. The order is very important, since they
* correspond to disconnect reasons sent in IrLMP disconnect frames, so
* please do not touch :-)
*/
typedef enum {
LM_USER_REQUEST = 1, /* User request */
LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */
LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */
LM_LAP_RESET, /* IrLAP reset */
LM_INIT_DISCONNECT, /* Link Management initiated disconnect */
LM_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */
LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */
LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */
LM_CONN_HALF_OPEN, /* Connection is half open */
LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */
} LM_REASON;
#define LM_UNKNOWN 0xff /* Unspecified disconnect reason */
/*
* Notify structure used between transport and link management layers
*/
typedef struct {
int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
void (*connect_confirm)(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb);
void (*connect_indication)(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb);
void (*disconnect_indication)(void *instance, void *sap,
LM_REASON reason, struct sk_buff *);
void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow);
void (*status_indication)(void *instance,
LINK_STATUS link, LOCK_STATUS lock);
void *instance; /* Layer instance pointer */
char name[16]; /* Name of layer */
} notify_t;
#define NOTIFY_MAX_NAME 16
#endif /* NET_IRDA_H */ #endif /* NET_IRDA_H */
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* *
* Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
* Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>, * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
* Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -29,18 +30,27 @@ ...@@ -29,18 +30,27 @@
* *
********************************************************************/ ********************************************************************/
/*
* This header contains all the IrDA definitions a driver really
* needs, and therefore the driver should not need to include
* any other IrDA headers - Jean II
*/
#ifndef IRDA_DEVICE_H #ifndef IRDA_DEVICE_H
#define IRDA_DEVICE_H #define IRDA_DEVICE_H
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/skbuff.h> /* struct sk_buff */
#include <linux/irda.h> #include <linux/irda.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/qos.h> #include <net/irda/qos.h> /* struct qos_info */
#include <net/irda/irqueue.h> #include <net/irda/irqueue.h> /* irda_queue_t */
#include <net/irda/irlap_frame.h>
/* A few forward declarations (to make compiler happy) */
struct irlap_cb;
/* Some non-standard interface flags (should not conflict with any in if.h) */ /* Some non-standard interface flags (should not conflict with any in if.h) */
#define IFF_SIR 0x0001 /* Supports SIR speeds */ #define IFF_SIR 0x0001 /* Supports SIR speeds */
...@@ -120,6 +130,22 @@ struct dongle_reg { ...@@ -120,6 +130,22 @@ struct dongle_reg {
int (*change_speed)(struct irda_task *task); int (*change_speed)(struct irda_task *task);
}; };
/*
* Per-packet information we need to hide inside sk_buff
* (must not exceed 48 bytes, check with struct sk_buff)
*/
struct irda_skb_cb {
magic_t magic; /* Be sure that we can trust the information */
__u32 next_speed; /* The Speed to be set *after* this frame */
__u16 mtt; /* Minimum turn around time */
__u16 xbofs; /* Number of xbofs required, used by SIR mode */
__u16 next_xbofs; /* Number of xbofs required *after* this frame */
void *context; /* May be used by drivers */
void (*destructor)(struct sk_buff *skb); /* Used for flow control */
__u16 xbofs_delay; /* Number of xbofs used for generating the mtt */
__u8 line; /* Used by IrCOMM in IrLPT mode */
};
/* Chip specific info */ /* Chip specific info */
typedef struct { typedef struct {
int cfg_base; /* Config register IO base */ int cfg_base; /* Config register IO base */
...@@ -158,6 +184,13 @@ typedef struct { ...@@ -158,6 +184,13 @@ typedef struct {
int irda_device_init(void); int irda_device_init(void);
void irda_device_cleanup(void); void irda_device_cleanup(void);
/* IrLAP entry points used by the drivers.
* We declare them here to avoid the driver pulling a whole bunch stack
* headers they don't really need - Jean II */
struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos,
char * hw_name);
void irlap_close(struct irlap_cb *self);
/* Interface to be uses by IrLAP */ /* Interface to be uses by IrLAP */
void irda_device_set_media_busy(struct net_device *dev, int status); void irda_device_set_media_busy(struct net_device *dev, int status);
int irda_device_is_media_busy(struct net_device *dev); int irda_device_is_media_busy(struct net_device *dev);
......
...@@ -29,11 +29,10 @@ ...@@ -29,11 +29,10 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <net/irda/qos.h>
#include <net/irda/iriap_event.h> #include <net/irda/iriap_event.h>
#include <net/irda/irias_object.h> #include <net/irda/irias_object.h>
#include <net/irda/irqueue.h> #include <net/irda/irqueue.h> /* irda_queue_t */
#include <net/irda/timer.h> #include <net/irda/timer.h> /* struct timer_list */
#define IAP_LST 0x80 #define IAP_LST 0x80
#define IAP_ACK 0x40 #define IAP_ACK 0x40
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <net/irda/irlap_event.h> #include <net/irda/irqueue.h> /* irda_queue_t */
#include <net/irda/qos.h> /* struct qos_info */
#include <net/irda/discovery.h> /* discovery_t */
#include <net/irda/irlap_event.h> /* IRLAP_STATE, ... */
#include <net/irda/irmod.h> /* struct notify_t */
#define CONFIG_IRDA_DYNAMIC_WINDOW 1 #define CONFIG_IRDA_DYNAMIC_WINDOW 1
...@@ -85,6 +89,29 @@ ...@@ -85,6 +89,29 @@
#define NS_UNEXPECTED 0 #define NS_UNEXPECTED 0
#define NS_INVALID -1 #define NS_INVALID -1
/*
* Meta information passed within the IrLAP state machine
*/
struct irlap_info {
__u8 caddr; /* Connection address */
__u8 control; /* Frame type */
__u8 cmd;
__u32 saddr;
__u32 daddr;
int pf; /* Poll/final bit set */
__u8 nr; /* Sequence number of next frame expected */
__u8 ns; /* Sequence number of frame sent */
int S; /* Number of slots */
int slot; /* Random chosen slot */
int s; /* Current slot */
discovery_t *discovery; /* Discovery information */
};
/* Main structure of IrLAP */ /* Main structure of IrLAP */
struct irlap_cb { struct irlap_cb {
irda_queue_t q; /* Must be first */ irda_queue_t q; /* Must be first */
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
#define IRLAP_EVENT_H #define IRLAP_EVENT_H
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/discovery.h>
/* A few forward declarations (to make compiler happy) */
struct irlap_cb; struct irlap_cb;
struct irlap_info;
/* IrLAP States */ /* IrLAP States */
typedef enum { typedef enum {
...@@ -108,27 +109,16 @@ typedef enum { ...@@ -108,27 +109,16 @@ typedef enum {
} IRLAP_EVENT; } IRLAP_EVENT;
/* /*
* Various things used by the IrLAP state machine * Disconnect reason code
*/ */
struct irlap_info { typedef enum { /* FIXME check the two first reason codes */
__u8 caddr; /* Connection address */ LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */
__u8 control; /* Frame type */ LAP_NO_RESPONSE, /* To many retransmits without response */
__u8 cmd; LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */
LAP_FOUND_NONE, /* No devices were discovered */
__u32 saddr; LAP_MEDIA_BUSY,
__u32 daddr; LAP_PRIMARY_CONFLICT,
} LAP_REASON;
int pf; /* Poll/final bit set */
__u8 nr; /* Sequence number of next frame expected */
__u8 ns; /* Sequence number of frame sent */
int S; /* Number of slots */
int slot; /* Random chosen slot */
int s; /* Current slot */
discovery_t *discovery; /* Discovery information */
};
extern const char *irlap_state[]; extern const char *irlap_state[];
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* *
* Copyright (c) 1997-1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1997-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -35,8 +36,10 @@ ...@@ -35,8 +36,10 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irlap.h>
#include <net/irda/qos.h> /* A few forward declarations (to make compiler happy) */
struct irlap_cb;
struct discovery_t;
/* Frame types and templates */ /* Frame types and templates */
#define INVALID 0xff #define INVALID 0xff
...@@ -80,14 +83,14 @@ struct xid_frame { ...@@ -80,14 +83,14 @@ struct xid_frame {
__u8 flags; /* Discovery flags */ __u8 flags; /* Discovery flags */
__u8 slotnr; __u8 slotnr;
__u8 version; __u8 version;
} PACK; } IRDA_PACK;
struct test_frame { struct test_frame {
__u8 caddr; /* Connection address */ __u8 caddr; /* Connection address */
__u8 control; __u8 control;
__u32 saddr; /* Source device address */ __u32 saddr; /* Source device address */
__u32 daddr; /* Destination device address */ __u32 daddr; /* Destination device address */
} PACK; } IRDA_PACK;
struct ua_frame { struct ua_frame {
__u8 caddr; __u8 caddr;
...@@ -95,12 +98,12 @@ struct ua_frame { ...@@ -95,12 +98,12 @@ struct ua_frame {
__u32 saddr; /* Source device address */ __u32 saddr; /* Source device address */
__u32 daddr; /* Dest device address */ __u32 daddr; /* Dest device address */
} PACK; } IRDA_PACK;
struct i_frame { struct i_frame {
__u8 caddr; __u8 caddr;
__u8 control; __u8 control;
} PACK; } IRDA_PACK;
struct snrm_frame { struct snrm_frame {
__u8 caddr; __u8 caddr;
...@@ -108,11 +111,12 @@ struct snrm_frame { ...@@ -108,11 +111,12 @@ struct snrm_frame {
__u32 saddr; __u32 saddr;
__u32 daddr; __u32 daddr;
__u8 ncaddr; __u8 ncaddr;
} PACK; } IRDA_PACK;
void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb); void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb);
void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s, void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s,
__u8 command, discovery_t *discovery); __u8 command,
struct discovery_t *discovery);
void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *); void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *);
void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
struct sk_buff *cmd); struct sk_buff *cmd);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/qos.h> #include <net/irda/qos.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h> /* LAP_MAX_HEADER, ... */
#include <net/irda/irlmp_event.h> #include <net/irda/irlmp_event.h>
#include <net/irda/irqueue.h> #include <net/irda/irqueue.h>
#include <net/irda/discovery.h> #include <net/irda/discovery.h>
...@@ -91,8 +91,6 @@ typedef struct { ...@@ -91,8 +91,6 @@ typedef struct {
void *priv; /* Used to identify client */ void *priv; /* Used to identify client */
} irlmp_client_t; } irlmp_client_t;
struct lap_cb; /* Forward decl. */
/* /*
* Information about each logical LSAP connection * Information about each logical LSAP connection
*/ */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -27,9 +27,11 @@ ...@@ -27,9 +27,11 @@
#ifndef IRLMP_EVENT_H #ifndef IRLMP_EVENT_H
#define IRLMP_EVENT_H #define IRLMP_EVENT_H
/* A few forward declarations (to make compiler happy) */
struct irlmp_cb; struct irlmp_cb;
struct lsap_cb; struct lsap_cb;
struct lap_cb; struct lap_cb;
struct discovery_t;
/* LAP states */ /* LAP states */
typedef enum { typedef enum {
...@@ -94,7 +96,7 @@ struct irlmp_event { ...@@ -94,7 +96,7 @@ struct irlmp_event {
int reason; int reason;
discovery_t *discovery; struct discovery_t *discovery;
}; };
extern const char *irlmp_state[]; extern const char *irlmp_state[];
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* *
* Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -26,10 +26,70 @@ ...@@ -26,10 +26,70 @@
#ifndef IRMOD_H #ifndef IRMOD_H
#define IRMOD_H #define IRMOD_H
#include <net/irda/irda.h> /* Notify stuff */ /* Misc status information */
typedef enum {
STATUS_OK,
STATUS_ABORTED,
STATUS_NO_ACTIVITY,
STATUS_NOISY,
STATUS_REMOTE,
} LINK_STATUS;
/* Nothing much here anymore - Maybe this header should be merged in typedef enum {
* another header like net/irda/irda.h... - Jean II */ LOCK_NO_CHANGE,
LOCK_LOCKED,
LOCK_UNLOCKED,
} LOCK_STATUS;
typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW;
/*
* IrLMP disconnect reasons. The order is very important, since they
* correspond to disconnect reasons sent in IrLMP disconnect frames, so
* please do not touch :-)
*/
typedef enum {
LM_USER_REQUEST = 1, /* User request */
LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */
LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */
LM_LAP_RESET, /* IrLAP reset */
LM_INIT_DISCONNECT, /* Link Management initiated disconnect */
LM_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */
LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */
LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */
LM_CONN_HALF_OPEN, /* Connection is half open */
LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */
} LM_REASON;
#define LM_UNKNOWN 0xff /* Unspecified disconnect reason */
/* A few forward declarations (to make compiler happy) */
struct qos_info; /* in <net/irda/qos.h> */
/*
* Notify structure used between transport and link management layers
*/
typedef struct {
int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
void (*connect_confirm)(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb);
void (*connect_indication)(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb);
void (*disconnect_indication)(void *instance, void *sap,
LM_REASON reason, struct sk_buff *);
void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow);
void (*status_indication)(void *instance,
LINK_STATUS link, LOCK_STATUS lock);
void *instance; /* Layer instance pointer */
char name[16]; /* Name of layer */
} notify_t;
#define NOTIFY_MAX_NAME 16
/* Zero the notify structure */
void irda_notify_init(notify_t *notify);
/* Locking wrapper - Note the inverted logic on irda_lock(). /* Locking wrapper - Note the inverted logic on irda_lock().
* Those function basically return false if the lock is already in the * Those function basically return false if the lock is already in the
...@@ -37,9 +97,6 @@ ...@@ -37,9 +97,6 @@
#define irda_lock(lock) (! test_and_set_bit(0, (void *) (lock))) #define irda_lock(lock) (! test_and_set_bit(0, (void *) (lock)))
#define irda_unlock(lock) (test_and_clear_bit(0, (void *) (lock))) #define irda_unlock(lock) (test_and_clear_bit(0, (void *) (lock)))
/* Zero the notify structure */
void irda_notify_init(notify_t *notify);
#endif /* IRMOD_H */ #endif /* IRMOD_H */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* *
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -31,8 +32,8 @@ ...@@ -31,8 +32,8 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h> /* struct lsap_cb */
#include <net/irda/qos.h> #include <net/irda/qos.h> /* struct qos_info */
#include <net/irda/irqueue.h> #include <net/irda/irqueue.h>
#define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS #define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -27,15 +27,17 @@ ...@@ -27,15 +27,17 @@
#ifndef TIMER_H #ifndef TIMER_H
#define TIMER_H #define TIMER_H
#include <linux/netdevice.h> #include <linux/timer.h>
#include <asm/param.h> /* for HZ */ #include <asm/param.h> /* for HZ */
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap.h> /* A few forward declarations (to make compiler happy) */
#include <net/irda/irlmp.h> struct irlmp_cb;
#include <net/irda/irda_device.h> struct irlap_cb;
struct lsap_cb;
struct lap_cb;
/* /*
* Timeout definitions, some defined in IrLAP p. 92 * Timeout definitions, some defined in IrLAP p. 92
...@@ -81,8 +83,6 @@ inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); ...@@ -81,8 +83,6 @@ inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout);
void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout); void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout);
void irlap_stop_mbusy_timer(struct irlap_cb *); void irlap_stop_mbusy_timer(struct irlap_cb *);
struct lsap_cb;
struct lap_cb;
inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout);
inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout);
inline void irlmp_start_idle_timer(struct lap_cb *, int timeout); inline void irlmp_start_idle_timer(struct lap_cb *, int timeout);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h> /* iobuff_t */
#define BOF 0xc0 /* Beginning of frame */ #define BOF 0xc0 /* Beginning of frame */
#define XBOF 0xff #define XBOF 0xff
......
...@@ -48,27 +48,17 @@ ...@@ -48,27 +48,17 @@
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/if_arp.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/irda.h> #include <linux/irda.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <asm/ioctls.h> /* TIOCOUTQ, TIOCINQ */
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <net/sock.h> #include <net/sock.h>
#include <net/tcp.h> #include <net/tcp.h>
#include <net/irda/irda.h> #include <net/irda/af_irda.h>
#include <net/irda/iriap.h>
#include <net/irda/irias_object.h>
#include <net/irda/irlmp.h>
#include <net/irda/irttp.h>
#include <net/irda/discovery.h>
extern int irda_init(void);
extern void irda_cleanup(void);
extern int irlap_driver_rcv(struct sk_buff *, struct net_device *,
struct packet_type *);
static int irda_create(struct socket *sock, int protocol); static int irda_create(struct socket *sock, int protocol);
...@@ -83,10 +73,6 @@ static struct proto_ops irda_ultra_ops; ...@@ -83,10 +73,6 @@ static struct proto_ops irda_ultra_ops;
#define IRDA_MAX_HEADER (TTP_MAX_HEADER) #define IRDA_MAX_HEADER (TTP_MAX_HEADER)
#ifdef CONFIG_IRDA_DEBUG
__u32 irda_debug = IRDA_DEBUG_LEVEL;
#endif
/* /*
* Function irda_data_indication (instance, sap, skb) * Function irda_data_indication (instance, sap, skb)
* *
...@@ -2527,118 +2513,27 @@ SOCKOPS_WRAP(irda_ultra, PF_IRDA); ...@@ -2527,118 +2513,27 @@ SOCKOPS_WRAP(irda_ultra, PF_IRDA);
#endif /* CONFIG_IRDA_ULTRA */ #endif /* CONFIG_IRDA_ULTRA */
/* /*
* Function irda_device_event (this, event, ptr) * Function irsock_init (pro)
* *
* Called when a device is taken up or down * Initialize IrDA protocol
* *
*/ */
static int irda_device_event(struct notifier_block *this, unsigned long event, int __init irsock_init(void)
void *ptr)
{
struct net_device *dev = (struct net_device *) ptr;
/* Reject non IrDA devices */
if (dev->type != ARPHRD_IRDA)
return NOTIFY_DONE;
switch (event) {
case NETDEV_UP:
IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_UP\n");
/* irda_dev_device_up(dev); */
break;
case NETDEV_DOWN:
IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_DOWN\n");
/* irda_kill_by_device(dev); */
/* irda_rt_device_down(dev); */
/* irda_dev_device_down(dev); */
break;
default:
break;
}
return NOTIFY_DONE;
}
static struct packet_type irda_packet_type =
{
0, /* MUTTER ntohs(ETH_P_IRDA),*/
NULL,
irlap_driver_rcv,
NULL,
NULL,
};
static struct notifier_block irda_dev_notifier = {
irda_device_event,
NULL,
0
};
/*
* Function irda_proc_modcount (inode, fill)
*
* Use by the proc file system functions to prevent the irda module
* being removed while the use is standing in the net/irda directory
*/
void irda_proc_modcount(struct inode *inode, int fill)
{
#ifdef MODULE
#ifdef CONFIG_PROC_FS
if (fill)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
#endif /* CONFIG_PROC_FS */
#endif /* MODULE */
}
/*
* Function irda_proto_init (pro)
*
* Initialize IrDA protocol layer
*
*/
int __init irda_proto_init(void)
{ {
sock_register(&irda_family_ops); sock_register(&irda_family_ops);
irda_packet_type.type = htons(ETH_P_IRDA);
dev_add_pack(&irda_packet_type);
register_netdevice_notifier(&irda_dev_notifier);
irda_init();
irda_device_init();
return 0; return 0;
} }
late_initcall(irda_proto_init);
/* /*
* Function irda_proto_cleanup (void) * Function irsock_cleanup (void)
* *
* Remove IrDA protocol layer * Remove IrDA protocol
* *
*/ */
#ifdef MODULE void __exit irsock_cleanup(void)
void irda_proto_cleanup(void)
{ {
irda_packet_type.type = htons(ETH_P_IRDA);
dev_remove_pack(&irda_packet_type);
unregister_netdevice_notifier(&irda_dev_notifier);
sock_unregister(PF_IRDA); sock_unregister(PF_IRDA);
irda_cleanup();
return; return;
} }
module_exit(irda_proto_cleanup);
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("The Linux IrDA Protocol Subsystem");
MODULE_LICENSE("GPL");
#ifdef CONFIG_IRDA_DEBUG
MODULE_PARM(irda_debug, "1l");
#endif
#endif /* MODULE */
...@@ -76,8 +76,7 @@ int __init ircomm_init(void) ...@@ -76,8 +76,7 @@ int __init ircomm_init(void)
return 0; return 0;
} }
#ifdef MODULE void __exit ircomm_cleanup(void)
void ircomm_cleanup(void)
{ {
IRDA_DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
...@@ -87,7 +86,6 @@ void ircomm_cleanup(void) ...@@ -87,7 +86,6 @@ void ircomm_cleanup(void)
remove_proc_entry("ircomm", proc_irda); remove_proc_entry("ircomm", proc_irda);
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
} }
#endif /* MODULE */
/* /*
* Function ircomm_open (client_notify) * Function ircomm_open (client_notify)
...@@ -543,18 +541,9 @@ int ircomm_proc_read(char *buf, char **start, off_t offset, int len) ...@@ -543,18 +541,9 @@ int ircomm_proc_read(char *buf, char **start, off_t offset, int len)
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dag@brattli.net>"); MODULE_AUTHOR("Dag Brattli <dag@brattli.net>");
MODULE_DESCRIPTION("IrCOMM protocol"); MODULE_DESCRIPTION("IrCOMM protocol");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
int init_module(void) module_init(ircomm_init);
{ module_exit(ircomm_cleanup);
return ircomm_init();
}
void cleanup_module(void)
{
ircomm_cleanup();
}
#endif /* MODULE */
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h>
#include <net/irda/iriap.h> #include <net/irda/iriap.h>
#include <net/irda/irda_device.h> /* struct irda_skb_cb */
#include <net/irda/ircomm_event.h> #include <net/irda/ircomm_event.h>
#include <net/irda/ircomm_lmp.h> #include <net/irda/ircomm_lmp.h>
......
...@@ -141,8 +141,7 @@ int __init ircomm_tty_init(void) ...@@ -141,8 +141,7 @@ int __init ircomm_tty_init(void)
return 0; return 0;
} }
#ifdef MODULE static void __exit __ircomm_tty_cleanup(struct ircomm_tty_cb *self)
static void __ircomm_tty_cleanup(struct ircomm_tty_cb *self)
{ {
IRDA_DEBUG(0, __FUNCTION__ "()\n"); IRDA_DEBUG(0, __FUNCTION__ "()\n");
...@@ -161,7 +160,7 @@ static void __ircomm_tty_cleanup(struct ircomm_tty_cb *self) ...@@ -161,7 +160,7 @@ static void __ircomm_tty_cleanup(struct ircomm_tty_cb *self)
* Remove IrCOMM TTY layer/driver * Remove IrCOMM TTY layer/driver
* *
*/ */
void ircomm_tty_cleanup(void) void __exit ircomm_tty_cleanup(void)
{ {
int ret; int ret;
...@@ -175,7 +174,6 @@ void ircomm_tty_cleanup(void) ...@@ -175,7 +174,6 @@ void ircomm_tty_cleanup(void)
hashbin_delete(ircomm_tty, (FREE_FUNC) __ircomm_tty_cleanup); hashbin_delete(ircomm_tty, (FREE_FUNC) __ircomm_tty_cleanup);
} }
#endif /* MODULE */
/* /*
* Function ircomm_startup (self) * Function ircomm_startup (self)
...@@ -1390,23 +1388,9 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, ...@@ -1390,23 +1388,9 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("IrCOMM serial TTY driver"); MODULE_DESCRIPTION("IrCOMM serial TTY driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
int init_module(void) module_init(ircomm_tty_init);
{ module_exit(ircomm_tty_cleanup);
return ircomm_tty_init();
}
void cleanup_module(void)
{
ircomm_tty_cleanup();
}
#endif /* MODULE */
...@@ -55,19 +55,6 @@ ...@@ -55,19 +55,6 @@
#include <net/irda/timer.h> #include <net/irda/timer.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
extern int irtty_init(void);
extern int nsc_ircc_init(void);
extern int ircc_init(void);
extern int toshoboe_init(void);
extern int litelink_init(void);
extern int w83977af_init(void);
extern int esi_init(void);
extern int tekram_init(void);
extern int actisys_init(void);
extern int girbil_init(void);
extern int sa1100_irda_init(void);
extern int ep7211_ir_init(void);
static void __irda_task_delete(struct irda_task *task); static void __irda_task_delete(struct irda_task *task);
static hashbin_t *dongles = NULL; static hashbin_t *dongles = NULL;
...@@ -116,53 +103,13 @@ int __init irda_device_init( void) ...@@ -116,53 +103,13 @@ int __init irda_device_init( void)
return -ENOMEM; return -ENOMEM;
} }
/* /* We no longer initialise the driver ourselves here, we let
* Call the init function of the device drivers that has not been * the system do it for us... - Jean II */
* compiled as a module
*/
#ifdef CONFIG_IRTTY_SIR
irtty_init();
#endif
#ifdef CONFIG_WINBOND_FIR
w83977af_init();
#endif
#ifdef CONFIG_SA1100_FIR
sa1100_irda_init();
#endif
#ifdef CONFIG_NSC_FIR
nsc_ircc_init();
#endif
#ifdef CONFIG_TOSHIBA_FIR
toshoboe_init();
#endif
#ifdef CONFIG_SMC_IRCC_FIR
ircc_init();
#endif
#ifdef CONFIG_ESI_DONGLE
esi_init();
#endif
#ifdef CONFIG_TEKRAM_DONGLE
tekram_init();
#endif
#ifdef CONFIG_ACTISYS_DONGLE
actisys_init();
#endif
#ifdef CONFIG_GIRBIL_DONGLE
girbil_init();
#endif
#ifdef CONFIG_LITELINK_DONGLE
litelink_init();
#endif
#ifdef CONFIG_OLD_BELKIN
old_belkin_init();
#endif
#ifdef CONFIG_EP7211_IR
ep7211_ir_init();
#endif
return 0; return 0;
} }
void irda_device_cleanup(void) void __exit irda_device_cleanup(void)
{ {
IRDA_DEBUG(4, __FUNCTION__ "()\n"); IRDA_DEBUG(4, __FUNCTION__ "()\n");
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irttp.h> #include <net/irda/irttp.h>
#include <net/irda/irmod.h>
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h>
#include <net/irda/irias_object.h> #include <net/irda/irias_object.h>
#include <net/irda/iriap_event.h> #include <net/irda/iriap_event.h>
...@@ -142,7 +141,7 @@ int __init iriap_init(void) ...@@ -142,7 +141,7 @@ int __init iriap_init(void)
* Initializes the IrIAP layer, called by the module cleanup code in * Initializes the IrIAP layer, called by the module cleanup code in
* irmod.c * irmod.c
*/ */
void iriap_cleanup(void) void __exit iriap_cleanup(void)
{ {
irlmp_unregister_service(service_handle); irlmp_unregister_service(service_handle);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/socket.h> #include <linux/socket.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irias_object.h> #include <net/irda/irias_object.h>
hashbin_t *objects = NULL; hashbin_t *objects = NULL;
......
...@@ -155,7 +155,7 @@ int __init irlan_init(void) ...@@ -155,7 +155,7 @@ int __init irlan_init(void)
return 0; return 0;
} }
void irlan_cleanup(void) void __exit irlan_cleanup(void)
{ {
IRDA_DEBUG(4, __FUNCTION__ "()\n"); IRDA_DEBUG(4, __FUNCTION__ "()\n");
...@@ -1194,8 +1194,6 @@ void irlan_mod_dec_use_count(void) ...@@ -1194,8 +1194,6 @@ void irlan_mod_dec_use_count(void)
#endif #endif
} }
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); MODULE_DESCRIPTION("The Linux IrDA LAN protocol");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1211,10 +1209,7 @@ MODULE_PARM_DESC(access, "Access type DIRECT=1, PEER=2, HOSTED=3"); ...@@ -1211,10 +1209,7 @@ MODULE_PARM_DESC(access, "Access type DIRECT=1, PEER=2, HOSTED=3");
* Initialize the IrLAN module, this function is called by the * Initialize the IrLAN module, this function is called by the
* modprobe(1) program. * modprobe(1) program.
*/ */
int init_module(void) module_init(irlan_init);
{
return irlan_init();
}
/* /*
* Function cleanup_module (void) * Function cleanup_module (void)
...@@ -1222,11 +1217,5 @@ int init_module(void) ...@@ -1222,11 +1217,5 @@ int init_module(void)
* Remove the IrLAN module, this function is called by the rmmod(1) * Remove the IrLAN module, this function is called by the rmmod(1)
* program * program
*/ */
void cleanup_module(void) module_exit(irlan_cleanup);
{
/* Free some memory */
irlan_cleanup();
}
#endif /* MODULE */
...@@ -89,7 +89,7 @@ int __init irlap_init(void) ...@@ -89,7 +89,7 @@ int __init irlap_init(void)
return 0; return 0;
} }
void irlap_cleanup(void) void __exit irlap_cleanup(void)
{ {
ASSERT(irlap != NULL, return;); ASSERT(irlap != NULL, return;);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <net/irda/irlap_frame.h> #include <net/irda/irlap_frame.h>
#include <net/irda/qos.h> #include <net/irda/qos.h>
#include <net/irda/parameters.h> #include <net/irda/parameters.h>
#include <net/irda/irlmp.h> /* irlmp_flow_indication(), ... */
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <linux/random.h> #include <linux/random.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/timer.h> #include <net/irda/timer.h>
#include <net/irda/qos.h> #include <net/irda/qos.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h>
...@@ -108,7 +107,7 @@ int __init irlmp_init(void) ...@@ -108,7 +107,7 @@ int __init irlmp_init(void)
* Remove IrLMP layer * Remove IrLMP layer
* *
*/ */
void irlmp_cleanup(void) void __exit irlmp_cleanup(void)
{ {
/* Check for main structure */ /* Check for main structure */
ASSERT(irlmp != NULL, return;); ASSERT(irlmp != NULL, return;);
......
...@@ -222,6 +222,9 @@ ...@@ -222,6 +222,9 @@
* o Fix race condition in irnet_connect_indication(). * o Fix race condition in irnet_connect_indication().
* If the socket was already trying to connect, drop old connection * If the socket was already trying to connect, drop old connection
* and use new one only if acting as primary. See comments. * and use new one only if acting as primary. See comments.
*
* v13 - 30.5.02 - Jean II
* o Update module init code
*/ */
/***************************** INCLUDES *****************************/ /***************************** INCLUDES *****************************/
...@@ -239,6 +242,7 @@ ...@@ -239,6 +242,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/ctype.h> /* isspace() */ #include <linux/ctype.h> /* isspace() */
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/init.h>
#include <linux/ppp_defs.h> #include <linux/ppp_defs.h>
#include <linux/if_ppp.h> #include <linux/if_ppp.h>
...@@ -502,16 +506,11 @@ extern int ...@@ -502,16 +506,11 @@ extern int
irda_irnet_init(void); /* Initialise IrDA part of IrNET */ irda_irnet_init(void); /* Initialise IrDA part of IrNET */
extern void extern void
irda_irnet_cleanup(void); /* Teardown IrDA part of IrNET */ irda_irnet_cleanup(void); /* Teardown IrDA part of IrNET */
/* --------------------------- PPP PART --------------------------- */
extern int
ppp_irnet_init(void); /* Initialise PPP part of IrNET */
extern void
ppp_irnet_cleanup(void); /* Teardown PPP part of IrNET */
/* ---------------------------- MODULE ---------------------------- */ /* ---------------------------- MODULE ---------------------------- */
extern int extern int
init_module(void); /* Initialise IrNET module */ irnet_init(void); /* Initialise IrNET module */
extern void extern void
cleanup_module(void); /* Teardown IrNET module */ irnet_cleanup(void); /* Teardown IrNET module */
/**************************** VARIABLES ****************************/ /**************************** VARIABLES ****************************/
......
...@@ -1801,7 +1801,7 @@ irnet_proc_read(char * buf, ...@@ -1801,7 +1801,7 @@ irnet_proc_read(char * buf,
/* /*
* Prepare the IrNET layer for operation... * Prepare the IrNET layer for operation...
*/ */
int int __init
irda_irnet_init(void) irda_irnet_init(void)
{ {
int err = 0; int err = 0;
...@@ -1844,7 +1844,7 @@ irda_irnet_init(void) ...@@ -1844,7 +1844,7 @@ irda_irnet_init(void)
/* /*
* Cleanup at exit... * Cleanup at exit...
*/ */
void void __exit
irda_irnet_cleanup(void) irda_irnet_cleanup(void)
{ {
DENTER(MODULE_TRACE, "()\n"); DENTER(MODULE_TRACE, "()\n");
......
...@@ -1040,7 +1040,7 @@ ppp_irnet_ioctl(struct ppp_channel * chan, ...@@ -1040,7 +1040,7 @@ ppp_irnet_ioctl(struct ppp_channel * chan,
* Hook our device callbacks in the filesystem, to connect our code * Hook our device callbacks in the filesystem, to connect our code
* to /dev/irnet * to /dev/irnet
*/ */
int static inline int __init
ppp_irnet_init(void) ppp_irnet_init(void)
{ {
int err = 0; int err = 0;
...@@ -1058,7 +1058,7 @@ ppp_irnet_init(void) ...@@ -1058,7 +1058,7 @@ ppp_irnet_init(void)
/* /*
* Cleanup at exit... * Cleanup at exit...
*/ */
void static inline void __exit
ppp_irnet_cleanup(void) ppp_irnet_cleanup(void)
{ {
DENTER(MODULE_TRACE, "()\n"); DENTER(MODULE_TRACE, "()\n");
...@@ -1069,13 +1069,12 @@ ppp_irnet_cleanup(void) ...@@ -1069,13 +1069,12 @@ ppp_irnet_cleanup(void)
DEXIT(MODULE_TRACE, "\n"); DEXIT(MODULE_TRACE, "\n");
} }
#ifdef MODULE
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* /*
* Module main entry point * Module main entry point
*/ */
int int __init
init_module(void) irnet_init(void)
{ {
int err; int err;
...@@ -1090,11 +1089,19 @@ init_module(void) ...@@ -1090,11 +1089,19 @@ init_module(void)
/* /*
* Module exit * Module exit
*/ */
void void __exit
cleanup_module(void) irnet_cleanup(void)
{ {
irda_irnet_cleanup(); irda_irnet_cleanup();
return ppp_irnet_cleanup(); return ppp_irnet_cleanup();
} }
#endif /* MODULE */
/*------------------------------------------------------------------*/
/*
* Module magic
*/
module_init(irnet_init);
module_exit(irnet_cleanup);
MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>");
MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#define __NO_VERSION__ #define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h>
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h>
...@@ -62,7 +62,7 @@ static struct irda_entry dir[] = { ...@@ -62,7 +62,7 @@ static struct irda_entry dir[] = {
* Register irda entry in /proc file system * Register irda entry in /proc file system
* *
*/ */
void irda_proc_register(void) void __init irda_proc_register(void)
{ {
int i; int i;
...@@ -81,7 +81,7 @@ void irda_proc_register(void) ...@@ -81,7 +81,7 @@ void irda_proc_register(void)
* Unregister irda entry in /proc file system * Unregister irda entry in /proc file system
* *
*/ */
void irda_proc_unregister(void) void __exit irda_proc_unregister(void)
{ {
int i; int i;
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irqueue.h> #include <net/irda/irqueue.h>
#include <net/irda/irmod.h>
static irda_queue_t *dequeue_general( irda_queue_t **queue, irda_queue_t* element); static irda_queue_t *dequeue_general( irda_queue_t **queue, irda_queue_t* element);
static __u32 hash( char* name); static __u32 hash( char* name);
......
...@@ -30,10 +30,9 @@ ...@@ -30,10 +30,9 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/if_arp.h> /* ARPHRD_IRDA */
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h>
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h>
#include <net/irda/iriap.h> #include <net/irda/iriap.h>
...@@ -63,6 +62,11 @@ extern int ircomm_tty_init(void); ...@@ -63,6 +62,11 @@ extern int ircomm_tty_init(void);
extern int irlpt_client_init(void); extern int irlpt_client_init(void);
extern int irlpt_server_init(void); extern int irlpt_server_init(void);
extern int irsock_init(void);
extern void irsock_cleanup(void);
extern int irlap_driver_rcv(struct sk_buff *, struct net_device *,
struct packet_type *);
/* IrTTP */ /* IrTTP */
EXPORT_SYMBOL(irttp_open_tsap); EXPORT_SYMBOL(irttp_open_tsap);
EXPORT_SYMBOL(irttp_close_tsap); EXPORT_SYMBOL(irttp_close_tsap);
...@@ -168,45 +172,142 @@ EXPORT_SYMBOL(irtty_unregister_dongle); ...@@ -168,45 +172,142 @@ EXPORT_SYMBOL(irtty_unregister_dongle);
EXPORT_SYMBOL(irtty_set_packet_mode); EXPORT_SYMBOL(irtty_set_packet_mode);
#endif #endif
#ifdef CONFIG_IRDA_DEBUG
__u32 irda_debug = IRDA_DEBUG_LEVEL;
#endif
static struct packet_type irda_packet_type =
{
0, /* MUTTER ntohs(ETH_P_IRDA),*/
NULL,
irlap_driver_rcv,
NULL,
NULL,
};
/*
* Function irda_device_event (this, event, ptr)
*
* Called when a device is taken up or down
*
*/
static int irda_device_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct net_device *dev = (struct net_device *) ptr;
/* Reject non IrDA devices */
if (dev->type != ARPHRD_IRDA)
return NOTIFY_DONE;
switch (event) {
case NETDEV_UP:
IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_UP\n");
/* irda_dev_device_up(dev); */
break;
case NETDEV_DOWN:
IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_DOWN\n");
/* irda_kill_by_device(dev); */
/* irda_rt_device_down(dev); */
/* irda_dev_device_down(dev); */
break;
default:
break;
}
return NOTIFY_DONE;
}
static struct notifier_block irda_dev_notifier = {
irda_device_event,
NULL,
0
};
/*
* Function irda_notify_init (notify)
*
* Used for initializing the notify structure
*
*/
void irda_notify_init(notify_t *notify)
{
notify->data_indication = NULL;
notify->udata_indication = NULL;
notify->connect_confirm = NULL;
notify->connect_indication = NULL;
notify->disconnect_indication = NULL;
notify->flow_indication = NULL;
notify->status_indication = NULL;
notify->instance = NULL;
strncpy(notify->name, "Unknown", NOTIFY_MAX_NAME);
}
/*
* Function irda_init (void)
*
* Protocol stack intialisation entry point.
* Initialise the various components of the IrDA stack
*/
int __init irda_init(void) int __init irda_init(void)
{ {
IRDA_DEBUG(0, __FUNCTION__ "()\n"); IRDA_DEBUG(0, __FUNCTION__ "()\n");
/* Lower layer of the stack */
irlmp_init(); irlmp_init();
irlap_init(); irlap_init();
/* Higher layers of the stack */
iriap_init(); iriap_init();
irttp_init(); irttp_init();
irsock_init();
/* Add IrDA packet type (Start receiving packets) */
irda_packet_type.type = htons(ETH_P_IRDA);
dev_add_pack(&irda_packet_type);
/* Notifier for Interface changes */
register_netdevice_notifier(&irda_dev_notifier);
/* External APIs */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
irda_proc_register(); irda_proc_register();
#endif #endif
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
irda_sysctl_register(); irda_sysctl_register();
#endif #endif
/*
* Initialize modules that got compiled into the kernel /* Driver/dongle support */
*/ irda_device_init();
#ifdef CONFIG_IRLAN
irlan_init();
#endif
#ifdef CONFIG_IRCOMM
ircomm_init();
ircomm_tty_init();
#endif
return 0; return 0;
} }
/*
* Function irda_cleanup (void)
*
* Protocol stack cleanup/removal entry point.
* Cleanup the various components of the IrDA stack
*/
void __exit irda_cleanup(void) void __exit irda_cleanup(void)
{ {
/* Remove External APIs */
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
irda_sysctl_unregister(); irda_sysctl_unregister();
#endif #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
irda_proc_unregister(); irda_proc_unregister();
#endif #endif
/* Remove IrDA packet type (stop receiving packets) */
irda_packet_type.type = htons(ETH_P_IRDA);
dev_remove_pack(&irda_packet_type);
/* Stop receiving interfaces notifications */
unregister_netdevice_notifier(&irda_dev_notifier);
/* Remove higher layers */ /* Remove higher layers */
irsock_cleanup();
irttp_cleanup(); irttp_cleanup();
iriap_cleanup(); iriap_cleanup();
...@@ -219,21 +320,24 @@ void __exit irda_cleanup(void) ...@@ -219,21 +320,24 @@ void __exit irda_cleanup(void)
} }
/* /*
* Function irda_notify_init (notify) * The IrDA stack must be initialised *before* drivers get initialised,
* and *before* higher protocols (IrLAN/IrCOMM/IrNET) get initialised,
* otherwise bad things will happen (hashbins will be NULL for example).
* Those modules are at module_init()/device_initcall() level.
* *
* Used for initializing the notify structure * On the other hand, it needs to be initialised *after* the basic
* networking, the /proc/net filesystem and sysctl module. Those are
* currently initialised in .../init/main.c (before initcalls).
* Also, it needs to be initialised *after* the random number generator.
* *
* Jean II
*/ */
void irda_notify_init(notify_t *notify) subsys_initcall(irda_init);
{ module_exit(irda_cleanup);
notify->data_indication = NULL;
notify->udata_indication = NULL; MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>");
notify->connect_confirm = NULL; MODULE_DESCRIPTION("The Linux IrDA Protocol Stack");
notify->connect_indication = NULL; MODULE_LICENSE("GPL");
notify->disconnect_indication = NULL; #ifdef CONFIG_IRDA_DEBUG
notify->flow_indication = NULL; MODULE_PARM(irda_debug, "1l");
notify->status_indication = NULL; #endif
notify->instance = NULL;
strncpy(notify->name, "Unknown", NOTIFY_MAX_NAME);
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/init.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irias_object.h> #include <net/irda/irias_object.h>
...@@ -156,7 +157,7 @@ static struct ctl_table_header *irda_table_header; ...@@ -156,7 +157,7 @@ static struct ctl_table_header *irda_table_header;
* Register our sysctl interface * Register our sysctl interface
* *
*/ */
int irda_sysctl_register(void) int __init irda_sysctl_register(void)
{ {
irda_table_header = register_sysctl_table(irda_root_table, 0); irda_table_header = register_sysctl_table(irda_root_table, 0);
if (!irda_table_header) if (!irda_table_header)
...@@ -171,7 +172,7 @@ int irda_sysctl_register(void) ...@@ -171,7 +172,7 @@ int irda_sysctl_register(void)
* Unregister our sysctl interface * Unregister our sysctl interface
* *
*/ */
void irda_sysctl_unregister(void) void __exit irda_sysctl_unregister(void)
{ {
unregister_sysctl_table(irda_table_header); unregister_sysctl_table(irda_table_header);
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h>
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h>
#include <net/irda/parameters.h> #include <net/irda/parameters.h>
...@@ -107,8 +106,7 @@ int __init irttp_init(void) ...@@ -107,8 +106,7 @@ int __init irttp_init(void)
* Called by module destruction/cleanup code * Called by module destruction/cleanup code
* *
*/ */
#ifdef MODULE void __exit irttp_cleanup(void)
void irttp_cleanup(void)
{ {
/* Check for main structure */ /* Check for main structure */
ASSERT(irttp != NULL, return;); ASSERT(irttp != NULL, return;);
...@@ -126,7 +124,6 @@ void irttp_cleanup(void) ...@@ -126,7 +124,6 @@ void irttp_cleanup(void)
irttp = NULL; irttp = NULL;
} }
#endif
/*************************** SUBROUTINES ***************************/ /*************************** SUBROUTINES ***************************/
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irtty.h> #include <net/irda/irtty.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h>
#include <net/irda/irlmp_event.h> #include <net/irda/irlmp.h>
static void irlap_slot_timer_expired(void* data); static void irlap_slot_timer_expired(void* data);
static void irlap_query_timer_expired(void* data); static void irlap_query_timer_expired(void* data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment