Re: [PATCH] drm/amdgpu: Fix build with missing pm_suspend_target_state module export

From: Borislav Petkov
Date: Tue Aug 24 2021 - 10:36:53 EST


On Tue, Aug 24, 2021 at 07:22:46PM +0530, Lazar, Lijo wrote:
> 'pm_suspend_target_state' is only available when CONFIG_PM_SLEEP
> is set/enabled.

pm_suspend_target_state is available only when CONFIG_SUSPEND is
enabled. The extern thing is only a forward declaration.

> OTOH, when both SUSPEND and HIBERNATION are not set,
> PM_SLEEP is not set, so this variable cannot be used.

And it will not be used.

> ../drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: In function
> ‘amdgpu_acpi_is_s0ix_active’:
> ../drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1046:11: error:
> ‘pm_suspend_target_state’ undeclared (first use in this function); did you
> mean ‘__KSYM_pm_suspend_target_state’?
> return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
> ^~~~~~~~~~~~~~~~~~~~~~~
> __KSYM_pm_suspend_target_state

That looks like the .config didn't have CONFIG_SUSPEND enabled.

> Also use shorter IS_ENABLED(CONFIG_foo) notation for checking the
> 2 config symbols.

What shorter notation?

> So it does look like that error can be extracted as well in some
> config.

Yah, when CONFIG_SUSPEND=n.

> Well, now it doesn't seem to be a better one. The original one checked
> both.

I don't see a reason for checking both.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette