Hi checkpatch maintainers,
This patch gives me the following checkpatch error:
ERROR: Macros with complex values should be enclosed in parentheses
#30: FILE: include/drm/drm_plane.h:959:
+#define drm_for_each_primary_visible_plane(plane, dev) \
+ list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
+ for_each_if((plane)->type == DRM_PLANE_TYPE_PRIMARY && \
+ (plane)->state && \
+ (plane)->state->fb && \
+ (plane)->state->visible)
total: 1 errors, 0 warnings, 21 lines checked
I think this requirement cannot work when you use list_for_each kind of
macros.
Do you have any suggestion ?
Best regards,
--
Jocelyn
On 04/01/2024 17:00, Jocelyn Falempe wrote:
To support drm_panic, most drivers need to find the current primary
visible plane with a framebuffer attached.
Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---
include/drm/drm_plane.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index c6565a6f9324..41c08a2ddf8d 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -948,6 +948,21 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
for_each_if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+/**
+ * drm_for_each_primary_visible_plane - iterate over all primary visible planes
+ * @plane: the loop cursor
+ * @dev: the DRM device
+ *
+ * Iterate over all primary, visible plane, with a framebuffer.
+ * This is useful for drm_panic, to find the current scanout buffer.
+ */
+#define drm_for_each_primary_visible_plane(plane, dev) \
+ list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
+ for_each_if((plane)->type == DRM_PLANE_TYPE_PRIMARY && \
+ (plane)->state && \
+ (plane)->state->fb && \
+ (plane)->state->visible)
+
/**
* drm_for_each_plane - iterate over all planes
* @plane: the loop cursor