[net-next,v3,1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc

Message ID 20221130123613.20829-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [net-next,v3,1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc |

Commit Message

Andy Shevchenko Nov. 30, 2022, 12:36 p.m. UTC
  Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less heavier for builds
than the use of __maybe_unused attributes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
v3: sent proper patch
v2: added tag (Mika)
 drivers/net/thunderbolt.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
  

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 2, 2022, 11:20 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 30 Nov 2022 14:36:12 +0200 you wrote:
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less heavier for builds
> than the use of __maybe_unused attributes.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc
    https://git.kernel.org/netdev/net-next/c/0bbe50f3e85a
  - [net-next,v3,2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header
    https://git.kernel.org/netdev/net-next/c/a479f9264bdd

You are awesome, thank you!
  

Patch

diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
index b20cd370b7f2..c73d419f1456 100644
--- a/drivers/net/thunderbolt.c
+++ b/drivers/net/thunderbolt.c
@@ -1319,7 +1319,7 @@  static void tbnet_shutdown(struct tb_service *svc)
 	tbnet_tear_down(tb_service_get_drvdata(svc), true);
 }
 
-static int __maybe_unused tbnet_suspend(struct device *dev)
+static int tbnet_suspend(struct device *dev)
 {
 	struct tb_service *svc = tb_to_service(dev);
 	struct tbnet *net = tb_service_get_drvdata(svc);
@@ -1334,7 +1334,7 @@  static int __maybe_unused tbnet_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused tbnet_resume(struct device *dev)
+static int tbnet_resume(struct device *dev)
 {
 	struct tb_service *svc = tb_to_service(dev);
 	struct tbnet *net = tb_service_get_drvdata(svc);
@@ -1350,9 +1350,7 @@  static int __maybe_unused tbnet_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops tbnet_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(tbnet_suspend, tbnet_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(tbnet_pm_ops, tbnet_suspend, tbnet_resume);
 
 static const struct tb_service_id tbnet_ids[] = {
 	{ TB_SERVICE("network", 1) },
@@ -1364,7 +1362,7 @@  static struct tb_service_driver tbnet_driver = {
 	.driver = {
 		.owner = THIS_MODULE,
 		.name = "thunderbolt-net",
-		.pm = &tbnet_pm_ops,
+		.pm = pm_sleep_ptr(&tbnet_pm_ops),
 	},
 	.probe = tbnet_probe,
 	.remove = tbnet_remove,