Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: document drm_property_enum.value for bitfields

When a property has the type DRM_MODE_PROP_BITMASK, the value field
stores a bitshift, not a bitmask, which can be surprising.

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/NUZTPTKKZtAlDhxIXFB1qrUqWBYKapkBxCnb1S1bc3g@cp3-web-033.plabs.ch

+8 -1
+8 -1
include/drm/drm_property.h
··· 31 31 32 32 /** 33 33 * struct drm_property_enum - symbolic values for enumerations 34 - * @value: numeric property value for this enum entry 35 34 * @head: list of enum values, linked to &drm_property.enum_list 36 35 * @name: symbolic name for the enum 37 36 * ··· 38 39 * decoding for each value. This is used for example for the rotation property. 39 40 */ 40 41 struct drm_property_enum { 42 + /** 43 + * @value: numeric property value for this enum entry 44 + * 45 + * If the property has the type &DRM_MODE_PROP_BITMASK, @value stores a 46 + * bitshift, not a bitmask. In other words, the enum entry is enabled 47 + * if the bit number @value is set in the property's value. This enum 48 + * entry has the bitmask ``1 << value``. 49 + */ 41 50 uint64_t value; 42 51 struct list_head head; 43 52 char name[DRM_PROP_NAME_LEN];