netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc
@ 2022-11-30 12:36 Andy Shevchenko
  2022-11-30 12:36 ` [PATCH net-next v3 2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header Andy Shevchenko
  2022-12-02 11:20 ` [PATCH net-next v3 1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-11-30 12:36 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Michael Jamet, Mika Westerberg, Yehezkel Bernat, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andy Shevchenko

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(-)

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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-02 11:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 12:36 [PATCH net-next v3 1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc Andy Shevchenko
2022-11-30 12:36 ` [PATCH net-next v3 2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header Andy Shevchenko
2022-11-30 12:58   ` Mika Westerberg
2022-11-30 14:11     ` Andy Shevchenko
2022-12-02 11:20 ` [PATCH net-next v3 1/2] net: thunderbolt: Switch from __maybe_unused to pm_sleep_ptr() etc patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).