mm/mempool: Remove MM_MEMPOOL option from Kconfig

since the linker can remove the unused object file from the final image

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-11-06 00:44:53 +08:00 committed by Alan Carvalho de Assis
parent a446b5816f
commit 38d1244751
5 changed files with 7 additions and 21 deletions

View file

@ -114,7 +114,7 @@ static const struct procfs_entry_s g_procfs_entries[] =
# endif
#endif
#if defined(CONFIG_MM_MEMPOOL) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
{ "mempool", &mempool_operations, PROCFS_FILE_TYPE },
#endif

View file

@ -42,7 +42,7 @@ typedef CODE void *(*mempool_alloc_t)(FAR struct mempool_s *pool,
typedef CODE void (*mempool_free_t)(FAR struct mempool_s *pool,
FAR void *addr);
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
struct mempool_procfs_entry_s
{
FAR const char *name;
@ -70,7 +70,7 @@ struct mempool_s
size_t nused; /* The number of used block in mempool */
spinlock_t lock; /* The protect lock to mempool */
sem_t waitsem; /* The semaphore of waiter get free block */
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
struct mempool_procfs_entry_s procfs; /* The entry of procfs */
#endif
};
@ -195,7 +195,7 @@ int mempool_deinit(FAR struct mempool_s *pool);
*
****************************************************************************/
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
void mempool_procfs_register(FAR struct mempool_procfs_entry_s *entry,
FAR const char *name);
#endif
@ -211,7 +211,7 @@ void mempool_procfs_register(FAR struct mempool_procfs_entry_s *entry,
*
****************************************************************************/
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
void mempool_procfs_unregister(FAR struct mempool_procfs_entry_s *entry);
#endif

View file

@ -165,13 +165,6 @@ config MM_SHM
Build in support for the shared memory interfaces shmget(), shmat(),
shmctl(), and shmdt().
config MM_MEMPOOL
bool "Enable memory buffer pool"
default n
---help---
Memory buffer pool support. Such pools are mostly used
for guaranteed, deadlock-free memory allocations.
config FS_PROCFS_EXCLUDE_MEMPOOL
bool "Exclude mempool"
default DEFAULT_SMALL

View file

@ -20,22 +20,15 @@
# Memory buffer pool management
ifeq ($(CONFIG_MM_MEMPOOL),y)
CSRCS += mempool.c mempool_multiple.c
ifeq ($(CONFIG_FS_PROCFS),y)
ifneq ($(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL),y)
CSRCS += mempool_procfs.c
endif
endif
# Add the memory buffer pool directory to the build
DEPPATH += --dep-path mempool
VPATH += :mempool
endif

View file

@ -125,7 +125,7 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
nxsem_init(&pool->waitsem, 0, 0);
}
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
mempool_procfs_register(&pool->procfs, name);
#endif
@ -323,7 +323,7 @@ int mempool_deinit(FAR struct mempool_s *pool)
return -EBUSY;
}
#ifndef CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
mempool_procfs_unregister(&pool->procfs);
#endif