Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/blend: unneeded extraction of rotation_props[] and duplicated rotation names --
commit 1ed6793c09db95dc37f1bc98ca275a5ad9c3ac91 Author: Louis Chauvet <[email protected]> drm/blend: Get a rotation name from its bitfield This commit adds the DRM_ROTATION_FMT and DRM_ROTATION_FMT_ARGS() helpers to print human-readable rotation bitmasks and moves the rotation property enum array to file scope. > diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c > index d17ae964fb21f..b62f1db9c3114 100644 > --- a/drivers/gpu/drm/drm_blend.c > +++ b/drivers/gpu/drm/drm_blend.c > @@ -256,6 +256,15 @@ int drm_plane_create_alpha_property(struct drm_plane > *plane) > } > EXPORT_SYMBOL(drm_plane_create_alpha_property); > > +static const struct drm_prop_enum_list rotation_props[] = { > + { __builtin_ffs(DRM_MODE_ROTATE_0) - 1, "rotate-0" }, > + { __builtin_ffs(DRM_MODE_ROTATE_90) - 1, "rotate-90" }, > + { __builtin_ffs(DRM_MODE_ROTATE_180) - 1, "rotate-180" }, > + { __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" }, > + { __builtin_ffs(DRM_MODE_REFLECT_X) - 1, "reflect-x" }, > + { __builtin_ffs(DRM_MODE_REFLECT_Y) - 1, "reflect-y" }, > +}; > + > /** > * drm_plane_create_rotation_property - create a new rotation property > * @plane: drm plane > @@ -294,14 +303,6 @@ int drm_plane_create_rotation_property(struct drm_plane > *plane, > unsigned int rotation, > unsigned int supported_rotations) > { > - static const struct drm_prop_enum_list props[] = { > - { __builtin_ffs(DRM_MODE_ROTATE_0) - 1, "rotate-0" }, > - { __builtin_ffs(DRM_MODE_ROTATE_90) - 1, "rotate-90" }, > - { __builtin_ffs(DRM_MODE_ROTATE_180) - 1, "rotate-180" }, > - { __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" }, > - { __builtin_ffs(DRM_MODE_REFLECT_X) - 1, "reflect-x" }, > - { __builtin_ffs(DRM_MODE_REFLECT_Y) - 1, "reflect-y" }, > - }; > struct drm_property *prop; > > WARN_ON((supported_rotations & DRM_MODE_ROTATE_MASK) == 0); > @@ -309,7 +310,7 @@ int drm_plane_create_rotation_property(struct drm_plane > *plane, > WARN_ON(rotation & ~supported_rotations); > > prop = drm_property_create_bitmask(plane->dev, 0, "rotation", > - props, ARRAY_SIZE(props), > + rotation_props, > ARRAY_SIZE(rotation_props), > supported_rotations); > if (!prop) > return -ENOMEM; > diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h > index bebbb77a8f214..f000b10a16e70 100644 > --- a/include/drm/drm_blend.h > +++ b/include/drm/drm_blend.h [ ... ] > +#define DRM_ROTATION_FMT_ARGS(rot) \ > + ((rot) & DRM_MODE_ROTATE_0) ? "rotate-0 " : "", \ > + ((rot) & DRM_MODE_ROTATE_90) ? "rotate-90 " : "", \ > + ((rot) & DRM_MODE_ROTATE_180) ? "rotate-180 " : "", \ > + ((rot) & DRM_MODE_ROTATE_270) ? "rotate-270 " : "", \ > + ((rot) & DRM_MODE_REFLECT_X) ? "reflect-x " : "", \ > + ((rot) & DRM_MODE_REFLECT_Y) ? "reflect-y " : "", \ > + (rot) [Severity: Low] Why move props[] out of drm_plane_create_rotation_property() to file-scope rotation_props[] when DRM_ROTATION_FMT_ARGS() hardcodes its own copy of the rotation strings? rotation_props[] remains static in drm_blend.c with drm_plane_create_rotation_property() as its only user, so either the array can stay local to that function (and the commit message updated) or the string definitions should be shared. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
