Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make irq-imx-irqsteer build without PM_SLEEP #15

Open
wants to merge 2 commits into
base: lf-5.15.y
Choose a base branch
from

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

Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
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 <joerg.sommer@navimatix.de>
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