In new amdgpu patches, the for_each_if macro starts being used. It is defined in linux/util_macros.h. This macro begins being used in the amdgpu driver provided in Linux kernel version 6.12, and 6.14. The macro is gaurded to only be used if LINUXKPI_VERSION is above `
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
for_each_if() already exists in the DRM drivers. It was moved to <linux/util_macros.h> in Linux 6.15 (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b2108fc82a0acda34388bff3e3ee3544013b1623). Therefore it will need to be wrapped with:
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 61500 #define for_each_if... #endif
This is to avoid the risk of double definitions when used with DRM drivers from versions before 6.15.
| sys/compat/linuxkpi/common/include/linux/pm.h | ||
|---|---|---|
| 35 ↗ | (On Diff #179264) | Linux doesn’t do that, even on e.g. 7.0. When the macro was moved to <linux/util_macros.h>, <drm/drm_util.h> started to include it directly. There should be no need for this include. |
| sys/compat/linuxkpi/common/include/linux/pm.h | ||
|---|---|---|
| 35 ↗ | (On Diff #179264) | Oh, I see. I originally made the patch the header wasn't there yet. I'm looking at Linux 6.18.4, and it seems to still include it here. Should I remove the include? |
| sys/compat/linuxkpi/common/include/linux/util_macros.h | ||
|---|---|---|
| 35 | I believe the second part has reversed logic: for_each_if() should be defined here if LINUXKPI_VERSION >= 61500. Before that, it is defined in <drm/drm_util.h>. The first part is fine. | |
| sys/compat/linuxkpi/common/include/linux/util_macros.h | ||
|---|---|---|
| 35 | Should be fixed | |