@@ -41,17 +41,18 @@ struct cma cma_areas[MAX_CMA_AREAS];
4141unsigned cma_area_count ;
4242static DEFINE_MUTEX (cma_mutex );
4343
44- phys_addr_t cma_get_base (struct cma * cma )
44+ phys_addr_t cma_get_base (const struct cma * cma )
4545{
4646 return PFN_PHYS (cma -> base_pfn );
4747}
4848
49- unsigned long cma_get_size (struct cma * cma )
49+ unsigned long cma_get_size (const struct cma * cma )
5050{
5151 return cma -> count << PAGE_SHIFT ;
5252}
5353
54- static unsigned long cma_bitmap_aligned_mask (struct cma * cma , int align_order )
54+ static unsigned long cma_bitmap_aligned_mask (const struct cma * cma ,
55+ int align_order )
5556{
5657 if (align_order <= cma -> order_per_bit )
5758 return 0 ;
@@ -62,7 +63,8 @@ static unsigned long cma_bitmap_aligned_mask(struct cma *cma, int align_order)
6263 * Find a PFN aligned to the specified order and return an offset represented in
6364 * order_per_bits.
6465 */
65- static unsigned long cma_bitmap_aligned_offset (struct cma * cma , int align_order )
66+ static unsigned long cma_bitmap_aligned_offset (const struct cma * cma ,
67+ int align_order )
6668{
6769 if (align_order <= cma -> order_per_bit )
6870 return 0 ;
@@ -71,13 +73,14 @@ static unsigned long cma_bitmap_aligned_offset(struct cma *cma, int align_order)
7173 - cma -> base_pfn ) >> cma -> order_per_bit ;
7274}
7375
74- static unsigned long cma_bitmap_pages_to_bits (struct cma * cma ,
75- unsigned long pages )
76+ static unsigned long cma_bitmap_pages_to_bits (const struct cma * cma ,
77+ unsigned long pages )
7678{
7779 return ALIGN (pages , 1UL << cma -> order_per_bit ) >> cma -> order_per_bit ;
7880}
7981
80- static void cma_clear_bitmap (struct cma * cma , unsigned long pfn , int count )
82+ static void cma_clear_bitmap (struct cma * cma , unsigned long pfn ,
83+ unsigned int count )
8184{
8285 unsigned long bitmap_no , bitmap_count ;
8386
@@ -162,7 +165,8 @@ core_initcall(cma_init_reserved_areas);
162165 * This function creates custom contiguous area from already reserved memory.
163166 */
164167int __init cma_init_reserved_mem (phys_addr_t base , phys_addr_t size ,
165- int order_per_bit , struct cma * * res_cma )
168+ unsigned int order_per_bit ,
169+ struct cma * * res_cma )
166170{
167171 struct cma * cma ;
168172 phys_addr_t alignment ;
@@ -353,7 +357,7 @@ int __init cma_declare_contiguous(phys_addr_t base,
353357 * This function allocates part of contiguous memory on specific
354358 * contiguous memory area.
355359 */
356- struct page * cma_alloc (struct cma * cma , int count , unsigned int align )
360+ struct page * cma_alloc (struct cma * cma , unsigned int count , unsigned int align )
357361{
358362 unsigned long mask , offset , pfn , start = 0 ;
359363 unsigned long bitmap_maxno , bitmap_no , bitmap_count ;
@@ -424,7 +428,7 @@ struct page *cma_alloc(struct cma *cma, int count, unsigned int align)
424428 * It returns false when provided pages do not belong to contiguous area and
425429 * true otherwise.
426430 */
427- bool cma_release (struct cma * cma , struct page * pages , int count )
431+ bool cma_release (struct cma * cma , const struct page * pages , unsigned int count )
428432{
429433 unsigned long pfn ;
430434
0 commit comments