Drivers: hv: vmbus: Fix harmless building warnings without CONFIG_PM
Subsystems (2)
Dexuan Cui
maintainerPATCH 1/1 Drivers: hv: vmbus: Fix harmless building warnings without CONFIG_PM
If CONFIG_PM is not set, we can comment out these functions to avoid the below warnings:
drivers/hv/vmbus_drv.c:2208:12: warning: ‘vmbus_bus_resume’ defined but not used [-Wunused-function] drivers/hv/vmbus_drv.c:2128:12: warning: ‘vmbus_bus_suspend’ defined but not used [-Wunused-function] drivers/hv/vmbus_drv.c:937:12: warning: ‘vmbus_resume’ defined but not used [-Wunused-function] drivers/hv/vmbus_drv.c:918:12: warning: ‘vmbus_suspend’ defined but not used [-Wunused-function]
--- drivers/hv/vmbus_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hv/vmbus_drv.c +6 -0
@@ -912,6 +912,7 @@ static void vmbus_shutdown(struct device *child_device) drv->shutdown (dev); } +#ifdef CONFIG_PM /* * vmbus_suspend - Suspend a vmbus device */
@@ -949,6 +950,7 @@ static int vmbus_resume(struct device *child_device) return drv->resume(dev); } +#endif /* CONFIG_PM */ /* * vmbus_device_release - Final callback release of the vmbus child device
@@ -1070,6 +1072,7 @@ void vmbus_on_msg_dpc(unsigned long data)vmbus_signal_eom (msg, message_type); } +#ifdef CONFIG_PM /* * Fake RESCIND_CHANNEL messages to clean up hv_sock channels by force for * hibernation, because hv_sock connections can not persist across hibernation.
@@ -1105,6 +1108,7 @@ static void vmbus_force_channel_rescinded(struct vmbus_channel *channel) vmbus_connection.work_queue, &ctx->work); } +#endif /* CONFIG_PM */ /* * Direct callback for channels using other deferred processing
@@ -2125,6 +2129,7 @@ static int vmbus_acpi_add(struct acpi_device *device)return ret_val; } +#ifdef CONFIG_PM static int vmbus_bus_suspend (struct device *dev) {struct vmbus_channel *channel, *sc;
@@ -2247,6 +2252,7 @@ static int vmbus_bus_resume(struct device *dev)return 0 ; } +#endif /* CONFIG_PM */ static const struct acpi_device_id vmbus_acpi_device_ids[] = { {"VMBUS" ,0 },
Signature · 1 line
2.19.1
Quoted 9 lines · Dexuan Cui
If
CONFIG_PMis not set, we can comment out these functions to avoid the below warnings:
drivers/hv/vmbus_drv.c:2208:12: warning: ‘vmbus_bus_resume’ defined but not used [-Wunused-function]drivers/hv/vmbus_drv.c:2128:12: warning: ‘vmbus_bus_suspend’ defined but not used [-Wunused-function]drivers/hv/vmbus_drv.c:937:12: warning: ‘vmbus_resume’ defined but not used [-Wunused-function]drivers/hv/vmbus_drv.c:918:12: warning: ‘vmbus_suspend’ defined but not used [-Wunused-function]
Quoted 4 lines
Fixes 271b2224d42f ("Drivers: hv: vmbus: Implement suspend/resume for VSC drivers for hibernation")Fixes f53335e3289f ("Drivers: hv: vmbus: Suspend/resume the vmbus itself for hibernation")Reported-by Arnd Bergmann <[email protected]>Signed-off-by Dexuan Cui <[email protected]>
I think this will still produce a warning if CONFIG_PM is set but CONFIG_PM_SLEEP is not, possibly in other configurations as well.
Arnd
Dexuan Cui
maintainerQuoted 19 lines
Sent: Thursday, September 19, 2019 5:11 AM
Quoted 5 lines · Dexuan Cui
If
CONFIG_PMis not set, we can comment out these functions to avoid the below warnings:
drivers/hv/vmbus_drv.c:2208:12: warning: ‘vmbus_bus_resume’ definedbut not used [-Wunused-function]
Quoted 1 line
drivers/hv/vmbus_drv.c:2128:12: warning: ‘vmbus_bus_suspend’ definedbut not used [-Wunused-function]
Quoted 1 line
drivers/hv/vmbus_drv.c:937:12: warning: ‘vmbus_resume’ defined but notused [-Wunused-function]
Quoted 1 line
drivers/hv/vmbus_drv.c:918:12: warning: ‘vmbus_suspend’ defined but notused [-Wunused-function]
Quoted 2 lines
Fixes 271b2224d42f ("Drivers: hv: vmbus: Implement suspend/resume forVSC drivers for hibernation")
Quoted 1 line
Fixes f53335e3289f ("Drivers: hv: vmbus: Suspend/resume the vmbus itselffor hibernation")
Quoted 8 lines
Quoted 2 lines
Reported-by Arnd Bergmann <[email protected]>Signed-off-by Dexuan Cui <[email protected]>I think this will still produce a warning if
CONFIG_PMis set butCONFIG_PM_SLEEPis not, possibly in other configurations as well.Arnd
You're correct. Thanks!
I'll use " #ifdef CONFIG_PM_SLEEP ... #endif" instead.
The mentioned functions are only used in the micros SET_NOIRQ_SYSTEM_SLEEP_PM_OPS, which is empty if CONFIG_PM_SLEEP is not defined. So it looks to me using "#ifdef CONFIG_PM_SLEEP ..." should resolve the issue.
BTW, CONFIG_PM_SLEEP depends on CONFIG_PM, so if CONFIG_PM is not defined, CONFIG_PM_SLEEP is not defined either.
Thanks,
-- Dexuan
Quoted 7 lines · Dexuan Cui
Quoted 6 lines
Sent: Thursday, September 19, 2019 5:11 AM
On Thu, Sep 19, 2019 at 7:19 AM Dexuan Cui <[email protected]> wrote:I think this will still produce a warning if
CONFIG_PMis set butCONFIG_PM_SLEEPis not, possibly in other configurations as well.
Quoted 8 lines
You're correct. Thanks!
I'll use " #ifdef
CONFIG_PM_SLEEP... #endif" instead.The mentioned functions are only used in the micros
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS, which is empty ifCONFIG_PM_SLEEPis not defined. So it looks to me using "#ifdefCONFIG_PM_SLEEP..." should resolve the issue.
Probably, yes. There are sometimes surprising effects, such as when one of the functions inside of the #ifdef call another function that is otherwise unused.
I would normally try to build a few hundred randconfig builds to be fairly sure of a change like this, or use __maybe_unused like most other drivers do here.
Arnd
Dexuan Cui
maintainerQuoted 15 lines
From: Arnd Bergmann <[email protected]>
Sent: Friday, September 20, 2019 12:33 AMQuoted 2 lines · Dexuan Cui
Quoted 2 lines
Sent: Thursday, September 19, 2019 5:11 AM
On Thu, Sep 19, 2019 at 7:19 AM Dexuan Cui <[email protected]>Quoted 8 lines · wrote:
Quoted 3 lines
I think this will still produce a warning if
CONFIG_PMis set butCONFIG_PM_SLEEPis not, possibly in other configurations as well.You're correct. Thanks!
I'll use " #ifdef
CONFIG_PM_SLEEP... #endif" instead.
Quoted 7 lines
Quoted 4 lines
The mentioned functions are only used in the micros
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS, which is empty ifCONFIG_PM_SLEEPis not defined. So it looks to me using "#ifdefCONFIG_PM_SLEEP..." should resolve the issue.Probably, yes. There are sometimes surprising effects, such as when one of the functions inside of the #ifdef call another function that is otherwise unused.
I reviewed the related functions again and I believe with the v2 we don't have such an issue as you described here.
Quoted 4 lines
I would normally try to build a few hundred randconfig builds to be fairly sure of a change like this, or use
__maybe_unusedlike most other drivers do here.Arnd
I do see a lot of drivers using __maybe_unused, but IMO conditional compilation is slightly better. In case conditional compilation still has some unexpected issue, we can always make a further fix. :-)
Thanks,
-- Dexuan