patch-2.2.15 linux/net/irda/irmod.c
Next file: linux/net/irda/irproc.c
Previous file: linux/net/irda/irlpt/irlpt_srvr_fsm.c
Back to the patch index
Back to the overall index
- Lines: 400
- Date:
Fri Apr 21 12:47:16 2000
- Orig file:
v2.2.14/net/irda/irmod.c
- Orig date:
Tue Jan 4 21:19:03 2000
diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/net/irda/irmod.c linux/net/irda/irmod.c
@@ -6,10 +6,10 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Dec 15 13:55:39 1997
- * Modified at: Fri May 14 13:46:02 1999
+ * Modified at: Mon Jan 17 11:21:56 2000
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved.
+ * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -27,10 +27,10 @@
#include <linux/init.h>
#include <linux/poll.h>
-#include <asm/segment.h>
-
#include <linux/proc_fs.h>
+#include <asm/segment.h>
+
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/irlap.h>
@@ -44,6 +44,7 @@
#include <net/irda/irda_device.h>
#include <net/irda/wrapper.h>
#include <net/irda/timer.h>
+#include <net/irda/parameters.h>
extern struct proc_dir_entry *proc_irda;
@@ -66,7 +67,7 @@
extern int irlan_client_init(void);
extern int irlan_server_init(void);
extern int ircomm_init(void);
-extern int irvtd_init(void);
+extern int ircomm_tty_init(void);
extern int irlpt_client_init(void);
extern int irlpt_server_init(void);
@@ -122,8 +123,15 @@
#ifdef CONFIG_PROC_FS
EXPORT_SYMBOL(proc_irda);
#endif
+EXPORT_SYMBOL(irda_param_insert);
+EXPORT_SYMBOL(irda_param_extract);
+EXPORT_SYMBOL(irda_param_extract_all);
+EXPORT_SYMBOL(irda_param_pack);
+EXPORT_SYMBOL(irda_param_unpack);
/* IrIAP/IrIAS */
+EXPORT_SYMBOL(iriap_open);
+EXPORT_SYMBOL(iriap_close);
EXPORT_SYMBOL(iriap_getvaluebyclass_request);
EXPORT_SYMBOL(irias_object_change_attribute);
EXPORT_SYMBOL(irias_add_integer_attrib);
@@ -132,6 +140,7 @@
EXPORT_SYMBOL(irias_insert_object);
EXPORT_SYMBOL(irias_new_object);
EXPORT_SYMBOL(irias_delete_object);
+EXPORT_SYMBOL(irias_delete_value);
EXPORT_SYMBOL(irias_find_object);
EXPORT_SYMBOL(irias_find_attrib);
EXPORT_SYMBOL(irias_new_integer_value);
@@ -167,42 +176,50 @@
EXPORT_SYMBOL(hashbin_get_first);
/* IrLAP */
+EXPORT_SYMBOL(irlap_open);
+EXPORT_SYMBOL(irlap_close);
#ifdef CONFIG_IRDA_COMPRESSION
EXPORT_SYMBOL(irda_unregister_compressor);
EXPORT_SYMBOL(irda_register_compressor);
#endif /* CONFIG_IRDA_COMPRESSION */
EXPORT_SYMBOL(irda_init_max_qos_capabilies);
EXPORT_SYMBOL(irda_qos_bits_to_value);
-EXPORT_SYMBOL(irda_device_open);
-EXPORT_SYMBOL(irda_device_close);
EXPORT_SYMBOL(irda_device_setup);
EXPORT_SYMBOL(irda_device_set_media_busy);
EXPORT_SYMBOL(irda_device_txqueue_empty);
-EXPORT_SYMBOL(irda_device_init_dongle);
+EXPORT_SYMBOL(irda_device_dongle_init);
+EXPORT_SYMBOL(irda_device_dongle_cleanup);
EXPORT_SYMBOL(irda_device_register_dongle);
EXPORT_SYMBOL(irda_device_unregister_dongle);
+EXPORT_SYMBOL(irda_task_execute);
+EXPORT_SYMBOL(irda_task_kick);
+EXPORT_SYMBOL(irda_task_next_state);
+EXPORT_SYMBOL(irda_task_delete);
EXPORT_SYMBOL(async_wrap_skb);
EXPORT_SYMBOL(async_unwrap_char);
EXPORT_SYMBOL(irda_start_timer);
-/* EXPORT_SYMBOL(irda_get_mtt); */
EXPORT_SYMBOL(setup_dma);
+EXPORT_SYMBOL(infrared_mode);
#ifdef CONFIG_IRTTY
EXPORT_SYMBOL(irtty_set_dtr_rts);
EXPORT_SYMBOL(irtty_register_dongle);
EXPORT_SYMBOL(irtty_unregister_dongle);
+EXPORT_SYMBOL(irtty_set_packet_mode);
#endif
-__initfunc(int irda_init(void))
+int __init irda_init(void)
{
- printk(KERN_INFO "IrDA (tm) Protocols for Linux-2.2 (Dag Brattli)\n");
-
+ MESSAGE("IrDA (tm) Protocols for Linux-2.2 (Dag Brattli)\n");
+
irlmp_init();
irlap_init();
- irda_device_init();
-
+
+#ifdef MODULE
+ irda_device_init(); /* Called by init/main.c when non-modular */
+#endif
iriap_init();
irttp_init();
@@ -212,12 +229,11 @@
#ifdef CONFIG_SYSCTL
irda_sysctl_register();
#endif
-
irda.dev.minor = MISC_DYNAMIC_MINOR;
irda.dev.name = "irda";
irda.dev.fops = &irda_fops;
- misc_register( &irda.dev);
+ misc_register(&irda.dev);
irda.in_use = FALSE;
@@ -229,15 +245,7 @@
#endif
#ifdef CONFIG_IRCOMM
ircomm_init();
- irvtd_init();
-#endif
-
-#ifdef CONFIG_IRLPT_CLIENT
- irlpt_client_init();
-#endif
-
-#ifdef CONFIG_IRLPT_SERVER
- irlpt_server_init();
+ ircomm_tty_init();
#endif
#ifdef CONFIG_IRDA_COMPRESSION
@@ -252,7 +260,7 @@
#ifdef MODULE
void irda_cleanup(void)
{
- misc_deregister( &irda.dev);
+ misc_deregister(&irda.dev);
#ifdef CONFIG_SYSCTL
irda_sysctl_unregister();
@@ -261,7 +269,6 @@
#ifdef CONFIG_PROC_FS
irda_proc_unregister();
#endif
-
/* Remove higher layers */
irttp_cleanup();
iriap_cleanup();
@@ -296,7 +303,7 @@
* Used for initializing the notify structure
*
*/
-void irda_notify_init( struct notify_t *notify)
+void irda_notify_init(notify_t *notify)
{
notify->data_indication = NULL;
notify->udata_indication = NULL;
@@ -305,7 +312,7 @@
notify->disconnect_indication = NULL;
notify->flow_indication = NULL;
notify->instance = NULL;
- strncpy( notify->name, "Unknown", NOTIFY_MAX_NAME);
+ strncpy(notify->name, "Unknown", NOTIFY_MAX_NAME);
}
/*
@@ -322,10 +329,8 @@
struct irmanager_event event;
/* Make sure irmanager is running */
- if ( !irda.in_use) {
- printk( KERN_ERR "irmanager is not running!\n");
+ if (!irda.in_use)
return;
- }
/* Make new todo event */
new = (struct irda_todo *) kmalloc( sizeof(struct irda_todo),
@@ -340,12 +345,12 @@
new->param = param;
/* Queue todo */
- enqueue_last( &irda.todo_queue, (QUEUE *) new);
+ enqueue_last(&irda.todo_queue, (queue_t *) new);
event.event = EVENT_NEED_PROCESS_CONTEXT;
/* Notify the user space manager */
- irmanager_notify( &event);
+ irmanager_notify(&event);
}
/*
@@ -358,13 +363,11 @@
{
struct irda_event *new;
- DEBUG( 4, __FUNCTION__ "()\n");
-
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
+
/* Make sure irmanager is running */
- if ( !irda.in_use) {
- printk( KERN_ERR "irmanager is not running!\n");
+ if (!irda.in_use)
return;
- }
/* Make new IrDA Event */
new = (struct irda_event *) kmalloc( sizeof(struct irda_event),
@@ -372,28 +375,29 @@
if ( new == NULL) {
return;
}
- memset( new, 0, sizeof( struct irda_event));
+ memset(new, 0, sizeof( struct irda_event));
new->event = *event;
/* Queue event */
- enqueue_last( &irda.event_queue, (QUEUE *) new);
+ enqueue_last(&irda.event_queue, (queue_t *) new);
/* Wake up irmanager sleeping on read */
- wake_up_interruptible( &irda.wait_queue);
+ wake_up_interruptible(&irda.wait_queue);
}
static int irda_open( struct inode * inode, struct file *file)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
- if ( irda.in_use) {
- DEBUG( 0, __FUNCTION__ "(), irmanager is already running!\n");
+ if (irda.in_use) {
+ IRDA_DEBUG(0, __FUNCTION__
+ "(), irmanager is already running!\n");
return -1;
}
irda.in_use = TRUE;
MOD_INC_USE_COUNT;
-
+
return 0;
}
@@ -403,62 +407,62 @@
* Ioctl, used by irmanager to ...
*
*/
-static int irda_ioctl( struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+static int irda_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
{
struct irda_todo *todo;
int err = 0;
int size = _IOC_SIZE(cmd);
-
- DEBUG( 4, __FUNCTION__ "()\n");
-
- if ( _IOC_DIR(cmd) & _IOC_READ)
+
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
+
+ if (_IOC_DIR(cmd) & _IOC_READ)
err = verify_area( VERIFY_WRITE, (void *) arg, size);
- else if ( _IOC_DIR(cmd) & _IOC_WRITE)
+ else if (_IOC_DIR(cmd) & _IOC_WRITE)
err = verify_area( VERIFY_READ, (void *) arg, size);
- if ( err)
+ if (err)
return err;
- switch( cmd) {
+ switch (cmd) {
case IRMGR_IOCTNPC:
/* Got process context! */
- DEBUG( 4, __FUNCTION__ "(), got process context!\n");
-
- while (( todo = (struct irda_todo *) dequeue_first(
+ IRDA_DEBUG(4, __FUNCTION__ "(), got process context!\n");
+
+ while ((todo = (struct irda_todo *) dequeue_first(
&irda.todo_queue)) != NULL)
{
- todo->callback( todo->self, todo->param);
+ todo->callback(todo->self, todo->param);
- kfree( todo);
+ kfree(todo);
}
break;
default:
return -ENOIOCTLCMD;
}
-
+
return 0;
}
-static int irda_close( struct inode *inode, struct file *file)
+static int irda_close(struct inode *inode, struct file *file)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
MOD_DEC_USE_COUNT;
-
+
irda.in_use = FALSE;
return 0;
}
-static ssize_t irda_read( struct file *file, char *buffer, size_t count,
- loff_t *noidea)
+static ssize_t irda_read(struct file *file, char *buffer, size_t count,
+ loff_t *noidea)
{
struct irda_event *event;
unsigned long flags;
int len;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* * Go to sleep and wait for event if there is no event to be read! */
save_flags( flags);
@@ -471,31 +475,33 @@
* Ensure proper reaction to signals, and screen out
* blocked signals (page 112. linux device drivers)
*/
- if ( signal_pending( current))
+ if (signal_pending( current))
return -ERESTARTSYS;
event = (struct irda_event *) dequeue_first( &irda.event_queue);
+ if (!event)
+ return 0;
len = sizeof(struct irmanager_event);
- copy_to_user( buffer, &event->event, len);
+ copy_to_user(buffer, &event->event, len);
/* Finished with event */
- kfree( event);
+ kfree(event);
return len;
}
-static ssize_t irda_write( struct file *file, const char *buffer,
- size_t count, loff_t *noidea)
+static ssize_t irda_write(struct file *file, const char *buffer,
+ size_t count, loff_t *noidea)
{
- DEBUG( 0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
return 0;
}
-static u_int irda_poll( struct file *file, poll_table *wait)
+static u_int irda_poll(struct file *file, poll_table *wait)
{
- DEBUG( 0, __FUNCTION__ "(), Sorry not implemented yet!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Sorry not implemented yet!\n");
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)