From: pengpeng.hou@isrc.iscas.ac.cn
In current linux.git (1954c4f01220), 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 #ifdef 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@isrc.iscas.ac.cn
---
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@
-int gnttab_resume(void)
+#ifdef CONFIG_HIBERNATE_CALLBACKS
+int gnttab_resume(void)
{
gnttab_request_version();
return gnttab_setup();
@@
if (xen_pv_domain())
gnttab_interface->unmap_frames();
return 0;
}
+#endif
static int gnttab_expand(unsigned int req_entries)
{
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@
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);
On 09.03.26 09:36, Pengpeng Hou wrote:
> From: pengpeng.hou@isrc.iscas.ac.cn
>
> In current linux.git (1954c4f01220), 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 #ifdef 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@isrc.iscas.ac.cn
> ---
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@
> -int gnttab_resume(void)
> +#ifdef CONFIG_HIBERNATE_CALLBACKS
> +int gnttab_resume(void)
> {
> gnttab_request_version();
> return gnttab_setup();
> @@
> if (xen_pv_domain())
> gnttab_interface->unmap_frames();
> return 0;
> }
> +#endif
>
> static int gnttab_expand(unsigned int req_entries)
> {
> diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
> --- a/include/xen/grant_table.h
> +++ b/include/xen/grant_table.h
> @@
>
> 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);
>
>
I do agree on the purpose of the patch, but the patch itself is a little
bit strange. The hunks lack any information about line numbers and hunk
size, and the context is not consistent (0 - 4 lines of unmodified code
around the modified parts).
Please produce the patch with a proper tool, like "git format-patch".
Juergen
© 2016 - 2026 Red Hat, Inc.