Skip to content

Commit 3f100dd

Browse files
Pengpeng Houjgross1
authored andcommitted
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>
1 parent bdd5de3 commit 3f100dd

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/xen/grant-table.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ static int gnttab_setup(void)
15791579
}
15801580
return gnttab_map(0, nr_grant_frames - 1);
15811581
}
1582-
1582+
#ifdef CONFIG_HIBERNATE_CALLBACKS
15831583
int gnttab_resume(void)
15841584
{
15851585
gnttab_request_version();
@@ -1592,6 +1592,7 @@ int gnttab_suspend(void)
15921592
gnttab_interface->unmap_frames();
15931593
return 0;
15941594
}
1595+
#endif
15951596

15961597
static int gnttab_expand(unsigned int req_entries)
15971598
{

include/xen/grant_table.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,20 @@ struct gntab_unmap_queue_data
8484
};
8585

8686
int gnttab_init(void);
87+
#ifdef CONFIG_HIBERNATE_CALLBACKS
8788
int gnttab_suspend(void);
8889
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
89101

90102
int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
91103
int readonly);

0 commit comments

Comments
 (0)