+/**
+ * can_request_io_region - request IO space region
+ * @start: the first IO port address
+ * @n: number of the consecutive IO port addresses
+ * @name: name/label for the requested region
+ *
+ * The function hides system specific implementation of the feature.
+ *
+ * Return Value: returns positive value (1) in the case, that region could
+ * be reserved for the driver. Returns zero (0) if there is collision with
+ * other driver or region cannot be taken for some other reason.
+ */
+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
+}
+
+/**
+ * can_release_io_region - release IO space region
+ * @start: the first IO port address
+ * @n: number of the consecutive IO port addresses
+ */
+void can_release_io_region(unsigned long start, unsigned long n)
+{
+ release_region(start,n);
+}
+
+/**
+ * can_request_mem_region - request memory space region
+ * @start: the first memory port physical address
+ * @n: number of the consecutive memory port addresses
+ * @name: name/label for the requested region
+ *
+ * The function hides system specific implementation of the feature.
+ *
+ * Return Value: returns positive value (1) in the case, that region could
+ * be reserved for the driver. Returns zero (0) if there is collision with
+ * other driver or region cannot be taken for some other reason.
+ */
+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
+}
+
+/**
+ * can_release_mem_region - release memory space region
+ * @start: the first memory port physical address
+ * @n: number of the consecutive memory port addresses
+ */
+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
+}
+
+/**
+ * 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.
+ */
+int can_base_addr_fixup(struct candevice_t *candev, unsigned long new_base)
+{
+ unsigned long offs;
+ int i, j;
+
+ offs=new_base-candev->dev_base_addr;
+ candev->dev_base_addr=new_base;
+ for(i=0;i<candev->nr_all_chips;i++){
+ candev->chip[i]->chip_base_addr += offs;
+ for(j=0;j<candev->chip[i]->max_objects;j++)
+ candev->chip[i]->msgobj[j]->obj_base_addr += offs;
+ }
+ return 0;
+}
+
+
+/**
+ * register_obj_struct - registers message object into global array
+ * @obj: the initialized message object being registered
+ * @minorbase: wanted minor number, if (-1) automatically selected
+ *
+ * Return Value: returns negative number in the case of fail
+ */
+int register_obj_struct(struct msgobj_t *obj, int minorbase)
+{
+ static int next_minor=0;
+ int i;
+
+ if(minorbase>=0)
+ next_minor=minorbase;
+ if(next_minor>=MAX_TOT_MSGOBJS)
+ next_minor=0;
+ i=next_minor;
+ do{
+ if(objects_p[i]==NULL){
+ objects_p[i]=obj;
+ obj->minor=i;
+ next_minor=i+1;
+ return 0;
+ }
+ if(++i >= MAX_TOT_MSGOBJS) i=0;
+ }while(i!=next_minor);
+ obj->minor=-1;
+ return -1;
+}
+
+
+/**
+ * register_chip_struct - registers chip into global array
+ * @chip: the initialized chip structure being registered
+ * @minorbase: wanted minor number base, if (-1) automatically selected
+ *
+ * Return Value: returns negative number in the case of fail
+ */
+int register_chip_struct(struct chip_t *chip, int minorbase)
+{
+ static int next_chip_slot=0;
+ int i;
+
+ if(next_chip_slot>=MAX_TOT_CHIPS)
+ next_chip_slot=0;
+ i=next_chip_slot;
+ do{
+ if(chips_p[i]==NULL){
+ chips_p[i]=chip;
+
+ next_chip_slot=i+1;
+ return 0;
+ }
+ if(++i >= MAX_TOT_CHIPS) i=0;
+ }while(i!=next_chip_slot);
+ return -1;
+}
+
+
+
+/**
+ * init_hw_struct - initializes driver hardware description structures
+ *
+ * The function init_hw_struct() is used to initialize the hardware structure.
+ *
+ * Return Value: returns negative number in the case of fail
+ */