for_each_if() was moved from <drm/drm_util.h> to <linux/util_macros.h> in
Linux 6.15
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
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 | |
| sys/compat/linuxkpi/common/include/linux/util_macros.h | ||
|---|---|---|
| 2 |
| |
| 3 | I cannot remember what @imp said last time if this according to style goes below or if this was to be relaxed again? | |
| 10 | Do we need the full copy of the license given we have the SPDX? | |
| 35 | If this is used by drm-kmod 6.12 already why do we only enable it for >= 6.15? Ah I see @dumbbell 's comment. Please make sure the commit message gets adjusted before push! | |
| sys/compat/linuxkpi/common/include/linux/util_macros.h | ||
|---|---|---|
| 2 | While it is still true that the *-* is no longer needed, you can just remove it before committing or leaving it. | |
Why, because of the '-' left? It's no longer needed but we haven't eradicated from the tree.
If I once understood @imp correctly the order of (c) and SPDX may well likely change back to the predominant style in the OS world.
So even if not perfect this is fine to go in and should have long ago.
@siri_racha.ca , i reformatted the summary, you can edit it if you wish.
It should be 80 columns or less.
Thank you @seuros , I did also run a build test and it seems to build with no issues.
The commit message still says 6.12; should detail the move for 6.15. See also https://reviews.freebsd.org/D58254
I have one small comment left.
Also, please specify in the comment and the commit message the history of that macro to help understand the check. I had something like this locally:
/* * `for_each_if()` was moved from <drm/drm_util.h> to <linux/util_macros.h> in * Linux 6.15. */
Feel free to commit your patch afterwards!
| sys/compat/linuxkpi/common/include/linux/util_macros.h | ||
|---|---|---|
| 12 | I think you can remove the #ifndef for_each_if check. The check of LINUXKPI_VERSION is enough IMHO. | |
Sounds good, I've made the changes, but I don't have commit bit... Do you think you can merge this & the other changes in the stack in? Thank you so much!
Sure, I will do that! I will just move the comment closer to the macro if you don’t mind. Thank you for the patch :-)