[PATCH 3/3] vmw_balloon: open-code vmballoon_compaction_init()

From: Nadav Amit
Date: Tue Sep 13 2022 - 14:12:01 EST


From: Nadav Amit <namit@xxxxxxxxxx>

Following commit 68f2736a85832 ("mm: Convert all PageMovable users to
movable_operations"), the code of vmballoon_compaction_init() is very
simple and does not worth a separate function.

Instead, open code vmballoon_compaction_init. As migratepage is always
defined, use IS_ENABLED(), which makes the code easier to read. No
functional change is intended.

Signed-off-by: Nadav Amit <namit@xxxxxxxxxx>
---
drivers/misc/vmw_balloon.c | 26 +++-----------------------
1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 762442b9ece8..46212cd09854 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1848,28 +1848,6 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
return ret;
}

-/**
- * vmballoon_compaction_init() - initialized compaction for the balloon.
- *
- * @b: pointer to the balloon.
- *
- * If during the initialization a failure occurred, this function does not
- * perform cleanup. The caller must call vmballoon_compaction_deinit() in this
- * case.
- *
- * Return: zero on success or error code on failure.
- */
-static __init void vmballoon_compaction_init(struct vmballoon *b)
-{
- b->b_dev_info.migratepage = vmballoon_migratepage;
-}
-
-#else /* CONFIG_BALLOON_COMPACTION */
-static inline void vmballoon_compaction_init(struct vmballoon *b)
-{
-}
-#endif /* CONFIG_BALLOON_COMPACTION */
-
static int __init vmballoon_init(void)
{
int error;
@@ -1909,7 +1887,9 @@ static int __init vmballoon_init(void)
* balloon_devinfo_init() .
*/
balloon_devinfo_init(&balloon.b_dev_info);
- vmballoon_compaction_init(&balloon);
+
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ b->b_dev_info.migratepage = vmballoon_migratepage;

queue_delayed_work(system_freezable_wq, &balloon.dwork, 0);

--
2.25.1