Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen/grant-table: guard gnttab_suspend/resume with CONFIG_HIBERNATE_CALLBACKS

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>

authored by

Pengpeng Hou and committed by
Juergen Gross
3f100dd6 bdd5de3d

+14 -1
+2 -1
drivers/xen/grant-table.c
··· 1579 1579 } 1580 1580 return gnttab_map(0, nr_grant_frames - 1); 1581 1581 } 1582 - 1582 + #ifdef CONFIG_HIBERNATE_CALLBACKS 1583 1583 int gnttab_resume(void) 1584 1584 { 1585 1585 gnttab_request_version(); ··· 1592 1592 gnttab_interface->unmap_frames(); 1593 1593 return 0; 1594 1594 } 1595 + #endif 1595 1596 1596 1597 static int gnttab_expand(unsigned int req_entries) 1597 1598 {
+12
include/xen/grant_table.h
··· 84 84 }; 85 85 86 86 int gnttab_init(void); 87 + #ifdef CONFIG_HIBERNATE_CALLBACKS 87 88 int gnttab_suspend(void); 88 89 int gnttab_resume(void); 90 + #else 91 + static inline int gnttab_suspend(void) 92 + { 93 + return 0; 94 + } 95 + 96 + static inline int gnttab_resume(void) 97 + { 98 + return 0; 99 + } 100 + #endif 89 101 90 102 int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, 91 103 int readonly);