]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xen/grant-table: guard gnttab_suspend/resume with CONFIG_HIBERNATE_CALLBACKS
authorPengpeng Hou <pengpeng.hou@isrc.iscas.ac.cn>
Tue, 10 Mar 2026 08:08:00 +0000 (08:08 +0000)
committerJuergen Gross <jgross@suse.com>
Fri, 10 Apr 2026 09:07:21 +0000 (11:07 +0200)
In current linux.git, gnttab_suspend() and gnttab_resume() are defined
and declared unconditionally. However, their only in-tree callers reside
in drivers/xen/manage.c, which are guarded by CONFIG_HIBERNATE_CALLBACKS.

Match the helper scope to their callers by wrapping the definitions in
CONFIG_HIBERNATE_CALLBACKS and providing no-op stubs in the header. This
fixes the config-scope mismatch and reduces the code footprint when
hibernation callbacks are disabled.

Signed-off-by: Pengpeng Hou <pengpeng.hou@isrc.iscas.ac.cn>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260310080800.742223-1-pengpeng.hou@isrc.iscas.ac.cn>

drivers/xen/grant-table.c
include/xen/grant_table.h

index 97e27f754d396a5b3845d7d3cfa096f9a8a6be8f..a6abf1ccd54ced5391394f40d9120e47440e5163 100644 (file)
@@ -1579,7 +1579,7 @@ static int gnttab_setup(void)
        }
        return gnttab_map(0, nr_grant_frames - 1);
 }
-
+#ifdef CONFIG_HIBERNATE_CALLBACKS
 int gnttab_resume(void)
 {
        gnttab_request_version();
@@ -1592,6 +1592,7 @@ int gnttab_suspend(void)
                gnttab_interface->unmap_frames();
        return 0;
 }
+#endif
 
 static int gnttab_expand(unsigned int req_entries)
 {
index 69ac6d80a006b700106f5d4b969970a0a66951e1..a33a60a2ea72de0356e7be0a03b75bbc8c2bc200 100644 (file)
@@ -84,8 +84,20 @@ struct gntab_unmap_queue_data
 };
 
 int gnttab_init(void);
+#ifdef CONFIG_HIBERNATE_CALLBACKS
 int gnttab_suspend(void);
 int gnttab_resume(void);
+#else
+static inline int gnttab_suspend(void)
+{
+       return 0;
+}
+
+static inline int gnttab_resume(void)
+{
+       return 0;
+}
+#endif
 
 int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
                                int readonly);