-int init_obj_struct(struct candevice_t *candev, struct chip_t *hostchip, int objnr);
-int init_chipspecops(struct candevice_t *candev, int chipnr);
-
-void *can_checked_malloc(size_t size)
-{
- struct mem_addr *mem_new;
- void *address_p;
-
- address_p=kmalloc(size,GFP_KERNEL);
- if(address_p == NULL) {
- CANMSG("can_checked_malloc: out of the memory\n");
- return NULL;
- }
-
-#ifdef DEBUG_MEM
- DEBUGMSG("can_checked_malloc: allocated %d bytes at %p, mem_head=%p\n",
- (int)size, address_p, mem_head);
-#endif
-
- mem_new=(struct mem_addr *)kmalloc(sizeof(struct mem_addr),GFP_KERNEL);
- if (mem_new == NULL) {
- CANMSG("can_checked_malloc: memory list allocation error.\n");
- kfree(address_p);
- return NULL;
- }
- mem_new->next=mem_head;
- mem_new->address=address_p;
- mem_new->size=size;
- mem_head=mem_new;
-
- return address_p;
-}
-
-int can_checked_free(void *address_p)
-{
- struct mem_addr **mem_pptr;
- struct mem_addr *mem_del=NULL;
-
-#ifdef DEBUG_MEM
- DEBUGMSG("can_checked_free %p, mem_head=%p\n", address_p, mem_head);
-#endif
-
- for(mem_pptr = &mem_head; (mem_del = *mem_pptr); mem_pptr = &mem_del->next) {
- if (mem_del->address != address_p)
- continue;
- *mem_pptr=mem_del->next;
- kfree(mem_del);
- kfree(address_p);
- return 0;
- }
-
- CANMSG("can_checked_free: address %p not found on the mem list\n", address_p);
-
- kfree(address_p);
- return -1;
-}
-
-
-int can_del_mem_list(void)
-{
- struct mem_addr *mem;
-
-#ifdef DEBUG_MEM
- DEBUGMSG("can_del_mem_list, mem_head=%p\n", mem_head);
-#endif
- if(mem_head == NULL) {
- CANMSG("can_del_mem_list: no entries on the list - OK\n");
- return 0;
- }
-
- while((mem=mem_head) != NULL) {
- mem_head=mem->next;
- CANMSG("can_del_mem_list: deleting %p with size %d\n",
- mem->address, (int)mem->size);
- kfree(mem->address);
- kfree(mem);
- }
-
- return 0;
-}
-
-int can_request_io_region(unsigned long start, unsigned long n, const char *name)
-{
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
- if(check_region(start,n)) return 0;
- request_region(start,n,name);
- return 1;
- #else
- return (request_region(start,n,name))?1:0;
- #endif
-}
-
-void can_release_io_region(unsigned long start, unsigned long n)
-{
- release_region(start,n);
-}
-
-int can_request_mem_region(unsigned long start, unsigned long n, const char *name)
-{
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
- return 1;
- #else
- return (request_mem_region(start,n,name))?1:0;
- #endif
-}
-
-void can_release_mem_region(unsigned long start, unsigned long n)
-{
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
- return;
- #else
- release_mem_region(start,n);
- #endif
-}
-
-/* This function shifts all base address structures acording to address
- translation between physical and virtual address mappings */
+int init_obj_struct(struct candevice_t *candev, struct canchip_t *hostchip, int objnr);
+
+/**
+ * can_base_addr_fixup - relocates board physical memory addresses to the CPU accessible ones
+ * @candev: pointer to the previously filled device/board, chips and message objects structures
+ * @new_base: @candev new base address
+ *
+ * This function adapts base addresses of all structures of one board
+ * to the new board base address.
+ * It is required for translation between physical and virtual address mappings.
+ * This function is prepared to simplify board specific xxx_request_io() function
+ * for memory mapped devices.
+ */