Skip to content

Conversation

jo-so-nx
Copy link

@jo-so-nx jo-so-nx commented Nov 1, 2023

The current version fails to build, if PM_SLEEP is not defined:

/build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c: In function 'imx_irqsteer_chans_enable':
/build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c:194:34: error: 'irqsteer_data' undeclared (first use in this function)
  194 |         ret = clk_prepare_enable(irqsteer_data->ipg_clk);
      |                                  ^~~~~~~~~~~~~
/build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c:194:34: note: each undeclared identifier is reported only once for each function it appears in
In file included from /build/tmp/work-shared/machine/kernel-source/include/linux/device.h:25,
                 from /build/tmp/work-shared/machine/kernel-source/include/linux/of_platform.h:9,
                 from /build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c:15:
/build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c: At top level:
/build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c:386:28: error: 'imx_irqsteer_runtime_suspend' undeclared here (not in a function); did you mean 'pm_generic_runtime_suspend'?
  386 |         SET_RUNTIME_PM_OPS(imx_irqsteer_runtime_suspend,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/tmp/work-shared/machine/kernel-source/include/linux/pm.h:341:28: note: in definition of macro 'SET_RUNTIME_PM_OPS'
  341 |         .runtime_suspend = suspend_fn, \
      |                            ^~~~~~~~~~
/build/tmp/work-shared/machine/kernel-source/drivers/irqchip/irq-imx-irqsteer.c:387:28: error: 'imx_irqsteer_runtime_resume' undeclared here (not in a function)
  387 |                            imx_irqsteer_runtime_resume, NULL)
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/tmp/work-shared/machine/kernel-source/include/linux/pm.h:342:27: note: in definition of macro 'SET_RUNTIME_PM_OPS'
  342 |         .runtime_resume = resume_fn, \
      |                           ^~~~~~~~~
make[2]: *** [/build/tmp/work-shared/machine/kernel-source/scripts/Makefile.build:289: drivers/irqchip/irq-imx-irqsteer.o] Error 1
make[1]: *** [/build/tmp/work-shared/machine/kernel-source/scripts/Makefile.build:552: drivers/irqchip] Error 2

The build of the module without `CONFIG_PM_SLEEP` fails, because the symbols
`imx_irqsteer_runtime_suspend` and `imx_irqsteer_runtime_resume` are not
defined.

This fix defines `imx_irqsteer_pm_ops` only if `PM_SLEEP` is set, and uses
*NULL* in `platform_driver->driver->pm` otherwise. This is valid according
to *Documentation/power/runtime_pm.rst*: “the PM core will invoke the
corresponding driver callback stored in dev->driver->pm directly (if
present).” The idea was taken from *drivers/acpi/fan.c*.

Signed-off-by: Jörg Sommer <[email protected]>
Overdr0ne pushed a commit to Overdr0ne/linux-imx that referenced this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant