--- /dev/null
+/* close.c
+ * Linux CAN-bus device driver.
+ * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
+ * This software is released under the GPL-License.
+ * Version 0.7 6 Aug 2001
+ */
+
+#define __NO_VERSION__
+#include <linux/module.h>
+
+#include <linux/autoconf.h>
+#if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS)
+#define MODVERSIONS
+#endif
+
+#if defined (MODVERSIONS)
+#include <linux/modversions.h>
+#endif
+
+#include <linux/fs.h>
+
+#include "../include/main.h"
+#include "../include/close.h"
+#include "../include/i82527.h"
+#include "../include/setup.h"
+
+int can_close(struct inode *inode, struct file *file)
+{
+ /* Give up message buffer memory */
+ if (objects_p[MINOR_NR]->fifo->buf_tx_entry)
+ del_mem_from_list(objects_p[MINOR_NR]->fifo->buf_tx_entry);
+ else
+ CANMSG("objects_p[MINOR_NR]->fifo->buf_tx_entry is NULL\n");
+ if (objects_p[MINOR_NR]->fifo->buf_rx_entry)
+ del_mem_from_list(objects_p[MINOR_NR]->fifo->buf_rx_entry);
+ else
+ CANMSG("objects_p[MINOR_NR]->fifo->buf_rx_entry is NULL\n");
+
+/* FIXME: what about clearing chip HW status, stopping sending messages etc? */
+
+ objects_p[MINOR_NR]->flags &= ~OPENED;
+ MOD_DEC_USE_COUNT;
+
+ return 0;
+}