]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/proc.c
Header-files cleanup and CAN queue edges and ends locking reimplemented.
[lincan.git] / lincan / src / proc.c
index fb573be8cdfb99fdddeeda94810a9f5d376b8911..254aabcac3feb7944d39439dc17d6a15a662b401 100644 (file)
@@ -7,25 +7,15 @@
  * Version lincan-0.2  9 Jul 2003
  */ 
 
-#define __NO_VERSION__
-#include <linux/module.h>
-
-#include <linux/autoconf.h>
-
-#include <linux/version.h>
-#include <linux/kernel.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-#include <linux/malloc.h>
-#else
-#include <linux/slab.h>
-#endif
-#include <linux/proc_fs.h>
-#include <linux/version.h>
-
+#include "../include/can.h"
+#include "../include/can_sysdep.h"
 #include "../include/main.h"
 #include "../include/proc.h"
 #include "../include/setup.h"
 
+#define __NO_VERSION__
+#include <linux/module.h>
+
 int add_channel_to_procdir(struct candevice_t *candev);
 int remove_channel_from_procdir(void);
 int add_object_to_procdir(int chip_nr);
@@ -57,8 +47,8 @@ static struct proc_dir_entry * new_can_proc_entry(unsigned short inode,
 {
        struct proc_dir_entry *new_entry = NULL;
 
-       new_entry = (struct proc_dir_entry *) kmalloc(sizeof(struct 
-                                               proc_dir_entry), GFP_KERNEL);
+       new_entry = (struct proc_dir_entry *) 
+                       can_checked_malloc(sizeof(struct proc_dir_entry));
        if (new_entry == NULL)
                return NULL;
 
@@ -81,8 +71,7 @@ int can_remove_proc_entry(struct proc_dir_entry *del, struct proc_dir_entry *par
 {
        if (del != NULL) {
                proc_unregister(parent, del->low_ino);
-               kfree(del);
-               del = NULL;
+               can_checked_free(del);
                return 0;
        }
        else return -ENODEV;
@@ -136,11 +125,9 @@ int add_channel_to_procdir(struct candevice_t *candev)
        for (i=0; i < candev->nr_all_chips; i++) {
 
                base->channel[cc] = (struct channelproc_t *)
-                       kmalloc(sizeof(struct channelproc_t), GFP_KERNEL);
+                       can_checked_malloc(sizeof(struct channelproc_t));
                if (base->channel[cc] == NULL)
                        return -ENOMEM;
-               else if (add_mem_to_list(base->channel[cc]))
-                       return -ENOMEM;
 
                sprintf(base->channel[cc]->ch_name, "channel%d",cc);
                                                
@@ -195,13 +182,10 @@ int add_object_to_procdir(int chip_nr)
 
        for (i=0; i<max_objects; i++) {
                base->channel[chip_nr]->object[i] = (struct objectproc_t *)
-                       kmalloc(sizeof(struct objectproc_t),GFP_KERNEL);
-                               
-                               
+                       can_checked_malloc(sizeof(struct objectproc_t));
+
                if (base->channel[chip_nr]->object[i] == NULL)
                        return -ENOMEM;
-               else if (add_mem_to_list( base->channel[chip_nr]->object[i]))
-                       return -ENOMEM;
 
                sprintf(base->channel[chip_nr]->object[i]->obj_name,"object%d",i);
                sprintf(base->channel[chip_nr]->object[i]->lnk_name,"dev");