/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to driver/kmem.c

  • Committer: Suren A. Chilingaryan
  • Date: 2015-11-20 13:24:17 UTC
  • Revision ID: csa@suren.me-20151120132417-fzm9hulvh7rs47gb
Configure number of DMA buffers in IPEDMA and improve checking and reporting inconsistent kmem buffers while re-using

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
                } else {
54
54
                    if (kmem_handle->type != kmem_entry->type) {
55
55
                        mod_info("Invalid type of reusable kmem_entry, currently: %lu, but requested: %lu\n", kmem_entry->type, kmem_handle->type);
 
56
                        kmem_handle->type = kmem_entry->type;
56
57
                        return -EINVAL;
57
58
                    }
58
59
 
59
60
                    if (((kmem_handle->type&PCILIB_KMEM_TYPE_MASK) == PCILIB_KMEM_TYPE_PAGE)&&(kmem_handle->size == 0)) {
60
 
                            kmem_handle->size = kmem_entry->size;
 
61
                        kmem_handle->size = kmem_entry->size;
61
62
                    } else if (kmem_handle->size != kmem_entry->size) {
62
63
                        mod_info("Invalid size of reusable kmem_entry, currently: %lu, but requested: %lu\n", kmem_entry->size, kmem_handle->size);
 
64
                        kmem_handle->size = kmem_entry->size;
63
65
                        return -EINVAL;
64
66
                    }
65
 
                    
 
67
 
66
68
                    if (kmem_handle->align != kmem_entry->align) {
67
69
                        mod_info("Invalid alignment of reusable kmem_entry, currently: %lu, but requested: %lu\n", kmem_entry->align, kmem_handle->align);
 
70
                        kmem_handle->align = kmem_entry->align;
68
71
                        return -EINVAL;
69
72
                    }
70
73
 
71
74
                    if (((kmem_entry->mode&KMEM_MODE_EXCLUSIVE)?1:0) != ((flags&KMEM_FLAG_EXCLUSIVE)?1:0)) {
72
75
                        mod_info("Invalid mode of reusable kmem_entry\n");
 
76
                        kmem_handle->flags = (kmem_entry->mode&KMEM_MODE_EXCLUSIVE)?KMEM_FLAG_EXCLUSIVE:0;
73
77
                        return -EINVAL;
74
78
                    }
75
79
                }