1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2c993487eSPaul Mundt #ifndef __ASM_SRAM_H 3c993487eSPaul Mundt #define __ASM_SRAM_H 4c993487eSPaul Mundt 5c993487eSPaul Mundt #ifdef CONFIG_HAVE_SRAM_POOL 6c993487eSPaul Mundt 7c993487eSPaul Mundt #include <linux/spinlock.h> 8c993487eSPaul Mundt #include <linux/genalloc.h> 9c993487eSPaul Mundt 10c993487eSPaul Mundt /* arch/sh/mm/sram.c */ 11c993487eSPaul Mundt extern struct gen_pool *sram_pool; 12c993487eSPaul Mundt sram_alloc(size_t len)13c993487eSPaul Mundtstatic inline unsigned long sram_alloc(size_t len) 14c993487eSPaul Mundt { 15c993487eSPaul Mundt if (!sram_pool) 16c993487eSPaul Mundt return 0UL; 17c993487eSPaul Mundt 18c993487eSPaul Mundt return gen_pool_alloc(sram_pool, len); 19c993487eSPaul Mundt } 20c993487eSPaul Mundt sram_free(unsigned long addr,size_t len)21c993487eSPaul Mundtstatic inline void sram_free(unsigned long addr, size_t len) 22c993487eSPaul Mundt { 23c993487eSPaul Mundt return gen_pool_free(sram_pool, addr, len); 24c993487eSPaul Mundt } 25c993487eSPaul Mundt 26c993487eSPaul Mundt #else 27c993487eSPaul Mundt sram_alloc(size_t len)28c993487eSPaul Mundtstatic inline unsigned long sram_alloc(size_t len) 29c993487eSPaul Mundt { 30c993487eSPaul Mundt return 0; 31c993487eSPaul Mundt } 32c993487eSPaul Mundt sram_free(unsigned long addr,size_t len)33c993487eSPaul Mundtstatic inline void sram_free(unsigned long addr, size_t len) 34c993487eSPaul Mundt { 35c993487eSPaul Mundt } 36c993487eSPaul Mundt 37c993487eSPaul Mundt #endif /* CONFIG_HAVE_SRAM_POOL */ 38c993487eSPaul Mundt 39c993487eSPaul Mundt #endif /* __ASM_SRAM_H */ 40