diff options
Diffstat (limited to 'gcip-kernel-driver/include/gcip/gcip-mem-pool.h')
-rw-r--r-- | gcip-kernel-driver/include/gcip/gcip-mem-pool.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gcip-kernel-driver/include/gcip/gcip-mem-pool.h b/gcip-kernel-driver/include/gcip/gcip-mem-pool.h index c770300..44ea5f5 100644 --- a/gcip-kernel-driver/include/gcip/gcip-mem-pool.h +++ b/gcip-kernel-driver/include/gcip/gcip-mem-pool.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * A simple memory allocator to help allocating reserved memory pools. * @@ -15,7 +15,7 @@ struct gcip_mem_pool { struct device *dev; struct gen_pool *gen_pool; - phys_addr_t base_paddr; + unsigned long base_addr; size_t granule; }; @@ -24,8 +24,7 @@ struct gcip_mem_pool { * * @pool: The memory pool object to be initialized. * @dev: Used for logging only. - * @base_paddr: The base physical address of the pool. Must be greater than 0 and a multiple of - * @granule. + * @base_addr: The base address of the pool. Must be greater than 0 and a multiple of @granule. * @size: The size of the pool. @size should be a multiple of @granule. * @granule: The granule when invoking the allocator. Should be a power of 2. * @@ -33,7 +32,7 @@ struct gcip_mem_pool { * * Call gcip_mem_pool_exit() to release the resources of @pool. */ -int gcip_mem_pool_init(struct gcip_mem_pool *pool, struct device *dev, phys_addr_t base_paddr, +int gcip_mem_pool_init(struct gcip_mem_pool *pool, struct device *dev, unsigned long base_addr, size_t size, size_t granule); /* * Releases resources of @pool. @@ -44,28 +43,28 @@ int gcip_mem_pool_init(struct gcip_mem_pool *pool, struct device *dev, phys_addr void gcip_mem_pool_exit(struct gcip_mem_pool *pool); /* - * Allocates and returns the allocated physical address. + * Allocates and returns the allocated address. * * @size: Size to be allocated. * * Returns the allocated address. Returns 0 on allocation failure. */ -phys_addr_t gcip_mem_pool_alloc(struct gcip_mem_pool *pool, size_t size); +unsigned long gcip_mem_pool_alloc(struct gcip_mem_pool *pool, size_t size); /* * Returns the address previously allocated by gcip_mem_pool_alloc(). * * The size and address must match what previously passed to / returned by gcip_mem_pool_alloc(). */ -void gcip_mem_pool_free(struct gcip_mem_pool *pool, phys_addr_t paddr, size_t size); +void gcip_mem_pool_free(struct gcip_mem_pool *pool, unsigned long addr, size_t size); /* - * Returns the offset between @paddr and @base_paddr passed to gcip_mem_pool_init(). + * Returns the offset between @addr and @base_addr passed to gcip_mem_pool_init(). * - * @paddr must be a value returned by gcip_mem_pool_alloc(). + * @addr must be a value returned by gcip_mem_pool_alloc(). */ -static inline size_t gcip_mem_pool_offset(struct gcip_mem_pool *pool, phys_addr_t paddr) +static inline size_t gcip_mem_pool_offset(struct gcip_mem_pool *pool, unsigned long addr) { - return paddr - pool->base_paddr; + return addr - pool->base_addr; } #endif /* __GCIP_MEM_POOL_H__ */ |