diff options
author | Ingo Molnar <mingo@kernel.org> | 2021-08-08 13:16:54 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2022-03-15 12:57:29 +0100 |
commit | 8e037d31f5606909a4b2cdd6d7733d223e6d5a1a (patch) | |
tree | 06f0dd237c6bcb261ecec2eb22972a98bd0f885a | |
parent | 42010ec399b4596cd3f00ac04cca435a436bda82 (diff) | |
download | tip-8e037d31f5606909a4b2cdd6d7733d223e6d5a1a.tar.gz |
headers/deps: mm: Move put_swap_device() into its separate header in <linux/swap_api_device.h>
This decouples <linux/swap.h> from <linux/percpu-refcount-api.h>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/swap.h | 9 | ||||
-rw-r--r-- | include/linux/swap_api_device.h | 25 |
2 files changed, 24 insertions, 10 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 22514524f75bca..2f5affdfe73a2f 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -516,11 +516,6 @@ extern void exit_swap_address_space(unsigned int type); extern struct swap_info_struct *get_swap_device(swp_entry_t entry); sector_t swap_page_sector(struct page *page); -static inline void put_swap_device(struct swap_info_struct *si) -{ - percpu_ref_put(&si->users); -} - #else /* CONFIG_SWAP */ static inline int swap_readpage(struct page *page, bool do_poll) @@ -538,10 +533,6 @@ static inline struct swap_info_struct *get_swap_device(swp_entry_t entry) return NULL; } -static inline void put_swap_device(struct swap_info_struct *si) -{ -} - static inline struct address_space *swap_address_space(swp_entry_t entry) { return NULL; diff --git a/include/linux/swap_api_device.h b/include/linux/swap_api_device.h index 45531f69e25a48..2cac5f33a5981e 100644 --- a/include/linux/swap_api_device.h +++ b/include/linux/swap_api_device.h @@ -1 +1,24 @@ -#include <linux/skbuff_api.h> +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_SWAP_API_DEVICE_H +#define _LINUX_SWAP_API_DEVICE_H + +#include <linux/swap.h> + +#include <linux/percpu-refcount-api.h> + +#ifdef CONFIG_SWAP + +static inline void put_swap_device(struct swap_info_struct *si) +{ + percpu_ref_put(&si->users); +} + +#else /* CONFIG_SWAP */ + +static inline void put_swap_device(struct swap_info_struct *si) +{ +} + +#endif /* CONFIG_SWAP */ + +#endif /* _LINUX_SWAP_API_DEVICE_H */ |