Message ID | 20240104160301.185915-4-jfalempe@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/panic: Add a drm panic handler | expand |
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,
On Mon, 2024-01-08 at 11:24 +0100, Jocelyn Falempe wrote: > 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 ? > checkpatch is a brainless regex script. Ignore it when it's stupid.
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
To support drm_panic, most drivers need to find the current primary visible plane with a framebuffer attached. Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com> --- include/drm/drm_plane.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)