]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/open.c
reference count for device opens added (helps while asynchronous remove
[lincan.git] / lincan / src / open.c
index 535c2c3848134130ca6eb43d8c86df4a9af7994d..f0c3fd23c3c6de9f4daecadf01c8fa75848cc685 100644 (file)
@@ -82,6 +82,10 @@ int can_open(struct inode *inode, struct file *file)
                        CANMSG("Error initializing chip for receiving\n");
        }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
+       if (chip->hostdevice->hwspecops->release_device)
+               kref_get(&chip->hostdevice->refcount);
+#endif
 
        canuser = (struct canuser_t *)kmalloc(sizeof(struct canuser_t), GFP_KERNEL);
        if(canuser == NULL) goto no_canuser;