]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/src/close.c
The original version of Arnaud Westenberg Linux CAN-bus driver
[lincan.git] / lincan / src / close.c
1 /* close.c
2  * Linux CAN-bus device driver.
3  * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4  * This software is released under the GPL-License.
5  * Version 0.7  6 Aug 2001
6  */
7
8 #define __NO_VERSION__
9 #include <linux/module.h> 
10
11 #include <linux/autoconf.h>
12 #if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS)
13 #define MODVERSIONS
14 #endif
15
16 #if defined (MODVERSIONS)
17 #include <linux/modversions.h>
18 #endif
19
20 #include <linux/fs.h>
21
22 #include "../include/main.h"
23 #include "../include/close.h"
24 #include "../include/i82527.h"
25 #include "../include/setup.h"
26
27 int can_close(struct inode *inode, struct file *file)
28 {
29         /* Give up message buffer memory */
30         if (objects_p[MINOR_NR]->fifo->buf_tx_entry)
31                 del_mem_from_list(objects_p[MINOR_NR]->fifo->buf_tx_entry);
32         else
33                 CANMSG("objects_p[MINOR_NR]->fifo->buf_tx_entry is NULL\n");
34         if (objects_p[MINOR_NR]->fifo->buf_rx_entry)
35                 del_mem_from_list(objects_p[MINOR_NR]->fifo->buf_rx_entry);
36         else
37                 CANMSG("objects_p[MINOR_NR]->fifo->buf_rx_entry is NULL\n");
38
39 /* FIXME: what about clearing chip HW status, stopping sending messages etc? */
40         
41         objects_p[MINOR_NR]->flags &= ~OPENED;
42         MOD_DEC_USE_COUNT;
43
44         return 0;
45 }