mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
scst/include/backport.h: Add a mempool_destroy() backport
This patch makes it safe to call mempool_destroy(NULL) for kernel versions before v4.3. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8150 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -815,6 +815,21 @@ static inline long get_user_pages_backport(unsigned long start,
|
||||
#define get_user_pages get_user_pages_backport
|
||||
#endif
|
||||
|
||||
/* <linux/mempoool.h> */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
|
||||
/*
|
||||
* See also commit 4e3ca3e033d1 ("mm/mempool: allow NULL `pool' pointer in
|
||||
* mempool_destroy()") # v4.3.
|
||||
*/
|
||||
static inline void mempool_destroy_backport(mempool_t *pool)
|
||||
{
|
||||
if (pool)
|
||||
mempool_destroy(pool);
|
||||
}
|
||||
|
||||
#define mempool_destroy mempool_destroy_backport
|
||||
#endif
|
||||
|
||||
/* <linux/mm.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && \
|
||||
|
||||
Reference in New Issue
Block a user