2 * Linux CAN-bus device driver.
3 * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4 * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5 * email:pisa@cmp.felk.cvut.cz
6 * This software is released under the GPL-License.
7 * Version lincan-0.2 9 Jul 2003
10 #define __NO_VERSION__
11 #include <linux/module.h>
13 #include <linux/autoconf.h>
16 #include <linux/version.h>
17 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
18 #include <linux/malloc.h>
20 #include <linux/slab.h>
23 #include "../include/main.h"
24 #include "../include/close.h"
25 #include "../include/i82527.h"
26 #include "../include/setup.h"
28 int can_close(struct inode *inode, struct file *file)
30 struct canuser_t *canuser = (struct canuser_t*)(file->private_data);
31 struct canque_ends_t *qends;
34 if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
35 CANMSG("can_close: bad canuser magic\n");
39 obj = canuser->msgobj;
40 qends = canuser->qends;
42 list_del(&canuser->peers);
43 canqueue_ends_done_kern(qends, 1);
44 canuser->qends = NULL;
49 if(atomic_dec_and_test(&obj->obj_used)){
50 obj->flags &= ~OBJ_OPENED;
51 /* FIXME: what about clearing chip HW status, stopping sending messages etc? */
54 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,50))