* [PATCH] net: dsa: scope dsa_user_suspend() and dsa_user_resume() to PM_SLEEP
@ 2026-03-09 7:52 Pengpeng Hou
0 siblings, 0 replies; only message in thread
From: Pengpeng Hou @ 2026-03-09 7:52 UTC (permalink / raw)
To: andrew, olteanv, davem, edumazet, kuba, pabeni
Cc: horms, netdev, linux-kernel, 18291782795, pengpeng
From: pengpeng@iscas.ac.cn
In current linux.git (1954c4f01220), the helpers dsa_user_suspend()
and dsa_user_resume() are defined and declared unconditionally. However,
their only in-tree callers are within dsa_switch_suspend() and
dsa_switch_resume() in net/dsa/dsa.c, which are already guarded by
CONFIG_PM_SLEEP.
Match the helper scope to their callers by wrapping the definitions in
"#ifdef CONFIG_PM_SLEEP" and providing no-op stubs in the header. This
fixes the config-scope mismatch and reduces unnecessary code footprint
when PM_SLEEP is disabled.
Signed-off-by: pengpeng@iscas.ac.cn
---
diff --git a/net/dsa/user.c b/net/dsa/user.c
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@
-int dsa_user_suspend(struct net_device *user_dev)
+#ifdef CONFIG_PM_SLEEP
+int dsa_user_suspend(struct net_device *user_dev)
{
struct dsa_port *dp = dsa_user_to_port(user_dev);
@@
int dsa_user_resume(struct net_device *user_dev)
{
struct dsa_port *dp = dsa_user_to_port(user_dev);
@@
return 0;
}
+#endif
int dsa_user_create(struct dsa_port *port)
{
diff --git a/net/dsa/user.h b/net/dsa/user.h
--- a/net/dsa/user.h
+++ b/net/dsa/user.h
@@
int dsa_user_create(struct dsa_port *dp);
void dsa_user_destroy(struct net_device *user_dev);
+#ifdef CONFIG_PM_SLEEP
int dsa_user_suspend(struct net_device *user_dev);
int dsa_user_resume(struct net_device *user_dev);
+#else
+static inline int dsa_user_suspend(struct net_device *user_dev)
+{
+ return 0;
+}
+
+static inline int dsa_user_resume(struct net_device *user_dev)
+{
+ return 0;
+}
+#endif
int dsa_user_register_notifier(void);
void dsa_user_unregister_notifier(void);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-09 7:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 7:52 [PATCH] net: dsa: scope dsa_user_suspend() and dsa_user_resume() to PM_SLEEP Pengpeng Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox