X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/102b0fcc467c77d0a8f82cfee060353e3cf17261..c6d6f58c34e1b6a4c03d1e86d1abf48eeb6f5624:/lincan/src/proc.c diff --git a/lincan/src/proc.c b/lincan/src/proc.c index fb573be..254aabc 100644 --- a/lincan/src/proc.c +++ b/lincan/src/proc.c @@ -7,25 +7,15 @@ * Version lincan-0.2 9 Jul 2003 */ -#define __NO_VERSION__ -#include - -#include - -#include -#include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) -#include -#else -#include -#endif -#include -#include - +#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 + 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; ichannel[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");