Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: scope ci_ulpi_resume() to CONFIG_PM
@ 2026-03-09  8:45 Pengpeng Hou
  2026-03-11 14:18 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-03-09  8:45 UTC (permalink / raw)
  To: peter.chen, gregkh; +Cc: linux-usb, linux-kernel, 18291782795, Pengpeng Hou

In current linux.git (1954c4f01220), ci_ulpi_resume() is defined
and declared unconditionally. However, its only in-tree caller is within
ci_controller_resume() in drivers/usb/chipidea/core.c, which is already
guarded by #ifdef CONFIG_PM.

Match the helper scope to its caller by wrapping the definition in
CONFIG_PM and providing a no-op stub in the header. This fixes the
config-scope mismatch and avoids unnecessary code inclusion when
power management is disabled.

Signed-off-by: Pengpeng Hou <pengpeng.hou@isrc.iscas.ac.cn>
---
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@
 int ci_ulpi_init(struct ci_hdrc *ci);
 void ci_ulpi_exit(struct ci_hdrc *ci);
+#ifdef CONFIG_PM
 int ci_ulpi_resume(struct ci_hdrc *ci);
+#else
+static inline int ci_ulpi_resume(struct ci_hdrc *ci)
+{
+	return 0;
+}
+#endif
 
 u32 hw_read_intr_enable(struct ci_hdrc *ci);
diff --git a/drivers/usb/chipidea/ulpi.c b/drivers/usb/chipidea/ulpi.c
--- a/drivers/usb/chipidea/ulpi.c
+++ b/drivers/usb/chipidea/ulpi.c
@@
 void ci_ulpi_exit(struct ci_hdrc *ci)
 {
 	if (ci->ulpi) {
 		ulpi_unregister_interface(ci->ulpi);
 		ci->ulpi = NULL;
 	}
 }
 
+#ifdef CONFIG_PM
 int ci_ulpi_resume(struct ci_hdrc *ci)
 {
 	int cnt = 100000;
@@
 
 	return -ETIMEDOUT;
 }
+#endif


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

* Re: [PATCH] usb: chipidea: scope ci_ulpi_resume() to CONFIG_PM
  2026-03-09  8:45 [PATCH] usb: chipidea: scope ci_ulpi_resume() to CONFIG_PM Pengpeng Hou
@ 2026-03-11 14:18 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-03-11 14:18 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: peter.chen, linux-usb, linux-kernel, 18291782795

On Mon, Mar 09, 2026 at 08:45:23AM +0000, Pengpeng Hou wrote:
> In current linux.git (1954c4f01220), ci_ulpi_resume() is defined

No need to reference the tree like this, that's not the normal way.

> and declared unconditionally. However, its only in-tree caller is within
> ci_controller_resume() in drivers/usb/chipidea/core.c, which is already
> guarded by #ifdef CONFIG_PM.
> 
> Match the helper scope to its caller by wrapping the definition in
> CONFIG_PM and providing a no-op stub in the header. This fixes the
> config-scope mismatch and avoids unnecessary code inclusion when
> power management is disabled.

How much does this actually save?  Why is only resume() needed to be
#ifdef here, not suspend?

thanks,

greg k-h

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

end of thread, other threads:[~2026-03-11 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09  8:45 [PATCH] usb: chipidea: scope ci_ulpi_resume() to CONFIG_PM Pengpeng Hou
2026-03-11 14:18 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox