Skip to content

Commit 6120611

Browse files
Harry Wentlandalexdeucher
authored andcommitted
drm/connector: Pull out common create_colorspace_property code
Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com> Reviewed-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Simon Ser <contact@emersion.fr> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar <uma.shankar@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Joshua Ashton <joshua@froggi.es> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Simon Ser <contact@emersion.fr> Cc: Melissa Wen <mwen@igalia.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent f96c61f commit 6120611

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

drivers/gpu/drm/drm_connector.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,33 +2135,44 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
21352135
* drm_mode_create_dp_colorspace_property() is used for DP connector.
21362136
*/
21372137

2138-
/**
2139-
* drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
2140-
* @connector: connector to create the Colorspace property on.
2141-
*
2142-
* Called by a driver the first time it's needed, must be attached to desired
2143-
* HDMI connectors.
2144-
*
2145-
* Returns:
2146-
* Zero on success, negative errno on failure.
2147-
*/
2148-
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector)
2138+
static int drm_mode_create_colorspace_property(struct drm_connector *connector,
2139+
const struct drm_prop_enum_list *colorspaces,
2140+
int size)
21492141
{
21502142
struct drm_device *dev = connector->dev;
21512143

21522144
if (connector->colorspace_property)
21532145
return 0;
21542146

2147+
if (!colorspaces)
2148+
return 0;
2149+
21552150
connector->colorspace_property =
21562151
drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
2157-
hdmi_colorspaces,
2158-
ARRAY_SIZE(hdmi_colorspaces));
2152+
colorspaces,
2153+
size);
21592154

21602155
if (!connector->colorspace_property)
21612156
return -ENOMEM;
21622157

21632158
return 0;
21642159
}
2160+
/**
2161+
* drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
2162+
* @connector: connector to create the Colorspace property on.
2163+
*
2164+
* Called by a driver the first time it's needed, must be attached to desired
2165+
* HDMI connectors.
2166+
*
2167+
* Returns:
2168+
* Zero on success, negative errno on failure.
2169+
*/
2170+
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector)
2171+
{
2172+
return drm_mode_create_colorspace_property(connector,
2173+
hdmi_colorspaces,
2174+
ARRAY_SIZE(hdmi_colorspaces));
2175+
}
21652176
EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property);
21662177

21672178
/**
@@ -2176,20 +2187,9 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property);
21762187
*/
21772188
int drm_mode_create_dp_colorspace_property(struct drm_connector *connector)
21782189
{
2179-
struct drm_device *dev = connector->dev;
2180-
2181-
if (connector->colorspace_property)
2182-
return 0;
2183-
2184-
connector->colorspace_property =
2185-
drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace",
2186-
dp_colorspaces,
2187-
ARRAY_SIZE(dp_colorspaces));
2188-
2189-
if (!connector->colorspace_property)
2190-
return -ENOMEM;
2191-
2192-
return 0;
2190+
return drm_mode_create_colorspace_property(connector,
2191+
dp_colorspaces,
2192+
ARRAY_SIZE(dp_colorspaces));
21932193
}
21942194
EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property);
21952195

0 commit comments

Comments
 (0)