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 #include "../include/can.h"
11 #include "../include/can_sysdep.h"
12 #include "../include/main.h"
13 #include "../include/close.h"
14 #include "../include/i82527.h"
15 #include "../include/setup.h"
17 #define __NO_VERSION__
18 #include <linux/module.h>
20 int can_close(struct inode *inode, struct file *file)
22 struct canuser_t *canuser = (struct canuser_t*)(file->private_data);
23 struct canque_ends_t *qends;
26 if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
27 CANMSG("can_close: bad canuser magic\n");
31 obj = canuser->msgobj;
32 qends = canuser->qends;
34 list_del(&canuser->peers);
35 canuser->qends = NULL;
36 canqueue_ends_dispose_kern(qends, file->f_flags & O_SYNC);
40 if(atomic_dec_and_test(&obj->obj_used)){
41 obj->flags &= ~OBJ_OPENED;
42 /* FIXME: what about clearing chip HW status, stopping sending messages etc? */
45 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,50))